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 added a comment - - edited

          Filed JENKINS-25053 for Windows.

          Jesse Glick added a comment - - edited Filed JENKINS-25053 for Windows.

          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.

          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.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/main/java/org/jenkinsci/plugins/durabletask/BourneShellScript.java
          src/main/java/org/jenkinsci/plugins/durabletask/ProcessLiveness.java
          http://jenkins-ci.org/commit/durable-task-plugin/d75ffad16c40c0018fd6e71499f6b6e96048798f
          Log:
          [FIXED JENKINS-22249] Rewrote ProcessLiveness to use a simple [ -d /proc/$pid ] check.

          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/ProcessLiveness.java http://jenkins-ci.org/commit/durable-task-plugin/d75ffad16c40c0018fd6e71499f6b6e96048798f Log: [FIXED JENKINS-22249] Rewrote ProcessLiveness to use a simple [ -d /proc/$pid ] check.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/main/java/org/jenkinsci/plugins/durabletask/BourneShellScript.java
          http://jenkins-ci.org/commit/durable-task-plugin/88aed023e5d37fdae0d1e0c05acd7cabbdf6fd7f
          Log:
          JENKINS-22249 Do not bother checking process existence if we just started it.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/org/jenkinsci/plugins/durabletask/BourneShellScript.java http://jenkins-ci.org/commit/durable-task-plugin/88aed023e5d37fdae0d1e0c05acd7cabbdf6fd7f Log: JENKINS-22249 Do not bother checking process existence if we just started it.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pom.xml http://jenkins-ci.org/commit/workflow-plugin/7f63d35b76eeb7140c4807af0209d2380bc65a54 Log: durable-task 0.7 to pick up reworked JENKINS-22249 fix. Compare: https://github.com/jenkinsci/workflow-plugin/compare/a3f94a7e0296...7f63d35b76ee

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

              Created:
              Updated:
              Resolved: