jenkinsci / jenkinsci/workflow-durable-task-step-plugin

[JENKINS-49157] Timeout: Unexpected build status after interrupting shell script

Open
#554 5 comments 0 reactions 0 assignees View on GitHub
component:workflow-durable-task-step-plugin imported-jira-issue priority:minor resolution:unresolved
Dominant language
Java
Stars
46
Forks
110
PR merge metrics
No merged PRs in 30d

Description

When a timeout interrupts a shell script (bash in my case), the build result is set to failure instead of the expected aborted.

Example (also true for scripted pipelines):

pipeline {

agent any

options {
timeout(time: 3, unit: 'SECONDS')
}

stages{
stage('run') {
steps {
sh 'sleep 5'
// working:
// sleep(time: 5, unit: 'SECONDS')
}
}
}
}


Output:

Started by user admin

Running in Durability level: MAX_SURVIVABILITY
[Pipeline] node
Running on Jenkins in /mnt/data/jenkins-weekly/jenkins_home/workspace/timeout-pipeline
[Pipeline] {
[Pipeline] timeout
Timeout set to expire in 3 sec
[Pipeline] {
[Pipeline] stage
[Pipeline] { (run)
[Pipeline] sh
[timeout-pipeline] Running shell script
+ sleep 5
Cancelling nested steps due to timeout
Sending interrupt signal to process
sh: line 1: 32445 Terminated JENKINS_SERVER_COOKIE=$jsc '/mnt/data/jenkins-weekly/jenkins_home/workspace/timeout-pipeline@​tmp/durable-7559496c/script.sh' > '/mnt/data/jenkins-weekly/jenkins_home/workspace/timeout-pipeline@​tmp/durable-7559496c/jenkins-log.txt' 2>&1
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // timeout
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 143
Finished: FAILURE

---
Originally reported by kgerstl, imported from: Timeout: Unexpected build status after interrupting shell script


  • status: Open
  • priority: Minor
  • component(s): workflow-durable-task-step-plugin
  • resolution: Unresolved
  • votes: 2
  • watchers: 7
  • imported: 20251212-090250

Raw content of original issue

When a timeout interrupts a shell script (bash in my case), the build result is set to failure instead of the expected aborted.

Example (also true for scripted pipelines):



pipeline {

agent any

options {
timeout(time: 3, unit: 'SECONDS')
}

stages{
stage('run') {
steps {
sh 'sleep 5'
// working:
// sleep(time: 5, unit: 'SECONDS')
}
}
}
}



Output:



Started by user admin

Running in Durability level: MAX_SURVIVABILITY
[Pipeline] node
Running on Jenkins in /mnt/data/jenkins-weekly/jenkins_home/workspace/timeout-pipeline
[Pipeline] {
[Pipeline] timeout
Timeout set to expire in 3 sec
[Pipeline] {
[Pipeline] stage
[Pipeline] { (run)
[Pipeline] sh
[timeout-pipeline] Running shell script
+ sleep 5
Cancelling nested steps due to timeout
Sending interrupt signal to process
sh: line 1: 32445 Terminated JENKINS_SERVER_COOKIE=$jsc '/mnt/data/jenkins-weekly/jenkins_home/workspace/timeout-pipeline@tmp/durable-7559496c/script.sh' > '/mnt/data/jenkins-weekly/jenkins_home/workspace/timeout-pipeline@tmp/durable-7559496c/jenkins-log.txt' 2>&1
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // timeout
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 143
Finished: FAILURE

  • environment: Jenkins 2.103 (.war) with Pipeline 2.5 on Fedora 26, Oracle JDK 1.8.0_121.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.