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

Referencing non-existant variable in Pipeline causes CPU to spike and job to hang

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • workflow-cps-plugin
    • None
    • 1.651.3.1, Pipeline 2.4

      Steps to reproduce:

      1. Create a new pipeline job with code similar to

      ```
      #!groovy

      def myVar

      node {
      myVar = getMyVar()
      echo "myVar is ${myVar}"
      echo "Loaded pipeline script."
      }

      def getMyVar() {
      myVar ? myVar : my_var
      }
      ```

      2. Observe CPU spike, and that job cannot be terminated

      See overflow.txt for exception in CPS.

          [JENKINS-40133] Referencing non-existant variable in Pipeline causes CPU to spike and job to hang

          Daniel Beck added a comment -

          The problem is the var is the same name as the getter and you're entering an infinite loop.

          I've seen this once or twice before and think this is a Groovy CPS specific issue. jglick Do we have an issue for this?

          Daniel Beck added a comment - The problem is the var is the same name as the getter and you're entering an infinite loop. I've seen this once or twice before and think this is a Groovy CPS specific issue. jglick Do we have an issue for this?

          Andrew Bayer added a comment -

          So it is possible to terminate this loop now, but yeah, there's an infinite loop. I'll investigate.

          Andrew Bayer added a comment - So it is possible to terminate this loop now, but yeah, there's an infinite loop. I'll investigate.

            Unassigned Unassigned
            afein_cb Aaron Fein
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: