Details
-
Fix
-
Status: Released (View Workflow)
-
Minor
-
Resolution: Fixed
-
1.9.2, 1.9.3, 1.9.4
-
Windows, Linux
Description
Current Situation
A shell job is configured with a timeout, e.g.:
<job stop_on_error="no" timeout="00:00:05"> <script language="shell"> <![CDATA[ sleep 20 ]]> </script> <run_time/> </job>
JobScheduler tries to kill the job after it has regularly ended (in this case after 20 seconds instead of 5):
2015-07-23 11:38:15.654+0200 [info] SCHEDULER-918 state=starting (at=2015-07-23 11:38:15.635+0200) 2015-07-23 11:38:15.654+0200 [info] SCHEDULER-987 Starting process: '/bin/sh' '-c' '"/tmp/jenkins/sos.Le68rw"' 2015-07-23 11:38:35.710+0200 [info] SCHEDULER-915 Process event 2015-07-23 11:38:35.710+0200 [ERROR] SCHEDULER-272 Terminating task after reaching deadline <job timeout="5"> 2015-07-23 11:38:35.710+0200 [WARN] SCHEDULER-276 Could not kill task
The timeout works correctly for:
- shell jobs with monitors
- api jobs
- jobs on remote JobSchedulers
Desired Behaviour
A shell job without monitor that is configured with a timeout, should be killed after that timeout (per processing step).
Workaround
Configure a monitor (pre-/postprocessing Script) for the shell job, e.g.
<job name="shell_with_javascript_monitor"> <script language="shell"> <![CDATA[ echo hello world! sleep 45 ]]> </script> <monitor name="process0" ordering="0"> <script language="java:javascript"> <![CDATA[ function spooler_process_before(){ return true; } ]]> </script> </monitor> <run_time /> </job>