-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
Jenkins 2.176.3
OpenJDK Runtime Environment (build 1.8.0_222-8u222-b10-1ubuntu1~18.04.1-b10)
A freestyle job was in progress. The current step was invocation of a chunk of shell script. Within the shell script, a Python instance was running. The red X button to abort the build was pressed, probably twice. The job disappeared from the list of running jobs and its status changed to aborted. However, the Bash and Python processes were still running, Jenkins still had the output pipe connected to them, and the following appeared in the server log:
{{INFO: (job name and number) aborted
java.lang.InterruptedException: sleep interrupted
at java.lang.Thread.sleep(Native Method)
at hudson.util.ProcessTree$UnixProcess.kill(ProcessTree.java:784)
at hudson.util.ProcessTree$UnixProcess.killRecursively(ProcessTree.java:818)
at hudson.util.ProcessTree$UnixProcess.killRecursively(ProcessTree.java:813)
at hudson.util.ProcessTree$UnixProcess.killRecursively(ProcessTree.java:813)
at hudson.util.ProcessTree$UnixProcess.killRecursively(ProcessTree.java:805)
at hudson.util.ProcessTree.killAll(ProcessTree.java:172)
at hudson.Proc$LocalProc.destroy(Proc.java:385)
at hudson.Proc$LocalProc.join(Proc.java:358)
at hudson.tasks.CommandInterpreter.join(CommandInterpreter.java:155)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:109)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:66)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741)
at hudson.model.Build$BuildExecution.build(Build.java:206)
at hudson.model.Build$BuildExecution.doRun(Build.java:163)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
at hudson.model.Run.execute(Run.java:1818)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)}}
[JENKINS-59494] InterruptedException: sleep interrupted aborting job during shell command leaves process running
Priority | Original: Minor [ 4 ] | New: Major [ 3 ] |
The issue is a bit similar to the one I described in JENKINS-65621 (see the penultimate paragraph of the description), in the sense that if a build is interrupted twice (like by pressing the Abort button twice) then the first one interrupts the main build step while the second one interrupts any post-processing, which includes killing any left-over processes using Jenkins ProcessTreeKiller.