Issue Details (XML | Word | Printable)

Key: DERBY-2689
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Critical Critical
Assignee: Manish Khettry
Reporter: Marc Ewert
Votes: 1
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Derby

Deadlock with GenericPreparedStatement

Created: 24/May/07 01:11 PM   Updated: 04/Jul/07 11:08 AM
Return to search
Component/s: JDBC
Affects Version/s: 10.2.2.0
Fix Version/s: 10.3.1.4, 10.4.1.3

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works deadlock.patch.txt 2007-06-25 07:57 PM Manish Khettry 3 kB
Text File Licensed for inclusion in ASF works deadlock2.patch.txt 2007-07-02 03:24 AM Manish Khettry 3 kB
Text File Licensed for inclusion in ASF works deadlock3.patch.txt 2007-07-03 05:45 PM Manish Khettry 3 kB
Java Source File TestDerbyPreparedStatements.java 2007-06-06 02:23 AM Jim Newsham 2 kB
Environment: Windows
Issue Links:
Reference
 

Resolution Date: 04/Jul/07 11:08 AM


 Description  « Hide
We encountered two times a deadlock inside of derby. It seems that we can't workaround it. The involved two threads are attached, it looks like a classical deadlock:

"Thread-22" daemon prio=6 tid=0x0cdaa400 nid=0x1c0 waiting for monitor entry [0x1317f000..0x1317fd4c]
   java.lang.Thread.State: BLOCKED (on object monitor)
at org.apache.derby.impl.sql.GenericPreparedStatement.finish(Unknown Source)
- waiting to lock <0x052f4d70> (a org.apache.derby.impl.sql.GenericPreparedStatement)
at org.apache.derby.impl.sql.execute.BaseActivation.close(Unknown Source)
at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.addActivation(Unknown Source)
at org.apache.derby.impl.sql.execute.BaseActivation.initFromContext(Unknown Source)
at org.apache.derby.impl.services.reflect.LoadedGeneratedClass.newInstance(Unknown Source)
at org.apache.derby.impl.services.reflect.ReflectGeneratedClass.newInstance(Unknown Source)
at org.apache.derby.impl.sql.GenericActivationHolder.<init>(Unknown Source)
at org.apache.derby.impl.sql.GenericPreparedStatement.getActivation(Unknown Source)
- locked <0x05306f88> (a org.apache.derby.impl.sql.GenericPreparedStatement)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.<init>(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement20.<init>(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement30.<init>(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement40.<init>(Unknown Source)
at org.apache.derby.jdbc.Driver40.newEmbedPreparedStatement(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)
- locked <0x047beb00> (a org.apache.derby.impl.jdbc.EmbedConnection40)
at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)
        [custom methods]

"ThreadPoolThread-SyncScheduler-3-1" prio=2 tid=0x0e620400 nid=0xfec waiting for monitor entry [0x10a7e000..0x10a7fa14]
   java.lang.Thread.State: BLOCKED (on object monitor)
at org.apache.derby.impl.sql.GenericPreparedStatement.finish(Unknown Source)
- waiting to lock <0x05306f88> (a org.apache.derby.impl.sql.GenericPreparedStatement)
at org.apache.derby.impl.sql.execute.BaseActivation.close(Unknown Source)
at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.addActivation(Unknown Source)
at org.apache.derby.impl.sql.execute.BaseActivation.initFromContext(Unknown Source)
at org.apache.derby.impl.services.reflect.LoadedGeneratedClass.newInstance(Unknown Source)
at org.apache.derby.impl.services.reflect.ReflectGeneratedClass.newInstance(Unknown Source)
at org.apache.derby.impl.sql.GenericActivationHolder.<init>(Unknown Source)
at org.apache.derby.impl.sql.GenericPreparedStatement.getActivation(Unknown Source)
- locked <0x052f4d70> (a org.apache.derby.impl.sql.GenericPreparedStatement)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.<init>(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement20.<init>(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement30.<init>(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement40.<init>(Unknown Source)
at org.apache.derby.jdbc.Driver40.newEmbedPreparedStatement(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)
- locked <0x04225178> (a org.apache.derby.impl.jdbc.EmbedConnection40)
at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)
        [custom methods]

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Repository Revision Date User Message
ASF #553101 Wed Jul 04 06:54:28 UTC 2007 kahatlen DERBY-2689: Deadlock with GenericPreparedStatement

Move logic that closes unused activations out of region synchronized
on the GenericPreparedStatement.

Contributed by Manish Khettry.
Files Changed
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/conn/LanguageConnectionContext.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericPreparedStatement.java

Repository Revision Date User Message
ASF #553171 Wed Jul 04 11:07:55 UTC 2007 kahatlen DERBY-2689: Deadlock with GenericPreparedStatement

Merged fix from trunk (revision 553101).
Files Changed
MODIFY /db/derby/code/branches/10.3/java/engine/org/apache/derby/iapi/sql/conn/LanguageConnectionContext.java
MODIFY /db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java
MODIFY /db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/sql/GenericPreparedStatement.java