Create Issue, Comment on Issue, Assign User, Slow due to Webhook Complexity
Summary
Events takes longer when there are configured WebHooks with Create Issue event, Comment or Assign User.
The WebHooks are fired asynchronously, but the logic that evaluates whether a WebHook should be called is synchronous and executes one JQL query per each configured WebHook.
On instances that have problems with slow JQLs or with overly complicated WebHook filters configured, this can increase the time it takes to perform actions in Jira.
Environment
An environment where there are WebHooks with Create Issue event and with complex JQL queries. This can also affect Assign User and Comments.
Expected Results
When a customer creates an issue, they should swiftly see it's created on the UI. Slow JQLs configured for the WebHooks shouldn't impact the issue creation time.
Actual Results
The customer clicks on Create Issue, Issue is created and the logic determining which WebHooks to call is executed. After all JQL filters are executed, user sees the new issue in the UI and the actual WebHooks are called in separate background threads.
Sample log after a successful Create Issue - which takes around 1 minute to see on UI but actually it took only around 1 second:
Jira log:
2019-04-19 09:29:50,430 https-jsse-nio-443-exec-33
url:xxx/comment INFO I304405 569x530511x3 xxx xxx/rest/api/2/issue/xxx/comment [c.a.j.p.webhooks.matcher.JqlEventMatcher_SLOW] JQL query
'{issuetype in ("Defect", "Feature", "Customer Issue", "Task")} AND {status changed} AND
{assignee in ("xx", "xx", "xx", "xx", "xx", "xx", "xx", "xx", "xx", "xx", "xx", "xx", "xx", "xx", "xx")} AND {key in ("xx")}'
produced lucene query and took '52730' ms to run.
Threads:
(you should see running threads on lucene that contain com.atlassian.jira.plugins.webhooks.matcher.JqlEventMatcher.matchJql)
https-jsse-nio-443-exec-8 url:/rest/api/2/issue/xxxx/comment username:xxx" #52 daemon prio=5 os_prio=0 tid=0x000000003a2df000 nid=0xda8 runnable [0x0000000042a88000]
java.lang.Thread.State: RUNNABLE
at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:946)
at org.apache.lucene.util.DoubleBarrelLRUCache.get(DoubleBarrelLRUCache.java:81)
at org.apache.lucene.index.TermInfosReader.get(TermInfosReader.java:220)
at org.apache.lucene.index.TermInfosReader.get(TermInfosReader.java:209)
at org.apache.lucene.index.SegmentTermDocs.seek(SegmentTermDocs.java:57)
.....
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
Workaround
No workaround if Webhooks will be used. But if the aim is to increase the performance of creating issue, then Webhooks should be disabled or JQLs should be tuned.
You can however report off the following in the atlassian-jira.log
c.a.j.p.webhooks.matcher.JqlEventMatcher_SLOW
Find the offending Webhook and either disable it or tune the JQL.
More information can be found in - JRASERVER-68174Getting issue details... STATUS