Certain functionalities in Jira, such as trying to mention users or otherwise typing usernames into user fields, allow Jira to return user suggestions as usernames are being typed out.
As the searching user types, Jira will use a thread to perform a search against what they've typed and return possible results back to the user. In instances with many users, directories, or nested groups, these searches may be computationally expensive and may run for several seconds in order to return results.
It is possible for the searching user to continue typing and end up making multiple user search requests before the previous requests ever complete and return. Jira will not cancel or otherwise terminate previously ongoing search threads in this case.
The instance may experience high CPU load and thread utilization if too many of these threads are working on these searches concurrently.
Steps to Reproduce
- Have many users, groups/nested groups, and directories.
- Attempt to search for a user (i.e. by mentioning or perhaps trying to assign an issue), by typing a character out at a pace of 2-3 characters/second.
Suggested users will be returned, and no other behaviors (high CPU/thread usage) are observed.
Suggested users may be returned, but CPU and thread usage run high. Excessive usage may cause the system to become unresponsive.
Thread Dumps show many threads like the following, which showcase a user mention being searched against nested groups in this particular example:
"http-nio-8080-exec-20 url:/rest/internal/2/user/mention/search username:" #49 daemon prio=5 os_prio=0 tid=0x00007f8210b43000 nid=0x5d85 runnable [0x00007f810e1e1000]
Access Logs show individual HTTP requests being made for each character typed:
Reducing the complexity and dataset of users, groups, nested groups, and directories may help reduce the calculation cost and time of these searches.
Allow administrators to configure the frequency at which the browser may submit search requests.