Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-25519

NumberFormatException from exitStatus can cause DurableTaskStep.Execution.check problems

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      ON OLD DURABLE TASK VERSIONS:
      https://jenkins.ci.cloudbees.com/job/plugins/job/workflow-plugin/org.jenkins-ci.plugins.workflow$workflow-aggregator/572/testReport/junit/org.jenkinsci.plugins.workflow.steps/TimeoutStepTest/basic/ showed repeated warnings:

      ... org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution check
      FINE: could not check .../workspace/p
      java.io.IOException: corrupted content in .../workspace/p/.a883d971/jenkins-result.txt: java.lang.NumberFormatException: For input string: ""
      	at org.jenkinsci.plugins.durabletask.FileMonitoringTask$FileMonitoringController.exitStatus(FileMonitoringTask.java:136)
      	at org.jenkinsci.plugins.durabletask.BourneShellScript$ShellController.exitStatus(BourneShellScript.java:123)
      	at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.check(DurableTaskStep.java:188)
      	at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.run(DurableTaskStep.java:151)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)
      	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: java.lang.NumberFormatException: For input string: ""
      	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
      	at java.lang.Integer.parseInt(Integer.java:504)
      	at java.lang.Integer.parseInt(Integer.java:527)
      	at org.jenkinsci.plugins.durabletask.FileMonitoringTask$FileMonitoringController.exitStatus(FileMonitoringTask.java:134)
      	... 10 more
      

      Unclear what caused jenkins-result.txt to be empty rather than contain a number, but at any rate there is a problem in DurableTaskStep that it continued to recheck the workspace every 15s and never gave up. FileMonitoringController could perhaps mark this exception as "fatal" rather than "transient", but that leaves it open to a race condition if the exit status is still being checked while written. So it is probably the responsibility of the caller (check) to give up and mark the step failed if exitStatus repeatedly throws an exception. (As distinct from getWorkspace repeatedly being null, which is normal enough if the slave stays offline for a while.)

      On NEW versions of Pipeline the error is different, and instead the pipeline fails:

      java.lang.NumberFormatException: For input string: ""
      at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
      at java.lang.Integer.parseInt(Integer.java:592)
      at java.lang.Integer.parseInt(Integer.java:615)
      at org.jenkinsci.plugins.durabletask.FileMonitoringTask$FileMonitoringController.exitStatus(FileMonitoringTask.java:168)
      Caused: java.io.IOException: corrupted content in $SOMEPLACE
      at org.jenkinsci.plugins.durabletask.FileMonitoringTask$FileMonitoringController.exitStatus(FileMonitoringTask.java:170)
      at org.jenkinsci.plugins.durabletask.BourneShellScript$ShellController.exitStatus(BourneShellScript.java:211)
      

        Attachments

          Issue Links

            Activity

            Hide
            jglick Jesse Glick added a comment -

            PR 65 is one attempt at this.

            Show
            jglick Jesse Glick added a comment - PR 65 is one attempt at this.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Sam Van Oort
            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/WindowsBatchScript.java
            http://jenkins-ci.org/commit/durable-task-plugin/21f570e9e6ec92c1b53f3a7e3d872fcd78693ae2
            Log:
            Merge pull request #66 from svanoort/better-fix-to-exitStatus

            Better fix to JENKINS-25519 – avoid errors when trying to read exitStatus from durable task before finished writing

            Compare: https://github.com/jenkinsci/durable-task-plugin/compare/5133350aae6f...21f570e9e6ec

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Sam Van Oort 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/WindowsBatchScript.java http://jenkins-ci.org/commit/durable-task-plugin/21f570e9e6ec92c1b53f3a7e3d872fcd78693ae2 Log: Merge pull request #66 from svanoort/better-fix-to-exitStatus Better fix to JENKINS-25519 – avoid errors when trying to read exitStatus from durable task before finished writing Compare: https://github.com/jenkinsci/durable-task-plugin/compare/5133350aae6f...21f570e9e6ec
            Hide
            svanoort Sam Van Oort added a comment -

            Solved by PR #66

            Show
            svanoort Sam Van Oort added a comment - Solved by PR #66
            Hide
            svanoort Sam Van Oort added a comment -

            Root case turned out to be that the statusCode file was created before being written to, and could be checked while empty.

            Show
            svanoort Sam Van Oort added a comment - Root case turned out to be that the statusCode file was created before being written to, and could be checked while empty.
            Hide
            svanoort Sam Van Oort added a comment -

            Merged, pending release.

            Show
            svanoort Sam Van Oort added a comment - Merged, pending release.
            Hide
            svanoort Sam Van Oort added a comment -

            Released with v.1.19

            Show
            svanoort Sam Van Oort added a comment - Released with v.1.19

              People

              • Assignee:
                svanoort Sam Van Oort
                Reporter:
                jglick Jesse Glick
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: