Incorrect JIRA API usage. ThreadLocalQueryProfiler#store called outside of the context.

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Low
    • None
    • Affects Version/s: 8.13.10, 8.17.0, 8.19.1, 8.20.1
    • Component/s: Issue - Others
    • 8.13
    • 14
    • Severity 3 - Minor
    • 1

      Issue Summary

      By enabling the Profiling logs in Jira, along with the expected profiling information, several Warning messages are added to the atlassian-jira.log, informing that ThreadLocalQueryProfiler#store was called outside of the context.

      While this does not seem to have any negative performance effects on the instance, it can make the investigation of performance problems more difficult due to the amount of WARN messages added to the logs

      Steps to Reproduce

      1. Go to Jira administration (gear icon) > System > Logging and Profiling
      2. Enable the Profiling logs.
      3. Access any issues that contain an attachment.
        This is just one example of how to trigger the issue. Other identified triggers are
        • Create a project using sample data.
        • Create an Object Schema on Insight.
        • The execution of an Insight Automation rule.
        • A POST to the /rest/analytics/1.0/publish/bulk endpoint.

      Expected Results

      Only profiling information should be added to the logs.

      Actual Results

      Along with the profiling data, several warnings related to Incorrect JIRA API usage can be added to the Jira logs depending on the actions taken.

      Example for viewing an attachment

      2021-11-08 15:49:08,757-0300 file-attachment-store:thread-6 WARN admin 949x1121x1 1hup0ub 0:0:0:0:0:0:0:1 /secure/attachment/10000/IssueTypes.png [c.a.j.web.filters.ThreadLocalQueryProfiler] Incorrect JIRA API usage. ThreadLocalQueryProfiler#store called outside of the context. Please report this to support with the following stack trace.
      java.lang.Throwable
      	at com.atlassian.jira.web.filters.ThreadLocalQueryProfiler.store(ThreadLocalQueryProfiler.java:63)
      	at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findByPrimaryKey(DefaultOfBizDelegator.java:345)
      	at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findByPrimaryKey(DefaultOfBizDelegator.java:335)
      	at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findById(DefaultOfBizDelegator.java:327)
      	at com.atlassian.jira.ofbiz.WrappingOfBizDelegator.findById(WrappingOfBizDelegator.java:192)
      	at com.atlassian.jira.issue.managers.DefaultAttachmentManager.getAttachment(DefaultAttachmentManager.java:174)
      	at com.atlassian.jira.web.servlet.viewfile.AbstractViewFileServlet.getAttachment(AbstractViewFileServlet.java:311)
      	at com.atlassian.jira.web.servlet.viewfile.ViewAttachmentServlet.getCommonAttachment(ViewAttachmentServlet.java:85)
      	at com.atlassian.jira.web.servlet.viewfile.ViewAttachmentServlet.setResponseContentHeaders(ViewAttachmentServlet.java:63)
      	at com.atlassian.jira.web.servlet.viewfile.AbstractViewFileServlet.lambda$streamFileData$2(AbstractViewFileServlet.java:147)
      	at com.atlassian.jira.issue.managers.DefaultAttachmentManager$7.apply(DefaultAttachmentManager.java:731)
      	at com.atlassian.jira.issue.managers.DefaultAttachmentManager$7.apply(DefaultAttachmentManager.java:727)
      	at com.atlassian.jira.issue.attachment.store.DefaultFileSystemAttachmentStore$2.apply(DefaultFileSystemAttachmentStore.java:127)
      	at com.atlassian.jira.issue.attachment.store.DefaultFileSystemAttachmentStore$2.apply(DefaultFileSystemAttachmentStore.java:124)
      	at com.atlassian.jira.issue.attachment.store.DefaultFileSystemAttachmentStore$3.call(DefaultFileSystemAttachmentStore.java:150)
      	at io.atlassian.util.concurrent.Executors$DefaultSubmitter$CallableRunner.run(Executors.java:85)
      	at io.atlassian.util.concurrent.LimitedExecutor$Runner.run(LimitedExecutor.java:94)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      	at java.base/java.lang.Thread.run(Thread.java:834)
      

      Some other examples

      2021-11-05 10:42:49,890-0400 pool-25-thread-10 WARN anonymous 641x247667x6 11oi54r 127.0.0.1 /login.jsp [c.a.j.web.filters.ThreadLocalQueryProfiler] Incorrect JIRA API usage. ThreadLocalQueryProfiler#store called outside of the context. Please report this to support with the following stack trace.
      java.lang.Throwable
      	at com.atlassian.jira.web.filters.ThreadLocalQueryProfiler.store(ThreadLocalQueryProfiler.java:63)
      	at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findByPrimaryKey(DefaultOfBizDelegator.java:345)
      	at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findByPrimaryKey(DefaultOfBizDelegator.java:335)
      	at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findById(DefaultOfBizDelegator.java:327)
      	at com.atlassian.jira.ofbiz.WrappingOfBizDelegator.findById(WrappingOfBizDelegator.java:192)
      	at com.atlassian.jira.issue.managers.DefaultIssueManager.getIssue(DefaultIssueManager.java:143)
      	at com.atlassian.jira.issue.managers.DefaultIssueManager.getIssueObject(DefaultIssueManager.java:323)
      	at com.atlassian.jira.issue.managers.RequestCachingIssueManager.getIssueObject(RequestCachingIssueManager.java:58)
      	at com.atlassian.jira.bc.issue.changehistory.properties.ChangeHistoryPropertyHelper$ChangeGroupPermissionFunction.getIssueFromChangeHistory(ChangeHistoryPropertyHelper.java:109)
      	at com.atlassian.jira.bc.issue.changehistory.properties.ChangeHistoryPropertyHelper$ChangeGroupPermissionFunction.apply(ChangeHistoryPropertyHelper.java:122)
      	at com.atlassian.jira.bc.issue.changehistory.properties.ChangeHistoryPropertyHelper$ChangeGroupPermissionFunction.apply(ChangeHistoryPropertyHelper.java:100)
      	...
      
      2021-11-08 10:44:20,883-0500 pool-25-thread-5 WARN anonymous 641x247561x8 - 127.0.0.1 /rest/analytics/1.0/publish/bulk [c.a.j.web.filters.ThreadLocalQueryProfiler] Incorrect JIRA API usage. ThreadLocalQueryProfiler#store called outside of the context. Please report this to support with the following stack trace.
      java.lang.Throwable
      	at com.atlassian.jira.web.filters.ThreadLocalQueryProfiler.store(ThreadLocalQueryProfiler.java:63)
      	at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findByPrimaryKey(DefaultOfBizDelegator.java:345)
      	at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findByPrimaryKey(DefaultOfBizDelegator.java:335)
      	...
      
      2021-11-08 15:02:00,072-0300 insight-event-3 WARN admin 896x286x1 brmdc1 0:0:0:0:0:0:0:1 /rest/plugins/1.0/ [c.a.j.web.filters.ThreadLocalQueryProfiler] Incorrect JIRA API usage. ThreadLocalQueryProfiler#store called outside of the context. Please report this to support with the following stack trace.
      java.lang.Throwable
      	at com.atlassian.jira.web.filters.ThreadLocalQueryProfiler.store(ThreadLocalQueryProfiler.java:63)
      	at com.atlassian.jira.issue.search.providers.LuceneSearchProvider.search(LuceneSearchProvider.java:394)
      	at com.atlassian.jira.issue.search.providers.LuceneSearchProvider.search(LuceneSearchProvider.java:137)	
      	...
      
      2021-11-08 15:16:00,061-0300 insight-event-6 WARN admin 899x580x1 brmdc1 0:0:0:0:0:0:0:1 /rest/insight/1.0/objectschema/create [c.a.j.web.filters.ThreadLocalQueryProfiler] Incorrect JIRA API usage. ThreadLocalQueryProfiler#store called outside of the context. Please report this to support with the following stack trace.
      java.lang.Throwable
      	at com.atlassian.jira.web.filters.ThreadLocalQueryProfiler.store(ThreadLocalQueryProfiler.java:63)
      	at com.atlassian.jira.issue.search.providers.LuceneSearchProvider.search(LuceneSearchProvider.java:394)
      	at com.atlassian.jira.issue.search.providers.LuceneSearchProvider.search(LuceneSearchProvider.java:137)
      	...	
      
      2021-11-08 15:57:42,860-0300 file-attachment-store:thread-1 WARN admin 957x106x1 16xa0td 0:0:0:0:0:0:0:1 /rest/jira-importers-plugin/1.0/demo/create [c.a.j.web.filters.ThreadLocalQueryProfiler] Incorrect JIRA API usage. ThreadLocalQueryProfiler#store called outside of the context. Please report this to support with the following stack trace.
      java.lang.Throwable
      	at com.atlassian.jira.web.filters.ThreadLocalQueryProfiler.store(ThreadLocalQueryProfiler.java:63)
      	at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findByPrimaryKey(DefaultOfBizDelegator.java:345)
      	at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findByPrimaryKey(DefaultOfBizDelegator.java:335)
      	...	
      

      Workaround

      Disable the Profiling logs after reproducing the behavior to reduce the amount of noise added to the logs.

            Assignee:
            Unassigned
            Reporter:
            Armando Neto
            Votes:
            7 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: