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

Powershell Pipeline Step hangs job if bogus command is run

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • durable-task-plugin
    • None
    • Jenkins 2.289.3, durable-task-pipeline 1.39
      also Jenkins 2.319.1, durable-task-pipeline 493.v195aefbb0ff2

      This is related to multiple issues that are resolved as fix, but there are still ongoing issues:

      Running a powershell step where the command is not found OR where the command does NOT generate any stdout when returnStdout: true will hang the job

      Use this for the pipeline to duplicate issue:

      pipeline {
         agent {
           label "john-windows"
         }
         stages {
           stage('gobbledygook - will pass') {
             steps{
               // powershell script: 'gobbledygook'
               powershell script: 'date'
             }
           }
           stage('gobbledygook - will fail') {
             steps{
               powershell returnStdout: true, script: 'gobbledygook'
             }
           }
         }
       }

       

      The jobs will hang and will need to be aborted.  Here is he console output:

       

       14:05:18 [Pipeline] Start of Pipeline
       14:05:19 [Pipeline] node
       14:05:34 Still waiting to schedule task
       14:05:34 ‘john-windows’ is offline
       14:05:51 Running on john-windows in c:\jenkins\workspace\test-powershell-stdout
       14:05:51 [Pipeline] {
       14:05:51 [Pipeline] stage
       14:05:51 [Pipeline] { (gobbledygook - will pass)
       14:05:51 [Pipeline] powershell
       14:05:57 
       14:05:57 Wednesday, January 12, 2022 2:05:57 PM
       14:05:58 [Pipeline] }
       14:05:58 [Pipeline] // stage
       14:05:58 [Pipeline] stage
       14:05:58 [Pipeline] { (gobbledygook - will fail)
       14:05:58 [Pipeline] powershell
       14:06:03 Exception calling "WriteAllLines" with "2" argument(s): "Value cannot be null.
       14:06:03 Parameter name: contents"
       14:06:03 At line:1 char:456
       14:06:03 + ... utput.txt"; [IO.File]::WriteAllLines("c:\jenkins\workspace\test-power ...
       14:06:03 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       14:06:03 + CategoryInfo : NotSpecified: ( [], MethodInvocationException
       14:06:03 + FullyQualifiedErrorId : ArgumentNullException
       14:06:03
       14:06:03 gobbledygook : The term 'gobbledygook' is not recognized as the name of a cmdlet, function, script file, or operable
       14:06:03 program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
       14:06:03 At C:\jenkins\workspace\test-powershell-stdout@tmp\durable-58ebe341\powershellScript.ps1:1 char:1
       14:06:03 + gobbledygook
       14:06:03 + ~~~~~~~~~~~~
       14:06:03 + CategoryInfo : ObjectNotFound: (gobbledygook:String) [], ParentContainsErrorRecordException
       14:06:03 + FullyQualifiedErrorId : CommandNotFoundException
       14:06:03
       14:06:03 14:06:03.275691 common.go:40: exit status 1
       14:06:04 Cannot contact john-windows: java.io.FileNotFoundException: c:\jenkins\workspace\test-powershell-stdout@tmp\durable-58ebe341\output.txt (The system cannot find the file specified)
       14:07:32 Aborted by Lengeling John M
       14:07:32 Sending interrupt signal to process
       14:07:47 Click here to forcibly terminate running steps
       14:07:52 After 20s process did not stop
       14:07:52 [Pipeline] }
       14:07:52 [Pipeline] // stage
       14:07:52 [Pipeline] }
       14:07:52 [Pipeline] // node
       14:07:52 [Pipeline] End of Pipeline
       14:07:52 Finished: ABORTED

       

      This issue appears related to other tickets but are marked as resolved and fixed in older versions of durable-task-plugin.

       

      https://issues.jenkins.io/browse/JENKINS-59529

      https://issues.jenkins.io/browse/JENKINS-46508

            Unassigned Unassigned
            johnlengeling John Lengeling
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: