Troubleshooting deadlocks in Confluence

Still need help?

The Atlassian Community is here for you.

Ask the community

Problem

Some period after launch, Confluence hangs or runs slowly. An error message appears in the logs like:

2009-04-07 05:38:57,333 WARN [Timer-0] [mchange.v2.async.ThreadPoolAsynchronousRunner] run com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@26b07663 -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!

Diagnosis

This can be hard to diagnose because the message does not necessarily mean there is a deadlock. The code will output an apparent deadlock message when it attempts to grab a new database connection and there is none available. 
This could be for a variety of reasons (listed below). Take three thread dumps to see the behavior of Confluence when Confluence begins performing poorly.
If you are experiencing an actual deadlock, more than likely your database will report it in its logs. If there are no reports of deadlocks in your database logs, then it is likely to be 1, 2 or 3 of the causes below. If there is, it can be 4 or 5 below. 

Make sure you've got a supported database with a current driver.

Causes and Resolutions

Deadlocks can result from a variety of different causes:

  1. Database connection pool has too few connections. See Confluence slows and times out during periods of high load due to database connection pool
  2. Confluence crashes due to 'OutOfMemoryError Java heap space' error is occurring. Check that page for diagnosis and resolutions.
  3. A script or Remote API process is hammering the server. Disable any Remote API scripts or disable the Remote API from Administration >> General Information.
  4. The database is not optimized.
  5. If you are using MS SQL Server, check if you are affected by this known deadlock problem.
  6. Adding pages concurrently can result in deadlocks. See CONFSERVER-14789.
Last modified on Jun 7, 2019

Was this helpful?

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