Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-7006

Synchronizing on the class when changing a static map in HelpUtil

    XMLWordPrintable

Details

    Description

      The problem is that the map is static so the synchronised init method does very little. Thus multiple threads can start initing the Map causing a huge CPU load. The threads are stuck in:

      "ApplicationServerThread" prio=1 tid=0x084d9cf8 nid=0x7932 runnable [9c97c000..9c97e86c]
      at java.util.HashMap.put(HashMap.java:382)
      at com.atlassian.jira.web.util.HelpUtil.loadExternalProperties(HelpUtil.java:105)
      at com.atlassian.jira.web.util.HelpUtil.init(HelpUtil.java:45)

      • locked <0xa17857e8> (a com.atlassian.jira.web.util.HelpUtil)
        at com.atlassian.jira.web.util.HelpUtil.<init>(HelpUtil.java:36)
        at com.atlassian.jira.web.util.HelpUtil.<init>(HelpUtil.java:31)

      Need to synchronise on the class rather than the object to ensure only one thread can init the static map.

      Attachments

        Activity

          People

            anton@atlassian.com AntonA
            anton@atlassian.com AntonA
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: