activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From belpel <angelbear...@gmail.com>
Subject Dead Lock Useing Jdbc database store in transaction mode?
Date Fri, 06 Dec 2013 14:43:43 GMT
I hava on topic with a lot of producers and 1 durable subscribe consumer. 
activemq conneted to mysql with c3p0 datasoure pool with the default
configuration.   The jdbcPersistenceAdapter  cleanupPeriod is 3000。 when all
producers commit message, sometimes activemq blocked, no message can send or
received,even all produces are shutdown. going into stack all produces
bocked:



and a clean thead blocked

Thread 18234: (state = BLOCKED)
 - java.lang.Object.wait(long) @bci=0 (Compiled frame; information may be
imprecise)
 - com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(long)
@bci=171, line=1315 (Compiled frame)
 -
com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(long)
@bci=231, line=557 (Compiled frame)
 - com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(long)
@bci=2, line=477 (Compiled frame)
 -
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection()
@bci=9, line=525 (Compiled frame)
 - com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection()
@bci=7, line=128 (Compiled frame)
 - org.apache.activemq.store.jdbc.TransactionContext.getConnection()
@bci=12, line=58 (Compiled frame)
 -
org.apache.activemq.store.jdbc.adapter.DefaultJDBCAdapter.doDeleteOldMessages(org.apache.activemq.store.jdbc.TransactionContext)
@bci=50, line=824 (Compiled frame)
 - org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.cleanup() @bci=22,
line=345 (Compiled frame)

</hraw>
Look into the souce code, I find
producer submit step : 
begin transaction(get a connection) -->  insert/delete every message  before
get a cleanupExclusiveLock read lock ---> release read lock --> commit --->
close connection;
cleanup task step :  get cleanupExclusiveLock write lock---> get a datasouce
connection ---> delete expired topic messages --> commit --> release write
lock;

Produces get all the connections of the pool and waiting for the clearup
task release write lock, while the clearup task got the write lock waiting
for a connection.  is it a dead lock? why the clear up thread get a
datasouce connection first?




--
View this message in context: http://activemq.2283324.n4.nabble.com/Dead-Lock-Useing-Jdbc-database-store-in-transaction-mode-tp4675247.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message