Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-75960

Severe thread blocking in Role.hasAnyPermission() causing dozens of blocked threads

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • role-strategy-plugin
    • None
    • 799.v5b_e7b_ecc231e

      Example endpoints:

      • /job/projects/job/p8/runs
      • /job/projects/job/p146/wfapi/runs
      • /job/a/multi-pipeline-graph/runs

      Observed:

      • Jetty (winstone)-93207409: 14 threads blocked
      • Jetty (winstone)-93216166: 12 threads blocked
      • Jetty (winstone)-93207413: 54 threads blocked

      Each thread is stuck on:

      java.lang.Thread.State: BLOCKED (on object monitor)
      at com.michelin.cio.hudson.plugins.rolestrategy.Role.hasAnyPermission(Role.java:269)
      - locked <0x00000006439773b8> (a java.util.HashSet)
      

      Method:

        public Boolean hasAnyPermission(Set<Permission> permissions) {
          synchronized (this.permissions) {
            return CollectionUtils.containsAny(this.permissions, permissions);
          }
        }
      

      Are there contention problems when multiple threads are accessing job run data concurrently? Consider using thread-safe data structures such as ConcurrentHashMap.newKeySet() or CopyOnWriteArrayList instead of HashSet, or refactor the locking strategy to reduce contention.

            mawinter69 Markus Winter
            jacurt Jason Curtis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: