Home  >  Article  >  Database  >  How to solve the deadlock caused by c3p0

How to solve the deadlock caused by c3p0

一个新手
一个新手Original
2017-09-08 10:54:092056browse

The code was tested locally and was correct, so I put it on the external server for testing, and an error like this occurred.

com.mchange.v2.async.ThreadPoolAsynchronousRunner -466510
78 [Timer-18] WARN  com.mchange.v2.async.ThreadPoolAsynchronousRunner  - com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@1c17bd4 -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!

I was confused when I saw this, what should I do? Why did this happen? Condition?

My answer is:

Because the number of connections to the database is It is limited. Every time the application starts C3p0, it will occupy the database connection to fill the C3p0 connection pool. When the database resources are occupied, a deadlock will be reported because the shared resources cannot be obtained.

Change the maximum number of connections and the number of initial connections in the corresponding configuration file:

Before modification:

  

After modification:

  

Redeploy and run, ok!

The above is the detailed content of How to solve the deadlock caused by c3p0. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:AIO analysis in OracleNext article:AIO analysis in Oracle