Currently BourneShellScript does not try to track the PID of the external process; it assumes that it runs to completion (successfully or not) and then writes the status file. But if the wrapping shell script is killed, or the machine rebooted, this might never occur and the task would hang.

      Better to record $$ from the outer sh process and override exitStatus in case no such process still exists. Implies some use of native code.

      (TBD whether an analogous fix can be done for Windows as well.)

          [JENKINS-22249] Record process ID of spawned process

          Jesse Glick created issue -

          Jesse Glick added a comment - - edited

          Filed JENKINS-25053 for Windows.

          Jesse Glick added a comment - - edited Filed JENKINS-25053 for Windows.
          Jesse Glick made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Jesse Glick made changes -
          Link New: This issue is related to JENKINS-25053 [ JENKINS-25053 ]

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/main/java/org/jenkinsci/plugins/durabletask/BourneShellScript.java
          src/main/java/org/jenkinsci/plugins/durabletask/FileMonitoringTask.java
          src/main/java/org/jenkinsci/plugins/durabletask/ProcessLiveness.java
          http://jenkins-ci.org/commit/durable-task-plugin/41a11fb64845238e641fb005bb6bb7226407402d
          Log:
          [FIXED JENKINS-22249] Detect if the wrapper shell script is dead, for example because the machine was rebooted.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/org/jenkinsci/plugins/durabletask/BourneShellScript.java src/main/java/org/jenkinsci/plugins/durabletask/FileMonitoringTask.java src/main/java/org/jenkinsci/plugins/durabletask/ProcessLiveness.java http://jenkins-ci.org/commit/durable-task-plugin/41a11fb64845238e641fb005bb6bb7226407402d Log: [FIXED JENKINS-22249] Detect if the wrapper shell script is dead, for example because the machine was rebooted.
          SCM/JIRA link daemon made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: In Progress [ 3 ] New: Resolved [ 5 ]

          Jesse Glick added a comment -

          Using a cached ProcessTree does not seem reliable, and was probably inefficient anyway.

          Jesse Glick added a comment - Using a cached ProcessTree does not seem reliable, and was probably inefficient anyway.
          Jesse Glick made changes -
          Resolution Original: Fixed [ 1 ]
          Status Original: Resolved [ 5 ] New: Reopened [ 4 ]
          Jesse Glick made changes -
          Status Original: Reopened [ 4 ] New: Open [ 1 ]
          Jesse Glick made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]

            jglick Jesse Glick
            jglick Jesse Glick
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: