Uploaded image for project: 'Jira Software Data Center'
  1. Jira Software Data Center
  2. JSWSERVER-7897

GHConfiguration can cause a race condition due to non thread safe operations

    XMLWordPrintable

Details

    Description

      GHConfiguration#getGrantedProjects uses a HashSet in a non thread-safe way. This can and has caused race conditions.

      GHConfiguration.java
         private Collection<Long> grantedProjects;
         ...
      
          public Collection<Long> getGrantedProjects()
          {
              if(grantedProjects != null) return grantedProjects;
              grantedProjects = new HashSet<Long>();
      
              String projectIds = (String)getDataStorage().get(PROJECT_LIST);
              if(projectIds != null)
              {
                  for(String id : projectIds.split(","))
                  {
                  	grantedProjects.add(Long.valueOf(id));
                  }
              }
              
              return grantedProjects;
          }
      

      Solution is to add synchronized to the method manipulating the set.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              melias MichaelA (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: