Unsafe synchronization in GenericStatement
------------------------------------------

                 Key: DERBY-4724
                 URL: https://issues.apache.org/jira/browse/DERBY-4724
             Project: Derby
          Issue Type: Bug
          Components: SQL
    Affects Versions: 10.5.1.1
            Reporter: Wendy Feng
            Priority: Minor


GenericStatement has some statements in method prepMinion()  like this:

       if (preparedStmt == null) 
                {
                        if (cacheMe)
                                preparedStmt = 
(GenericPreparedStatement)((GenericLanguageConnectionContext)lcc).lookupStatement(this);

                        if (preparedStmt == null) 
                        {
                                preparedStmt = new 
GenericPreparedStatement(this);
                        }
                        else
                        {
                                foundInCache = true;
                        }
                }


                synchronized (preparedStmt) 
                {
                     ...
               }


It is not safe to assgine a new object to preparedStmt before synchronizing on. 
it may results sycnchronize on two different object if the method is called 
concurrently when preparedStmt =null.


-- 
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