-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Major
-
Component/s: workflow-durable-task-step-plugin
-
None
-
Environment:Jenkins 2.462.1
Pipeline: Nodes and Processes Version 1371.vb_7cec8f3b_95e
Microsoft Windows [Version 10.0.19045.4780]
$PSVersionTable
Name Value
---- -----
PSVersion 5.1.19041.4780
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.4780
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1Jenkins 2.462.1 Pipeline: Nodes and Processes Version 1371.vb_7cec8f3b_95e Microsoft Windows [Version 10.0.19045.4780] $PSVersionTable Name Value ---- ----- PSVersion 5.1.19041.4780 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.19041.4780 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1
Steps to reproduce
Run the following declarative pipeline multiple times:
pipeline {
agent { label 'windows' }
stages {
stage('Stage') {
options {
timeout(time: 5, unit: 'SECONDS')
}
steps {
script {
writeFile(file: 'sleep.bat', text: 'ping -n 100 localhost')
writeFile(file: 'sleep.ps1', text: 'Start-Sleep 100')
// FAILS 50 %
bat 'powershell -File sleep.ps1'
// OK
//bat 'ping -n 100 localhost'
// OK
//bat 'sleep.bat'
// OK
//powershell 'Start-Sleep 100'
// OK
//powershell './sleep.ps1'
}
}
}
}
post {
always {
echo 'always'
}
success {
echo 'success'
}
aborted {
echo 'aborted'
}
failure {
echo 'failure'
}
unsuccessful {
echo 'unsuccessful'
}
}
}
Expected behavior
The timeout is honored.
The build fails on every run.
The failed builds are displayed "gray".
In the post actions, "aborted" and "unsuccessful" is echoed.
Actual behavior
The timeout is honored.
The build fails only around 50% of the runs. On about every other run, the build is marked green although it ran into timeout. In these cases, the post actions echo "successful".

Log of correct gray build:
Â
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Stage)
[Pipeline] timeout
Timeout set to expire in 5 sec
[Pipeline] {
[Pipeline] script
[Pipeline] {
[Pipeline] writeFile
[Pipeline] writeFile
[Pipeline] batC:\Jenkins\workspace\TimeoutDebug>powershell -File sleep.ps1Â
Cancelling nested steps due to timeout
Sending interrupt signal to process
script returned exit code -1
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // timeout
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Declarative: Post Actions)
[Pipeline] echo
always
[Pipeline] echo
aborted
[Pipeline] echo
unsuccessful
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Timeout has been exceeded
org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: 11ad6797-e9a8-4ec5-80f7-5ac4925f7fd0
Finished: ABORTED
Log of incorrect green build:
Â
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Stage)
[Pipeline] timeout
Timeout set to expire in 5 sec
[Pipeline] {
[Pipeline] script
[Pipeline] {
[Pipeline] writeFile
[Pipeline] writeFile
[Pipeline] batC:\Jenkins\workspace\TimeoutDebug>powershell -File sleep.ps1Â
Cancelling nested steps due to timeout
Sending interrupt signal to process
Batchvorgang abbrechen (J/N)?Â
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // timeout
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Declarative: Post Actions)
[Pipeline] echo
always
[Pipeline] echo
success
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS
Additional information
I am aware of the "powershell" step and that this is the preferred way of running PowerShell. As you can see in the example pipeline, the bug is not present when using the "powershell" step. Nevertheless I wanted to inform you about this bug, as maybe other executables are affected as well.