Hello all,

I gathered some thread dumps while observing some poor performance issues. 
I'm using H2 DB - 

 <groupId>com.h2database</groupId><artifactId>h2</artifactId><version>
*1.3.174*</version>
Nothing special is on the connection string, 
<prop key="XCL_Message_Database_Driver">org.h2.Driver</prop>
<prop 
key="XCL_Message_Database_URL">jdbc:h2:file:/var/log/TEST/messages_store</prop>

the application uses a lot of threading to dequeue messages and stuff them 
into a very simple table. Im getting BLOCKED threads when using 
executeUpdate  

"DefaultMessageListenerContainer-4" prio=10 tid=0x00000000599cb800 
nid=0x3d0c waiting for monitor entry [0x00002b232080b000]
   java.lang.Thread.State: BLOCKED (on object monitor)
at org.h2.command.Command.executeUpdate(Command.java:246)
- waiting to lock <0x0000000680a946b0> (a org.h2.engine.Database)
at 
org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:154)
- locked <0x0000000680b2fd98> (a org.h2.engine.Session)
at 
org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:140)
at 
org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
at 
org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
at 
org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:817)
at 
org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:1)

"taskscheduler-1" prio=10 tid=0x00002b2318391000 nid=0x3b77 waiting for 
monitor entry [0x00002b231e4e8000]
   java.lang.Thread.State: BLOCKED (on object monitor)
at org.h2.command.Command.executeUpdate(Command.java:246)
- waiting to lock <0x0000000680a946b0> (a org.h2.engine.Database)
at 
org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:154)
- locked <0x0000000680a945c8> (a org.h2.engine.Session)
at 
org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:140)
at 
org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
at 
org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)

--------------------------------------------------------------

Im finding it occurs in a place in the code with higher frequency, maybe 
because I have three DELETE statements in a row - It also BLOCKs on some 
UPDATEs in other sections of code:

int r1 = jdbc.update("DELETE FROM Incoming WHERE Processed=True"); 
int r2 = jdbc.update("DELETE FROM Incoming WHERE TimeExpires<=?", new 
Object[] { now() }); 
int r3 = jdbc.update("DELETE FROM Incoming WHERE retryCount>=?", new 
Object[] { getMaxErrorCountPerMessage() });


-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to