-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
Jenkins 2.414.1 on windows
Pipeline: Basic Steps Version 1042.ve7b_140c4a_e0c
The timeout step kills not only processes started in its body but as well processes started by other jobs when these processes run in the same directory.
We initially had the issue executing maven tests but it can be easily reproduced with a small powershell script for instance.
- Job A:
timeout(10) { node() { echo "Workspace $env.WORKSPACE" timeout(1) { powershell '''"Start" $counter = 0 while ($true) { $counter++ "Sleeping ($counter)" Start-Sleep -Seconds 5 }''' } } }
- Job B:
timeout(10) { node() { def sameDirThanOtherJob = '' // to define dir(sameDirThanOtherJob) { timeout(time: 10, unit: 'SECONDS') { powershell '''"Start" $counter = 0 while ($true) { $counter++ "Sleeping ($counter)" Start-Sleep -Seconds 5 }''' } } } }
Output:
- Job A
... [2023-08-31T10:20:38.424Z] [Pipeline] timeout [2023-08-31T10:20:38.424Z] Timeout set to expire in 1 Minute 0 Sekunden [2023-08-31T10:20:38.424Z] [Pipeline] { [2023-08-31T10:20:38.424Z] [Pipeline] powershell [2023-08-31T10:20:41.002Z] Start [2023-08-31T10:20:41.002Z] Sleeping (1) [2023-08-31T10:20:46.303Z] Sleeping (2) [2023-08-31T10:20:51.596Z] Sleeping (3) [2023-08-31T10:20:56.865Z] Sleeping (4) [2023-08-31T10:20:58.256Z] [Pipeline] } [2023-08-31T10:20:58.256Z] [Pipeline] // timeout [2023-08-31T10:20:58.256Z] [Pipeline] } [2023-08-31T10:20:58.256Z] [Pipeline] // node [2023-08-31T10:20:58.256Z] [Pipeline] } [2023-08-31T10:20:58.272Z] [Pipeline] // timeout [2023-08-31T10:20:58.272Z] [Pipeline] End of Pipeline [2023-08-31T10:20:58.272Z] ERROR: script returned exit code -1 [2023-08-31T10:20:58.287Z] Finished: FAILURE
- Job B
... [2023-08-31T10:20:47.616Z] [Pipeline] { [2023-08-31T10:20:47.663Z] [Pipeline] timeout [2023-08-31T10:20:47.663Z] Timeout set to expire in 10 Sekunden [2023-08-31T10:20:47.678Z] [Pipeline] { [2023-08-31T10:20:47.710Z] [Pipeline] powershell [2023-08-31T10:20:49.132Z] Start [2023-08-31T10:20:49.132Z] Sleeping (1) [2023-08-31T10:20:54.402Z] Sleeping (2) [2023-08-31T10:20:57.678Z] Cancelling nested steps due to timeout [2023-08-31T10:20:57.678Z] Sending interrupt signal to process [2023-08-31T10:20:58.600Z] script returned exit code -1 [2023-08-31T10:20:58.615Z] [Pipeline] } [2023-08-31T10:20:58.647Z] [Pipeline] // timeout [2023-08-31T10:20:58.662Z] [Pipeline] } [2023-08-31T10:20:58.694Z] [Pipeline] // dir [2023-08-31T10:20:58.725Z] [Pipeline] } [2023-08-31T10:20:58.772Z] [Pipeline] // node [2023-08-31T10:20:58.787Z] [Pipeline] } [2023-08-31T10:20:58.819Z] [Pipeline] // timeout [2023-08-31T10:20:58.850Z] [Pipeline] End of Pipeline [2023-08-31T10:20:58.865Z] Timeout has been exceeded [2023-08-31T10:20:58.865Z] org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: 63ed9175-4688-47c7-bb7a-518210b28d0b [2023-08-31T10:20:58.865Z] Finished: ABORTED
Job B is normally cancelled by the timeout. Job A is interrupted as well.
We observe the problem since one or two weeks.
There are many, many problems when you force multiple jobs to run in a single workspace. Multiple jobs modifying the same workspace will create all sorts of problems. Much better to allow Jenkins to manage the workspace than to force multiple jobs into a single workspace concurrently.