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

NumberFormatException from exitStatus can cause DurableTaskStep.Execution.check problems

XMLWordPrintable

      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)
      

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

              Created:
              Updated:
              Resolved: