[ 
https://issues.apache.org/jira/browse/DERBY-2689?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12508180
 ] 

Knut Anders Hatlen commented on DERBY-2689:
-------------------------------------------

Hi Manish,

Thank you for working on this issue. I looked at the patch and I have a couple 
of questions/comments:

1) Since GenericLanguageConnectionContext.acts now is an unsynchronized 
ArrayList and not a Vector, is it safe to access/modify it outside the 
synchronized block?

2) I noticed that you moved "unusedActs = false;" below the loop. I believe 
that the assignment was placed above the loop deliberately (see Dan's comment 
25/Aug/06 on DERBY-418).

3) There are some lines >80 characters.

4) Most of the changes in GenericLanguageConnectionContext are pure whitespace 
changes (adding or removal of trailing blanks). Also, some extra garbage has 
ended up in the comments, like "// size exceeds 20.SelectNod3" and "(...) true 
*if*z *all* (...)"

5) *Tiny* nit: In GenericPreparedStatement.getActivation(), ac is initialized 
to null. Since this initial value is not intended to be used, I think it is 
better to leave the variable uninitialized. The compiler will complain if one 
tries to use an uninitialized variable, so by setting it to null we actually 
remove some compile-time error checking.

> Deadlock with GenericPreparedStatement
> --------------------------------------
>
>                 Key: DERBY-2689
>                 URL: https://issues.apache.org/jira/browse/DERBY-2689
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.2.2.0
>         Environment: Windows
>            Reporter: Marc Ewert
>            Assignee: Manish Khettry
>            Priority: Critical
>         Attachments: deadlock.patch.txt, TestDerbyPreparedStatements.java
>
>
> 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]

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to