jenkinsci / jenkinsci/workflow-aggregator-plugin
[JENKINS-56844] timeout error not propagated when sh step with returnStatus not finished
- Dominant language
- No language data
- Stars
- 225
- Forks
- 125
- PR merge metrics
- No merged PRs in 30d
Description
When a long running sh step with returnStatus is running, timeout error is not propagated.
Steps to reproduce:
1. Having this pipeline, I expect echo 'Continue ...' to never be executed because the internal sh step takes more than the timeout.
```
node {
stage('stage 1') {
test()
echo 'Continue working after timeout'
}
}
def test() {
timeout(time: 10, unit: 'SECONDS') {
echo 'working ...'
sh script: 'sleep 15'//, returnStatus: true
}
}
```
And that works.
2. If the same pipeline is executed removing the comment, enabling returnStatus: true, the interrupt signal is sent but the Pipeline continues and echo 'Continue working after timeout' is executed finishing with status SUCCESS.
Here is the log:
```
Timeout set to expire in 10 sec
[Pipeline] {
[Pipeline] echo
working ...
[Pipeline] sh
[test-pipeline] Running shell script
+ sleep 15
Sending interrupt signal to process
Cancelling nested steps due to timeout
Terminated
[Pipeline] }
[Pipeline] // timeout
[Pipeline] echo
Continue working after timeout
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS
```
---
Originally reported by
pcarballo, imported from: timeout error not propagated when sh step with returnStatus not finished
Raw content of original issue
When a long running sh step with returnStatus is running, timeout error is not propagated.
Steps to reproduce:
1. Having this pipeline, I expect echo 'Continue ...' to never be executed because the internal sh step takes more than the timeout.
node {
stage('stage 1') {
test()
echo 'Continue working after timeout'
}
}def test() {
timeout(time: 10, unit: 'SECONDS') {
echo 'working ...'
sh script: 'sleep 15'//, returnStatus: true
}
}And that works.
2. If the same pipeline is executed removing the comment, enabling returnStatus: true, the interrupt signal is sent but the Pipeline continues and echo 'Continue working after timeout' is executed finishing with status SUCCESS.
Here is the log:
Timeout set to expire in 10 sec
[Pipeline] {
[Pipeline] echo
working ...
[Pipeline] sh
[test-pipeline] Running shell script
+ sleep 15
Sending interrupt signal to process
Cancelling nested steps due to timeout
Terminated
[Pipeline] }
[Pipeline] // timeout
[Pipeline] echo
Continue working after timeout
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS
Contributor guide
Research direction
Start by reproducing the pipeline with timeout and sh using returnStatus: true, then compare it with the version where returnStatus is disabled. Check the timeout and sh step behavior around the interrupt and nested-step cancellation. Done means the timeout error is propagated and the following echo does not execute.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- shell
- Domain
- ci-cd, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100