DVCS webhook processing fail with the "There is already an active ThreadEventsCapture" error

XMLWordPrintable

    • 8.05
    • 30
    • Severity 3 - Minor
    • 67

      Issue Summary

      Jira's DVCS webhooks respond with the HTTP 500 error and the error message There is already an active ThreadEventsCapture

      Steps to Reproduce

      Could not reproduce

      Expected Results

      The webhooks reaching /rest/bitbucket/1.0/webhook/github are processed normally.

      Actual Results

      The processing fails for some threads.

      Enabling the com.atlassian.jira.plugins.dvcs package as DEBUG, we can see the messages in the logs:

      2021-05-21 17:07:16,075+0000 http-nio-8080-exec-52 DEBUG anonymous 102x1234x5 - X.X.X.X /rest/bitbucket/1.0/webhook/github [c.a.j.p.d.r.external.v1.HookResource] Received GitHub pull_request event
      2021-05-21 17:07:16,076+0000 http-nio-8080-exec-52 DEBUG anonymous 102x1234x5 - X.X.X.X /rest/bitbucket/1.0/webhook/github [c.a.j.p.dvcs.service.RepositoryServiceImpl] Finding repository with URL [https://github.com/myorg/myrepo] for organization [22]
      2021-05-21 17:07:16,090+0000 http-nio-8080-exec-52 DEBUG anonymous 102x1234x5 - X.X.X.X /rest/bitbucket/1.0/webhook/github [c.a.j.p.d.r.external.v1.HookResource] Failed to execute web-hook
      java.lang.IllegalStateException: There is already an active ThreadEventsCapture
      	at com.atlassian.jira.plugins.dvcs.event.ThreadEvents.startCapturing(ThreadEvents.java:45)
      	at com.atlassian.jira.plugins.dvcs.rest.webhook.GitHubHookProcessor.processPullRequest(GitHubHookProcessor.java:231)
      	at com.atlassian.jira.plugins.dvcs.rest.webhook.GitHubHookProcessor.lambda$savePullRequest$5(GitHubHookProcessor.java:221)
      	at java.base/java.util.Optional.ifPresent(Optional.java:183)
      	at com.atlassian.jira.plugins.dvcs.rest.webhook.GitHubHookProcessor.savePullRequest(GitHubHookProcessor.java:221)
      	at com.atlassian.jira.plugins.dvcs.rest.external.v1.HookResource.handlePullRequestEvent(HookResource.java:136)
      	at com.atlassian.jira.plugins.dvcs.rest.external.v1.HookResource.lambda$githubHookEndpoint$2(HookResource.java:120)
      	at com.atlassian.jira.plugins.dvcs.rest.external.v1.HookResource.handleRequest(HookResource.java:156)
      	at com.atlassian.jira.plugins.dvcs.rest.external.v1.HookResource.githubHookEndpoint(HookResource.java:116)
      

      Workaround

      None. Restarting the server should get the webhook processing working again, but the issue is prone to return in the affected environments.

            Assignee:
            awojtasik
            Reporter:
            Allan Gandelman
            Votes:
            54 Vote for this issue
            Watchers:
            34 Start watching this issue

              Created:
              Updated:
              Resolved: