Frequent APPARENT DEADLOCK messages appearing in the Confluence logs

Still need help?

The Atlassian Community is here for you.

Ask the community


Problem

The following message appears frequently in the atlassian-confluence.log. There doesn't appear to be any negative impact on the application performance from what has been observed. 

2018-12-05 11:43:12,489 WARN [C3P0PooledConnectionPoolManager[identityToken->2yu2zx9zrbkq9i6l1kgv|4b07f267]-AdminTaskTimer] [mchange.v2.async.ThreadPoolAsynchronousRunner] log com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@3eefb34a -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
2018-12-05 11:43:12,489 WARN [C3P0PooledConnectionPoolManager[identityToken->2yu2zx9zrbkq9i6l1kgv|4b07f267]-AdminTaskTimer] [mchange.v2.async.ThreadPoolAsynchronousRunner] log com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@3eefb34a -- APPARENT DEADLOCK!!! Complete Status: 
	Managed Threads: 3
	Active Threads: 3
	Active Tasks: 
		com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@442a2fb5
			on thread: C3P0PooledConnectionPoolManager[identityToken->2yu2zx9zrbkq9i6l1kgv|4b07f267]-HelperThread-#0
		com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@545e6f5e
			on thread: C3P0PooledConnectionPoolManager[identityToken->2yu2zx9zrbkq9i6l1kgv|4b07f267]-HelperThread-#1
		com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@43cf3636
			on thread: C3P0PooledConnectionPoolManager[identityToken->2yu2zx9zrbkq9i6l1kgv|4b07f267]-HelperThread-#2

Diagnosis

Environment

  • Confluence

  • Any connected database

Diagnostic Steps

  • No database degradation has observed

Cause

This error can indicate issues with the database, it's connection pool and the database's ability to cleanly acquire a new connection.

If for whatever reason, a database server reboots or a network failure has occurred, all connections in the available database connection pool are broken. If the connection pool became broken for some reason, and no other threads were readily available in the pool, Confluence may report this issue in the logs as the observed APPARENT DEADLOCK message in the logs to explain that the database is intervening to create emergency database threads to process requests.

Resolution

If a problem exists within the database connection pool, this issue can be mitigated with a small change to your database configuration that adds a validation query to check for broken connections and cleanse them from the availability pool.  This is enabled by default on new installations (Confluence 6.5 and later), but if you have upgraded from an earlier version of Confluence, you may need to make this change manually:

  1. Stop Confluence.
  2. Perform a safety backup of <confluence-home>/confluence.cfg.xml
  3. Edit the <confluence-home>/confluence.cfg.xml file.
  4. Insert the following properties for PostgreSQL, MSSQL, MySQL:

    <property name="hibernate.c3p0.preferredTestQuery">select 1</property>
  5. Save confluence.cfg.xml
  6. Restart Confluence.

(warning) If you are leveraging an Oracle database, the validation query will vary slightly as noted below: 

<property name="hibernate.c3p0.preferredTestQuery">select 1 from dual</property>

For more information into how to configure the validation query for datasource connected databases, view the Surviving Database Connection Closures documentation. 


(info)  Note that this setting doesn't apply to Confluence versions > 7.12.0 due to the implementation of CONFSERVER-62338: Update Default Confluence Configuration.


DescriptionFrequent APPARENT DEADLOCK messages appearing in the Confluence logs
ProductConfluence

Last modified on Sep 23, 2021

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.