Skip to content
Advertisement

Understanding “APPARENT DEADLOCK!!! Complete Status” details

I have posted a small part of a log below from which I would really appreciate if someone can decode the following:

  • List item
  • Managed Threads
  • Active Threads
  • Active Tasks
  • Pending Tasks
  • Pool thread stack traces

I have the following C3PO configuration:

JavaScript

This is the Log:

JavaScript

Some information on the apparent deadlock would be appreciated.

Advertisement

Answer

The thread pool contains 3 threads. (“Managed Threads”). All 3 of them are “active”, trying to complete a task. (“Active Threads”), there are no dormant threads ready to take on work. The tasks are listed. They are all cached-statement close tasks.

An APPARENT DEADLOCK is triggered when all tasks in thread pool have remained the same for a long period of time. c3p0 (the thread pool library beneath it really) eventually assumes, if no task has managed to complete in the pool, that the pool is deadlocked. The library interrupt()s and then discards those Threads, and replaces them with new ones so that other tasks (you have a long task backlog, “Pending Tasks”) can try to run.

In your case, the issue is a well-known one. Some JDBC drivers’ Statement.close() operation may deadlock if their parent Connection is in use. For these (formally out-of-spec) drivers, c3p0 implements a cautious Statement close strategy, in which Statement destruction is tasked asynchronously and only performed when the parent Connection is known not to be in use.

TL; DR: set statementCacheNumDeferredCloseThreads to one.

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement