java - C3P0 connection pool stall with Heroku Postgres -
this relates unsolved post: here c3p0 seems enter deadlock after initializing connection pool on heroku. problem not occur on local postgres.
here's connection configuration hibernate.hbm.xml
<property name="hibernate.dialect">org.hibernate.dialect.postgresqldialect</property> <!-- enable hibernate's automatic session context management --> <property name="current_session_context_class">thread</property> <property name="hibernate.connection.url">jdbc:postgresql://myurl:5432/mydb?user=myusername&password=myoassword&sslfactory=org.postgresql.ssl.nonvalidatingfactory&ssl=true</property> <property name="hibernate.connection.driver_class">org.postgresql.driver</property> <property name="hibernate.connection.username">myusername</property> <property name="hibernate.connection.password">mypassword</property> <property name="hibernate.archive.autodetection">class</property> <property name="hibernate.show_sql">true</property> <property name="hibernate.format_sql">true</property> <property name="hbm2ddl.auto">create</property> <!-- c3p0 connection pool settings --> <property name="hibernate.connection.provider_class">org.hibernate.service.jdbc.connections.internal.c3p0connectionprovider</property> <property name="hibernate.c3p0.min_size">1</property> <property name="hibernate.c3p0.max_size">2</property> <property name="hibernate.c3p0.timeout">1800</property>
here's log. note hang 1 minute 10 second cycles of "running deadlockdetector." note invocation exception follows:
[debug] "com.mchange.v2.c3p0.impl.c3p0pooledconnectionpoolmanager" 2015-07-05 07:12:57,851: created new pool auth, username (masked): 'sp******'.
[debug] "com.mchange.v2.resourcepool.basicresourcepool" 2015-07-05 07:12:57,851: acquire test -- pool size: 0; target_pool_size: 1; desired target? 1
...deleted lines sake of parsimony
[debug] "com.mchange.v2.resourcepool.basicresourcepool" 2015-07-05 07:12:59,132: acquisition series terminated successfully. decremented pending_acquires 1, attempts_remaining: 30
[debug] "com.mchange.v2.resourcepool.basicresourcepool" 2015-07-05 07:12:59,132: trace com.mchange.v2.resourcepool.basicresourcepool@6293abcc [managed: 2, unused: 1, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.newpooledconnection@576ddf03)
[debug] "com.mchange.v2.resourcepool.basicresourcepool" 2015-07-05 07:12:59,132: decremented pending_acquires: 0
[debug] "com.mchange.v2.resourcepool.basicresourcepool" 2015-07-05 07:12:59,132: acquisition series terminated successfully. decremented pending_acquires [0], attempts_remaining: 30
[debug] "com.mchange.v2.resourcepool.basicresourcepool" 2015-07-05 07:12:59,132: trace com.mchange.v2.resourcepool.basicresourcepool@6293abcc [managed: 2, unused: 1, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.newpooledconnection@576ddf03)
[debug] "com.mchange.v2.async.threadpoolasynchronousrunner" 2015-07-05 07:13:07,841: com.mchange.v2.async.threadpoolasynchronousrunner$deadlockdetector@45912fb9 -- running deadlockdetector[exiting. no pending tasks.]
...repeats every ten seconds
[debug] "com.mchange.v2.async.threadpoolasynchronousrunner" 2015-07-05 07:13:47,859: com.mchange.v2.async.threadpoolasynchronousrunner$deadlockdetector@45912fb9 -- running deadlockdetector[exiting. no pending tasks.]
[info] "org.hibernate.dialect.dialect" 2015-07-05 07:13:55,467: hhh000400: using dialect: org.hibernate.dialect.postgresqldialect
[info] "org.hibernate.engine.jdbc.internal.lobcreatorbuilder" 2015-07-05 07:13:55,472: hhh000424: disabling contextual lob creation createclob() method threw error : java.lang.reflect.invocationtargetexception
[debug] "com.mchange.v2.async.threadpoolasynchronousrunner" 2015-07-05 07:13:55,576: com.mchange.v2.async.threadpoolasynchronousrunner@6a01e23: adding task queue -- com.mchange.v2.resourcepool.basicresourcepool$1refurbishcheckinresourcetask@55b699ef
the answer is, in fact, posted , explained here:
i added following hibernate.hbm.xml
<property name="temp.use_jdbc_metadata_defaults">false</property>
Comments
Post a Comment