db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wendy Feng (JIRA)" <j...@apache.org>
Subject [jira] Created: (DERBY-4724) Unsafe synchronization in GenericStatement
Date Tue, 29 Jun 2010 09:46:49 GMT
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.


Mime
View raw message