[geotk] [JIRA] Created: (GEOTK-72) Deadlock vulnerability between
ThreadedEpsgFactory and FactoryFinder
Martin Desruisseaux (JIRA)
jira at geomatys.com
Wed Dec 9 13:00:05 EST 2009
Deadlock vulnerability between ThreadedEpsgFactory and FactoryFinder
--------------------------------------------------------------------
Key: GEOTK-72
URL: http://jira.geotoolkit.org/browse/GEOTK-72
Project: Geotoolkit
Issue Type: Bug
Components: Referencing
Affects Versions: 3.06, 3.05, 3.04, 3.03, 3.02, 3.01, 3.00
Reporter: Martin Desruisseaux
Assignee: Martin Desruisseaux
Fix For: 3.07
When {{FactoryFinder.getCRSAuthorityFactory(...)}} is invoked extensively in a multi-thread environment, there is sometime a deadlock:
* {{AuthorityFactoryFinder.getCRSAuthorityFactory(...)}} holds a lock on {{AuthorityFactoryFinder.class}}
* {{ThreadedAuthorityFactory.availability()}} holds a lock on {{this}}
* Both of the above methods wait for the lock of the other one (indirectly, the call stack is somewhat deep).
The easy fix is to remove the {{synchronized}} statement on {{ThreadedAuthorityFactory.availability()}}, which was not strictly necessary since the method implementation was already thread-safe (provided that the {{status}} field is made volatile). The cost is that the same work may be done twice, but I don't think it will happen often in practice.
However we should take the opportunity for reducing a bit more the amount of locks, especially in {{createBackingStore()}}, because the later invoke client code that we may not control. Even in the case of Geotk implementation, the call stack is deep with recursive calls to {{FactoryFinder}}. We are safer to arrange the code in such a way that {{createBackingStore()}} is invoked outside any synchronized block.
--
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