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