jenkinsci / concurrent-step-plugin

Jenkins plugin to use utils in Java concurrent package.
https://plugins.jenkins.io/concurrent-step/
MIT License
21 stars 8 forks source link

Await Barrier never releases after Job abort #16

Open Phil-11 opened 3 years ago

Phil-11 commented 3 years ago

When a running job (with active barrier running) gets aborted (might manually) the barrier does not gets released. When the job will be restarted, the awaitBarrier does not get a free slot.

I started a parallel job with 4 parallel steps (sub build-jobs) and a barrier count of 3 slots. After start the parallel job, the expected 3 parallel steps started up. When the 3 steps finished, the 4th and last job started. As far as good, everything as expected to here. This was why I aborted the running sub build-job and the pipeline execution in the parent job. When I restarted the parallel job, only 2 sub build-jobs started up. (Gues the 3rd was still locked) Also aborted the two running jobs and the parent job. Restarted the parent job again and no free slot was available anymore.

15:25:49 [Pipeline] awaitBarrier 15:25:49 [Pipeline] awaitBarrier 15:25:49 [Pipeline] awaitBarrier 15:25:49 [Pipeline] awaitBarrier 15:25:49 [Pipeline] // stage 15:25:49 [Pipeline] // stage 15:25:49 [Pipeline] // stage 15:25:49 [Pipeline] // stage 15:25:49 [Pipeline] } 15:25:49 [Pipeline] } 15:25:49 [Pipeline] } 15:25:49 [Pipeline] }

I would expect these behaviors: 1st: When a step gets finished in any condition the used barriers gets released awaitBarrier (barrier){ // what ever step to do here } 2nd: When a new barrier is created, its really a new barrier with n count of slots (no dependencies to alredy existing) => scope def barrier = createBarrier count: 3; 3rd: missing a command to release a barrier slot, may for custom try catch release actions

This issue seems to be related to https://github.com/jenkinsci/concurrent-step-plugin/issues/10 but is quite a bit different. The old issue should be reopended to, since there are some more reports with details of problems after closing.

` def barrier = createBarrier count: 3

parameters { booleanParam(defaultValue: true, description: 'Install on: Windows 10 Pro', name: 'INSTALL_ON_WIN10') booleanParam(defaultValue: true, description: 'Install on: Windows Server 2016 Standard', name: 'INSTALL_ON_WINS2016') booleanParam(defaultValue: true, description: 'Install on: Windows Server 2016 Standard (Member of AD)', name: 'INSTALL_ON_WINS2016_AD') booleanParam(defaultValue: true, description: 'Install on: Windows Server 2019 Standard', name: 'INSTALL_ON_WINS2019') booleanParam(defaultValue: true, description: 'Install on: Windows Server 2019 Standard', name: 'INSTALL_ON_WINS2019') booleanParam(defaultValue: true, description: 'Install on: Windows Server 2019 Standard (Member of AD)', name: 'INSTALL_ON_WINS2019_AD') booleanParam(defaultValue: true, description: 'Upgrade: Release 1.6.15', name: 'UPGRADE_REL_1_6_15') booleanParam(defaultValue: true, description: 'Upgrade: Release 1.7.10', name: 'UPGRADE_REL_1_7_10') booleanParam(defaultValue: true, description: 'Upgrade: Release 1.8.15', name: 'UPGRADE_REL_1_8_15') }

stages { stage("Install / Upgrade") { parallel { stage('Install on WIN10') { when { expression { params.INSTALL_ON_WIN10 == true } } steps { awaitBarrier (barrier){ build job: 'Pipeline-VM-vSphere_develop', parameters: [ string(name: 'TARGET', value: "WIN10") ] } } } stage('Install on WINS2016') { when { expression { params.INSTALL_ON_WINS2016 == true } } steps { awaitBarrier (barrier){ build job: 'Pipeline-VM-vSphere_develop', parameters: [ string(name: 'TARGET', value: "WINS2016") ] } } } stage('Install on WINS2016_AD') { ... } stage('Install on WINS2019') { ... } ... } } } `