C3p0 error apparent deadlock !!! Solution

Source: Internet
Author: User

Many errors occurred when using c3p0. The longest possible cause is deadlock, which occupies a large amount of resources.

Http://japi.javaeye.com/blog/243702 for deadlock issues.
Found the solution (not completely guaranteed, but there is no problem in the load test)

The key issue is parameter settings.
Reference

<! -- JDBC standard parameter, used to control the number of preparedstatements loaded in the data source. However, due to the pre-Cache statements
Belongs to a single connection pool rather than the entire connection pool. Therefore, you need to consider many factors when setting this parameter.
If both maxstatements and maxstatementsperconnection are 0, the cache is disabled. Default: 0 -->
<Property name = "maxstatements"> 100 </property>

<! -- Maxstatementsperconnection defines the maximum number of statements cached for a single connection in the connection pool. Default: 0 -->
<Property name = "maxstatementsperconnection"> </property>

The solution is:
Reference
In hibernate. cfg. xml:
<Property name = "hibernate. c3p0. max_statements"> 0 </property>

In c3p0. properties:
C3p0. maxstatements = 0
C3p0. maxstatementsperconnection = 100

From: http://forum.hibernate.org/viewtopic.php? P = 2386237

Http://forum.hibernate.org/viewtopic.php? T = 947246 & START = 0 & postdays = 0 & postorder = ASC & Highlight = apparent + deadlock + c3p0 & SID = 6fcfab70cff3588bf01_14df8dbbb90

Http://www.mchange.com/projects/c3p0/index.html#c3p0_properties

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.