Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
Models Implementation 1.5.2
-
None
-
None
Description
Under load the injection of OSGI references can block at the ServiceRegistry like this:
at jdk.internal.misc.Unsafe.park(java.base@11.0.15/Native Method) - parking to wait for <0x00000007e65f69e8> (a java.util.concurrent.CountDownLatch$Sync) at java.util.concurrent.locks.LockSupport.park(java.base@11.0.15/LockSupport.java:194) at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(java.base@11.0.15/AbstractQueuedSynchronizer.java:885) at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(java.base@11.0.15/AbstractQueuedSynchronizer.java:1039) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(java.base@11.0.15/AbstractQueuedSynchronizer.java:1345) at java.util.concurrent.CountDownLatch.await(java.base@11.0.15/CountDownLatch.java:232) at org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:380) at org.apache.felix.framework.Felix.getService(Felix.java:3984) at org.apache.felix.framework.Felix.getServiceReferences(Felix.java:3895) at org.apache.felix.framework.Felix.getAllowedServiceReferences(Felix.java:3947) at org.apache.felix.framework.BundleContextImpl.getServiceReferences(BundleContextImpl.java:414) at org.apache.sling.models.impl.injectors.OSGiServiceInjector.getService(OSGiServiceInjector.java:106) at org.apache.sling.models.impl.injectors.OSGiServiceInjector.getValue(OSGiServiceInjector.java:170) at org.apache.sling.models.impl.injectors.OSGiServiceInjector.getValue(OSGiServiceInjector.java:99) at org.apache.sling.models.impl.ModelAdapterFactory.injectElementInternal(ModelAdapterFactory.java:598) at org.apache.sling.models.impl.ModelAdapterFactory.injectElement(ModelAdapterFactory.java:532)
For this situation Sling Scripting uses a cache in the SlingScriptHelper, which prevents too frequent access to the registry. Such a method (and potentially even the same cache) should be used for the OsgiServiceInjector as well.
Attachments
Issue Links
- relates to
-
SLING-11029 OSGiServiceInjector.getService() should rely on framework
- Closed