[geotk] [JIRA] Created: (GEOTK-113) Race conditions in coverage-sql Database

Martin Desruisseaux (JIRA) jira at geomatys.com
Sat Aug 7 17:02:35 EDT 2010


Race conditions in coverage-sql Database
----------------------------------------

                 Key: GEOTK-113
                 URL: http://jira.geotoolkit.org/browse/GEOTK-113
             Project: Geotoolkit
          Issue Type: Bug
          Components: Coverage
    Affects Versions: 3.14
            Reporter: Martin Desruisseaux
            Assignee: Martin Desruisseaux
            Priority: Minor


When invoking {{synchronized(getLock())}} in a {{Table}} class, it is possible that the {{Database.Session.monitorExit(...)}} method is invoked in a background thread during the slight time window between the return of {{Table.getLock()}} and the synchronized statement, resulting in the {{Database.Session}} be declared as available for an other thread (its {{threadID}} field is set to null), or disposed.

Consequently, there is a possibility that the same {{Database.Session}} instance is used by two different threads. The program will nevertheless have correct computational behavior thanks to the {{synchronized}} statements, but we would have more thread contention.

A fix could be to replace the usage of {{synchronized}} statements by {{java.util.concurrent.Lock}}, which would allow us to acquire the lock right in the {{Database.getLocalCache()}} method.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.geotoolkit.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       


More information about the Geotoolkit mailing list