Felix Meschberger created SLING-2558:
----------------------------------------
Summary: Potential Deadlocks may be caused by AdapterManager
Key: SLING-2558
URL: https://issues.apache.org/jira/browse/SLING-2558
Project: Sling
Issue Type: Improvement
Components: Extensions
Affects Versions: Adapter 2.0.16
Reporter: Felix Meschberger
Fix For: Adapter 2.0.18
The AdapterManager uses a cascade of three synchronized blocks when the
AdapterFactoryDescriptor.getFactory() method is called:
* synchronized(cache)
* synchronized(factories)
* synchronized(this)
A potential deadlock may happen because the
AdapterFactoryDescriptor.getFactory() method asks the Declarative Services
runtime for a service, which may cause a ServiceFactory service to be
instantiated (with a whole cascade of potential secondary actions depending on
what happens on this instantiation).
The last block can probably simply be removed while the others definitely have
to be refactored to not be the cause or participants in deadlock situations.
The reason for this is, that (a) synchronized blocks must not be too large and
(b) no Java locks should be held when calling into the OSGi Framework, which
happens in the AdapterFactoryDescriptor.getFactory method.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira