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

Exclusion plugin does not handle a single job listing same resource multiple times

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • exclusion-plugin
    • None

      It's not entirely clear if this should work, but seems like it should be detected as a deadlock if job X #Y is waiting on resource held by job X #Y.

          [JENKINS-30879] Exclusion plugin does not handle a single job listing same resource multiple times

          Will try to describe bug more clearly:
          Assume we have job with 2 defined resources, 1 of them is defined as reference:

          RES1
          ${RESOURCE_REF}
          

          In situation when ${RESOURCE_REF} is assigned to RES1, we'll have deadlock with the following log (current run is "test-job #3"):

          [Exclusion] -> Allocating resource : RES1
          [Exclusion] -> Assigned RES1
          [Exclusion] -> Allocating resource : RES1
          [Exclusion] -> Waiting for resource 'RES1 currently used by 'test-job #3'
          

          Note: This will not happen if we define both resources immediately:

          RES1
          RES1
          

          In this case job will fail with exception:

          java.lang.IllegalStateException: just one binding for STATIC-NAME
          	at jenkins.tasks.SimpleBuildWrapper$Context.env(SimpleBuildWrapper.java:96)
          	at org.jvnet.hudson.plugins.exclusion.IdAllocator.setUp(IdAllocator.java:54)
                  ....
          

          (it occurs because we try to add RES1 to IdAllocator context twice)

          Oleksandr Kulychok added a comment - Will try to describe bug more clearly: Assume we have job with 2 defined resources, 1 of them is defined as reference: RES1 ${RESOURCE_REF} In situation when ${RESOURCE_REF} is assigned to RES1, we'll have deadlock with the following log (current run is " test-job #3 "): [Exclusion] -> Allocating resource : RES1 [Exclusion] -> Assigned RES1 [Exclusion] -> Allocating resource : RES1 [Exclusion] -> Waiting for resource 'RES1 currently used by 'test-job #3' Note: This will not happen if we define both resources immediately: RES1 RES1 In this case job will fail with exception: java.lang.IllegalStateException: just one binding for STATIC-NAME at jenkins.tasks.SimpleBuildWrapper$Context.env(SimpleBuildWrapper.java:96) at org.jvnet.hudson.plugins.exclusion.IdAllocator.setUp(IdAllocator.java:54) .... (it occurs because we try to add RES1 to IdAllocator context twice)

            Unassigned Unassigned
            nneul Nathan Neulinger
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: