-
Bug
-
Resolution: Fixed
-
High
-
8.0.0, 8.1.0, 8.2.0, 8.3.0, 8.3.3
-
8
-
3
-
Severity 2 - Major
-
1
-
JiraEventExecutorFactory does not provide Jira Thread Local context
JiraEventExecutorFactory which is the Jira implementation of com.atlassian.event.spi.EventExecutorFactory which provides a factory to create executors for asynchronous event handling is not providing Jira context to threads run in this executor.
BB
Steps to Reproduce
- Setup a trigger in Jira to transition an issue upon merge or pull request
- Setup a post-function to trigger a webhook
- Perform a merge or pull request in BB
Expected Results
Issue transitioned on BB merge without exceptions.
Actual Results
The below exception is thrown in the atlassian-jira.log file:
2019-07-18 11:38:15,837 JIRA-EventThread-34434 ERROR anonymous 463x3003784x1 148yev1 172.20.61.224,172.16.32.32 /rest/remote-event-consumer/latest/events/JiraPullRequestEvent [c.a.event.internal.AsynchronousAbleEventDispatcher] There was an exception thrown trying to dispatch event [com.atlassian.jira.event.issue.IssueEvent@7ea21833[issue=XXXXXX-2248,comment=<null>,worklog=<null>,changelog=[GenericEntity:ChangeGroup][issue,121170][author,d0055607][created,2019-07-18 11:38:15.822][id,1620705],eventTypeId=11,sendMail=true,params={eventsource=workflow, baseurl=https://jira_base_url},subtasksUpdated=false,spanningOperation=Optional.empty]] from the invoker [SingleParameterMethodListenerInvoker{method=public void com.atlassian.webhooks.plugin.WebHookEventsProcessor.onEvent(java.lang.Object), listener=com.atlassian.webhooks.plugin.WebHookEventsProcessor@1000774}] java.lang.RuntimeException: Incorrect usage of JIRA/lucene search API. You can only create/use: ManagedIndexSearcher inside a context (request or Jira-Thread-Local). Check: JiraThreadLocalUtils for details.. Listener: com.atlassian.webhooks.plugin.WebHookEventsProcessor event: com.atlassian.jira.event.issue.IssueEvent at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:55) at com.atlassian.event.internal.AsynchronousAbleEventDispatcher.lambda$null$0(AsynchronousAbleEventDispatcher.java:37) at com.atlassian.event.internal.AsynchronousAbleEventDispatcher.dispatch(AsynchronousAbleEventDispatcher.java:85) at com.atlassian.event.internal.EventPublisherImpl.invokeListeners(EventPublisherImpl.java:200) at com.atlassian.event.internal.EventPublisherImpl.publish(EventPublisherImpl.java:115) at com.atlassian.jira.event.issue.DefaultIssueEventManager.publishEventIfNotificationsAreEnabled(DefaultIssueEventManager.java:180) at com.atlassian.jira.event.issue.DefaultIssueEventManager.publishEvent(DefaultIssueEventManager.java:162) at com.atlassian.jira.event.issue.DefaultIssueEventManager.publishAsRedundant(DefaultIssueEventManager.java:204) at com.atlassian.jira.event.issue.DefaultIssueEventManager.dispatchRedundantEvent(DefaultIssueEventManager.java:101) at com.atlassian.jira.workflow.function.event.FireIssueEventFunction.execute(FireIssueEventFunction.java:62) at com.opensymphony.workflow.AbstractWorkflow.executeFunction(AbstractWorkflow.java:1014) at com.opensymphony.workflow.AbstractWorkflow.transitionWorkflow(AbstractWorkflow.java:1407) at com.opensymphony.workflow.AbstractWorkflow.doAction(AbstractWorkflow.java:557) at com.atlassian.jira.workflow.OSWorkflowManager.doWorkflowActionInsideTxn(OSWorkflowManager.java:830) at com.atlassian.jira.workflow.OSWorkflowManager.doWorkflowAction(OSWorkflowManager.java:787) at com.atlassian.jira.bc.issue.DefaultIssueService.transition(DefaultIssueService.java:510) ... 2 filtered at java.lang.reflect.Method.invoke(Method.java:498) at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26) at com.sun.proxy.$Proxy521.transition(Unknown Source) ... 2 filtered at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343) at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:56) at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:60) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:136) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:70) at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:53) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) at org.eclipse.gemini.blueprint.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:57) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:136) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212) at com.sun.proxy.$Proxy1195.transition(Unknown Source) at com.atlassian.jira.plugin.triggers.impl.transition.WorkflowTriggerTransitionProcessor.performTransition(WorkflowTriggerTransitionProcessor.java:313) at com.atlassian.jira.plugin.triggers.impl.transition.WorkflowTriggerTransitionProcessor.maybeTransition(WorkflowTriggerTransitionProcessor.java:225) at com.atlassian.jira.plugin.triggers.impl.transition.WorkflowTriggerTransitionProcessor.retryTransitions(WorkflowTriggerTransitionProcessor.java:172) at com.atlassian.jira.plugin.triggers.impl.transition.WorkflowTriggerTransitionProcessor.onWorkflowEvent(WorkflowTriggerTransitionProcessor.java:139) ... 2 filtered at java.lang.reflect.Method.invoke(Method.java:498) at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:40) at com.atlassian.event.internal.AsynchronousAbleEventDispatcher.lambda$null$0(AsynchronousAbleEventDispatcher.java:37) at com.atlassian.event.internal.AsynchronousAbleEventDispatcher.dispatch(AsynchronousAbleEventDispatcher.java:85) at com.atlassian.event.internal.EventPublisherImpl.invokeListeners(EventPublisherImpl.java:200) at com.atlassian.event.internal.EventPublisherImpl.publish(EventPublisherImpl.java:115) ... 2 filtered at java.lang.reflect.Method.invoke(Method.java:498) at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26) at com.sun.proxy.$Proxy378.publish(Unknown Source) ... 2 filtered at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343) at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:56) at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:60) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:136) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:70) at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:53) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) at org.eclipse.gemini.blueprint.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:57) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:136) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212) at com.sun.proxy.$Proxy3077.publish(Unknown Source) at com.atlassian.jira.plugin.devstatus.triggers.DevtoolsWorkflowEventBridge.onBranch(DevtoolsWorkflowEventBridge.java:108) ... 2 filtered at java.lang.reflect.Method.invoke(Method.java:498) at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:40) at com.atlassian.event.internal.AsynchronousAbleEventDispatcher.lambda$null$0(AsynchronousAbleEventDispatcher.java:37) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.IllegalStateException: Incorrect usage of JIRA/lucene search API. You can only create/use: ManagedIndexSearcher inside a context (request or Jira-Thread-Local). Check: JiraThreadLocalUtils for details. at com.atlassian.jira.index.ManagedIndexSearcherFactory.createFrom(ManagedIndexSearcherFactory.java:15) at com.atlassian.jira.issue.index.ThreadLocalSearcherCache$Cache.retrieveEntitySearcher(ThreadLocalSearcherCache.java:116) at com.atlassian.jira.issue.index.ThreadLocalSearcherCache.getSearcher(ThreadLocalSearcherCache.java:39) at com.atlassian.jira.issue.index.DefaultIndexManager.getEntitySearcher(DefaultIndexManager.java:888) at com.atlassian.jira.issue.index.DefaultIndexManager.getIssueSearcher(DefaultIndexManager.java:865) ... 1 filtered at java.lang.reflect.Method.invoke(Method.java:498) at com.atlassian.jira.config.component.SwitchingInvocationHandler.invoke(SwitchingInvocationHandler.java:38) at com.sun.proxy.$Proxy25.getIssueSearcher(Unknown Source) at com.atlassian.jira.issue.search.SearchProviderFactoryImpl.getSearcher(SearchProviderFactoryImpl.java:17) at com.atlassian.jira.issue.search.providers.LuceneSearchProvider.getIssueSearcher(LuceneSearchProvider.java:130) at com.atlassian.jira.issue.search.providers.LuceneSearchProvider.getHitCount(LuceneSearchProvider.java:145) at com.atlassian.jira.bc.issue.search.DefaultSearchService.searchCountOverrideSecurity(DefaultSearchService.java:135) ... 2 filtered at java.lang.reflect.Method.invoke(Method.java:498) at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26) at com.sun.proxy.$Proxy207.searchCountOverrideSecurity(Unknown Source) ... 2 filtered at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343) at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:56) at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:60) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:136) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:70) at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:53) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) at org.eclipse.gemini.blueprint.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:57) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:136) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212) at com.sun.proxy.$Proxy3437.searchCountOverrideSecurity(Unknown Source) at com.atlassian.jira.plugins.webhooks.matcher.JqlEventMatcher.matchJql(JqlEventMatcher.java:58) at com.atlassian.jira.plugins.webhooks.matcher.JqlEventMatcher.matches(JqlEventMatcher.java:43) at com.atlassian.jira.plugins.webhooks.matcher.JqlEventMatcher.matches(JqlEventMatcher.java:22) at com.atlassian.webhooks.api.util.EventMatchers$3$1.apply(EventMatchers.java:49) at com.atlassian.webhooks.api.util.EventMatchers$3$1.apply(EventMatchers.java:45) at com.google.common.collect.Iterators.all(Iterators.java:674) at com.google.common.collect.Iterables.all(Iterables.java:618) at com.atlassian.webhooks.api.util.EventMatchers$3.matches(EventMatchers.java:44) at com.atlassian.webhooks.plugin.WebHookPublisherImpl.match(WebHookPublisherImpl.java:111) at com.atlassian.webhooks.plugin.WebHookPublisherImpl.publish(WebHookPublisherImpl.java:81) at com.atlassian.webhooks.plugin.WebHookEventsProcessor.doOnEvent(WebHookEventsProcessor.java:41) at com.atlassian.webhooks.plugin.WebHookEventsProcessor.onEvent(WebHookEventsProcessor.java:34) ... 2 filtered at java.lang.reflect.Method.invoke(Method.java:498) at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:40) ... 86 more
Workaround
Currently there is no known workaround for this behavior. A workaround will be added here when available
- is duplicated by
-
JSWSERVER-20887 Webhook with JQL will fail silently if triggered by Bitbucket DVCS trigger
- Gathering Impact
- is related to
-
JRASERVER-69726 Jira Software triggers issue reindex in non-Jira thread without JiraThreadLocalUtil/OffRequestThreadExecutor
- Closed
-
JRASERVER-69604 DevStatus plugin triggers issue reindex in non-Jira thread without JiraThreadLocalUtil/OffRequestThreadExecutor
- Closed
- blocks
-
DELTA-704 Loading...
- mentioned in
-
Page Loading...
- relates to
-
DELTA-887 Loading...