You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Joerg Hoh (Jira)" <ji...@apache.org> on 2022/10/05 17:11:00 UTC

[jira] [Updated] (SLING-11612) OSGIserviceInjector.getService() blocks under load

     [ https://issues.apache.org/jira/browse/SLING-11612?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Joerg Hoh updated SLING-11612:
------------------------------
    Description: 
Under load the injection of OSGI references can block at the ServiceRegistry like this:

{noformat}
        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)
{noformat}

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.




  was:

Under load the injection of OSGI references can block as the ServiceRegistry like this:

{noformat}
        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)
{noformat}

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.





> OSGIserviceInjector.getService() blocks under load
> --------------------------------------------------
>
>                 Key: SLING-11612
>                 URL: https://issues.apache.org/jira/browse/SLING-11612
>             Project: Sling
>          Issue Type: Improvement
>          Components: Sling Models
>    Affects Versions: Models Implementation 1.5.2
>            Reporter: Joerg Hoh
>            Priority: Major
>
> Under load the injection of OSGI references can block at the ServiceRegistry like this:
> {noformat}
>         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)
> {noformat}
> 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.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)