Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-101694

Fix SAPEntryScopeDescriptorFinderRegistrator thread safety

    Details

      Description

      register(long) and addJaxRsApplicationName(ServiceReference) could happen concurrently causing:

           [exec] java.lang.IllegalStateException: The service has been unregistered
           [exec] 	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.setProperties(ServiceRegistrationImpl.java:158)
           [exec] 	at com.liferay.oauth2.provider.jsonws.internal.service.access.policy.scope.SAPEntryScopeDescriptorFinderRegistrator.addJaxRsApplicationName(SAPEntryScopeDescriptorFinderRegistrator.java:155)
           [exec] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           [exec] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
           [exec] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           [exec] 	at java.lang.reflect.Method.invoke(Method.java:498)
           [exec] 	at org.apache.felix.scr.impl.inject.methods.BaseMethod.invokeMethod(BaseMethod.java:228)
           [exec] 	at org.apache.felix.scr.impl.inject.methods.BaseMethod.access$500(BaseMethod.java:41)
           [exec] 	at org.apache.felix.scr.impl.inject.methods.BaseMethod$Resolved.invoke(BaseMethod.java:664)
           [exec] 	at org.apache.felix.scr.impl.inject.methods.BaseMethod.invoke(BaseMethod.java:510)
           [exec] 	at org.apache.felix.scr.impl.inject.methods.BindMethod.invoke(BindMethod.java:42)
           [exec] 	at org.apache.felix.scr.impl.manager.DependencyManager.doInvokeBindMethod(DependencyManager.java:1813)
           [exec] 	at org.apache.felix.scr.impl.manager.DependencyManager.invokeBindMethod(DependencyManager.java:1788)
           [exec] 	at org.apache.felix.scr.impl.manager.SingleComponentManager.invokeBindMethod(SingleComponentManager.java:436)
           [exec] 	at org.apache.felix.scr.impl.manager.DependencyManager$MultipleDynamicCustomizer.addedService(DependencyManager.java:333)
           [exec] 	at org.apache.felix.scr.impl.manager.DependencyManager$MultipleDynamicCustomizer.addedService(DependencyManager.java:302)
           [exec] 	at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.java:1216)
           [exec] 	at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.java:1137)
           [exec] 	at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.trackAdding(ServiceTracker.java:944)
           [exec] 	at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.track(ServiceTracker.java:880)
           [exec] 	at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:1168)
           [exec] 	at org.apache.felix.scr.impl.BundleComponentActivator$ListenerInfo.serviceChanged(BundleComponentActivator.java:125)
           [exec] 	at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:109)
           [exec] 	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:891)
           [exec] 	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:804)
           [exec] 	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:127)
           [exec] 	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:228)
           [exec] 	at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:469)
           [exec] 	at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:487)
           [exec] 	at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:1004)
           [exec] 	at com.liferay.oauth2.provider.jsonws.internal.service.access.policy.scope.SAPEntryScopeDescriptorFinderRegistrator.lambda$register$1(SAPEntryScopeDescriptorFinderRegistrator.java:99)
           [exec] 	at java.util.concurrent.ConcurrentHashMap.compute(ConcurrentHashMap.java:1877)
           [exec] 	at com.liferay.oauth2.provider.jsonws.internal.service.access.policy.scope.SAPEntryScopeDescriptorFinderRegistrator.register(SAPEntryScopeDescriptorFinderRegistrator.java:92)
           [exec] 	at com.liferay.oauth2.provider.jsonws.internal.service.access.policy.model.listener.SAPEntryModelListener.onAfterCreate(SAPEntryModelListener.java:34)
           [exec] 	at com.liferay.oauth2.provider.jsonws.internal.service.access.policy.model.listener.SAPEntryModelListener.onAfterCreate(SAPEntryModelListener.java:29)
           [exec] 	at com.liferay.portal.kernel.service.persistence.impl.BasePersistenceImpl.update(BasePersistenceImpl.java:548)
           [exec] 	at com.liferay.portal.kernel.service.persistence.impl.BasePersistenceImpl.update(BasePersistenceImpl.java:563)
           [exec] 	at com.liferay.portal.security.service.access.policy.service.impl.SAPEntryLocalServiceImpl.addSAPEntry(SAPEntryLocalServiceImpl.java:97)
           [exec] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           [exec] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
           [exec] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           [exec] 	at java.lang.reflect.Method.invoke(Method.java:498)
           [exec] 	at com.liferay.portal.spring.aop.AopMethodInvocationImpl.proceed(AopMethodInvocationImpl.java:50)
           [exec] 	at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:69)
           [exec] 	at com.liferay.portal.spring.aop.AopMethodInvocationImpl.proceed(AopMethodInvocationImpl.java:57)
           [exec] 	at com.liferay.portal.service.ServiceContextAdvice.invoke(ServiceContextAdvice.java:60)
           [exec] 	at com.liferay.portal.spring.aop.AopMethodInvocationImpl.proceed(AopMethodInvocationImpl.java:57)
           [exec] 	at com.liferay.portal.spring.aop.AopInvocationHandler.invoke(AopInvocationHandler.java:49)
           [exec] 	at com.sun.proxy.$Proxy1061.addSAPEntry(Unknown Source)
           [exec] 	at com.liferay.sync.security.service.access.policy.SyncSAPEntryActivator.addSAPEntry(SyncSAPEntryActivator.java:82)
           [exec] 	at com.liferay.sync.security.service.access.policy.SyncSAPEntryActivator$PolicyPortalInstanceLifecycleListener.portalInstanceRegistered(SyncSAPEntryActivator.java:113)
           [exec] 	at com.liferay.portal.instance.lifecycle.internal.PortalInstanceLifecycleListenerManagerImpl.registerCompany(PortalInstanceLifecycleListenerManagerImpl.java:171)
           [exec] 	at com.liferay.portal.instance.lifecycle.internal.PortalInstanceLifecycleListenerManagerImpl.addPortalInstanceLifecycleListener(PortalInstanceLifecycleListenerManagerImpl.java:103)
      

        Attachments

          Activity

            People

            • Assignee:
              brian.lee Brian Lee
              Reporter:
              shuyang.zhou Shuyang Zhou
              Participants of an Issue:
              Recent user:
              Enterprise Release HU
              Engineering Assignee:
              Shuyang Zhou
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                3 weeks, 3 days ago

                Packages

                Version Package
                7.2.X
                Master