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

withCredentials hangs

    XMLWordPrintable

    Details

    • Similar Issues:
    • Released As:
      workflow-cps 2.76

      Description

      On Jenkins 2.176.2 and credentials-binding-plugin 1.19, the following pipeline will intermittently hang:

      pipeline {
          agent any
      
          stages {
              stage('bug') {
                  steps {
                      script {
                          for (int i = 0; i < 100; i++) {
                              withEnv(['A=b']) {
                                  withCredentials([]) {
                                      sh "echo hello ${i}"
                                  }
                              }
                          }
                      }
                  }
              }
          }
      }
      

      The build log looks like this:

      ...
      [Pipeline] withEnv
      [Pipeline] {
      [Pipeline] withCredentials
      

      until the build is aborted.

      I've seen two independent things that both seem to work around the problem:

      • flipping so `withCredentials([])` wraps `withEnv([...])` seems to avoid the hang.
      • ensuring there's always at least one item in the `withCredentials` list parameter seems to avoid the hang.

      We run into this in a pipeline where the parameter to withCredentials varies by projects, and sometimes is an empty list.

        Attachments

          Issue Links

            Activity

            jonathanb1 Jonathan B created issue -
            jonathanb1 Jonathan B made changes -
            Field Original Value New Value
            Description On Jenkins 2.176.2 and credentials-binding-plugin 1.19, the following pipeline will intermittently hang:

            ```
            pipeline {
                agent any

                stages {
                    stage('bug') {
                        steps {
                            script {
                                for (int i = 0; i < 100; i++) {
                                    withEnv(['A=b']) {
                                        withCredentials([]) {
                                            sh "echo hello ${i}"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            ```

            The build log looks like this:

            ```
            ...
            [Pipeline] withEnv
            [Pipeline] {
            [Pipeline] withCredentials
            ```

            until the build is aborted.

            I've seen two independent things that both seem to work around the problem:
            * flipping so `withCredentials([])` wraps `withEnv([...])` seems to avoid the hang.
            * ensuring there's always at least one item in the `withCredentials` list parameter seems to avoid the hang.

            We run into this in a pipeline where the parameter to withCredentials varies by projects, and sometimes is an empty list.
            On Jenkins 2.176.2 and credentials-binding-plugin 1.19, the following pipeline will intermittently hang:

            {code}
            pipeline {
                agent any

                stages {
                    stage('bug') {
                        steps {
                            script {
                                for (int i = 0; i < 100; i++) {
                                    withEnv(['A=b']) {
                                        withCredentials([]) {
                                            sh "echo hello ${i}"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            {code}

            The build log looks like this:

            {code}
            ...
            [Pipeline] withEnv
            [Pipeline] {
            [Pipeline] withCredentials
            {code}

            until the build is aborted.

            I've seen two independent things that both seem to work around the problem:
            * flipping so `withCredentials([])` wraps `withEnv([...])` seems to avoid the hang.
            * ensuring there's always at least one item in the `withCredentials` list parameter seems to avoid the hang.

            We run into this in a pipeline where the parameter to withCredentials varies by projects, and sometimes is an empty list.
            jonathanb1 Jonathan B made changes -
            Component/s workflow-cps-plugin [ 21713 ]
            dnusbaum Devin Nusbaum made changes -
            Assignee Devin Nusbaum [ dnusbaum ]
            dnusbaum Devin Nusbaum made changes -
            Remote Link This issue links to "jenkinsci/workflow-step-api-plugin#49 (Web Link)" [ 23937 ]
            dnusbaum Devin Nusbaum made changes -
            Remote Link This issue links to "jenkinsci/workflow-step-api-plugin#49 (Web Link)" [ 23938 ]
            dnusbaum Devin Nusbaum made changes -
            Remote Link This issue links to "jenkinsci/workflow-step-api-plugin#49 (Web Link)" [ 23938 ]
            dnusbaum Devin Nusbaum made changes -
            Remote Link This issue links to "jenkinsci/workflow-cps-plugin#335 (Web Link)" [ 23939 ]
            dnusbaum Devin Nusbaum made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            dnusbaum Devin Nusbaum made changes -
            Status In Progress [ 3 ] In Review [ 10005 ]
            dnusbaum Devin Nusbaum made changes -
            Released As workflow-cps 2.76
            Resolution Fixed [ 1 ]
            Status In Review [ 10005 ] Resolved [ 5 ]
            dnusbaum Devin Nusbaum made changes -
            Link This issue is duplicated by JENKINS-54480 [ JENKINS-54480 ]

              People

              Assignee:
              dnusbaum Devin Nusbaum
              Reporter:
              jonathanb1 Jonathan B
              Votes:
              4 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: