Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-14801

ServiceProxyDestroyedException in TaskConfigurator and RuntimeTaskDataProvider after OSGi plugin disable/enable cycle

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Medium Medium
    • 5.6.1
    • 5.0, 5.5.1
    • None
    • None

      This occurs in context of Bamboo Plugins implementing Bamboo Task Plugin Modules.

      When a task's TaskConfigurator or RuntimeTaskDataProvider implementation uses an injected dependency object, accessing any method on that object after a plugin disable/enable cycle will trigger a ServiceProxyDestroyedException:

      [INFO] [talledLocalContainer] 2014-07-17 16:54:57,418 ERROR [http-6990-5] [ExceptionMappingInterceptor] service proxy has been destroyed
      [INFO] [talledLocalContainer] org.springframework.osgi.service.importer.ServiceProxyDestroyedException: service proxy has been destroyed
      [INFO] [talledLocalContainer] 	at org.springframework.osgi.service.importer.support.internal.aop.ServiceDynamicInterceptor$ServiceLookUpCallback.doWithRetry(ServiceDynamicInterceptor.java:105)
      [INFO] [talledLocalContainer] 	at org.springframework.osgi.service.importer.support.internal.support.RetryTemplate.execute(RetryTemplate.java:83)
      [INFO] [talledLocalContainer] 	at org.springframework.osgi.service.importer.support.internal.aop.ServiceDynamicInterceptor.lookupService(ServiceDynamicInterceptor.java:430)
      [INFO] [talledLocalContainer] 	at org.springframework.osgi.service.importer.support.internal.aop.ServiceDynamicInterceptor.getTarget(ServiceDynamicInterceptor.java:415)
      [INFO] [talledLocalContainer] 	at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:62)
      [INFO] [talledLocalContainer] 	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      [INFO] [talledLocalContainer] 	at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
      [INFO] [talledLocalContainer] 	at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
      [INFO] [talledLocalContainer] 	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      [INFO] [talledLocalContainer] 	at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:56)
      [INFO] [talledLocalContainer] 	at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:39)
      [INFO] [talledLocalContainer] 	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      [INFO] [talledLocalContainer] 	at org.springframework.osgi.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:59)
      [INFO] [talledLocalContainer] 	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      [INFO] [talledLocalContainer] 	at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
      [INFO] [talledLocalContainer] 	at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
      [INFO] [talledLocalContainer] 	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      [INFO] [talledLocalContainer] 	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      [INFO] [talledLocalContainer] 	at com.sun.proxy.$Proxy960.getBaseUrl(Unknown Source)
      [INFO] [talledLocalContainer] 	at net.utoolity.atlassian.bamboo.task.ConfigUITaskConfigurator.populateContextForCreate(ConfigUITaskConfigurator.java:44)
      [INFO] [talledLocalContainer] 	at com.atlassian.bamboo.ww2.actions.build.admin.config.task.TaskUIConfigBean.prepareCreateHtml(TaskUIConfigBean.java:109)
      [INFO] [talledLocalContainer] 	at com.atlassian.bamboo.ww2.actions.build.admin.config.task.CreateTask.input(CreateTask.java:55)
      […]
      

      (full stacktrace attached as ServiceProxyDestroyedException.stacktrace.txt)

      The exception is only triggered if the TaskConfigurator or RuntimeTaskDataProvider has been invoked at least once before the disable/enable cycle, hinting on them being instantiated on first use, and not getting updated when the underlying Spring/OSGi context is refreshed.

      Reinstalling the plugin fixes the issue (until the next disable/enable cycle).

      The problem exists for a single plugin already, but gets worse in a bundled plugin scenario, where updating a dependency plugin triggers a 'background' disable/enable cycle of the dependent plugin, and thus the SPDE problem.

      Impact: In the TaskConfigurator scenario, this 'only' prevents the user from creating/configuring tasks all of a sudden, however, for the RuntimeTaskDataProvider scenario, the impact is a failure of all builds using the affected plugin's tasks!

      To ease analysis and allow testing of potential workarounds, we have created a small reproduction demo plugin. (basic reproduction instructions can be found in the project readme file).

              Unassigned Unassigned
              847fe7f23dab Henrik Opel [Utoolity]
              Votes:
              3 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: