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

@NonCPS not lexically inherited

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Minor Minor
    • workflow-cps-plugin
    • None

      I get java.io.NotSerializableException: java.util.regex.Matcher on:

      @NonCPS
      def extractLatency(linesArr) {
        latency = [:]
        println "extractLatency"
        for (int j = 0; j < linesArr.size(); j++) {
          line = linesArr[j]
          println("looping over line: $line")
          // Matches lines like: Connect:        0    1   0.1      1       1
          abPattern = /(\w+)\:\s+(\d+\.?\d*)\s+(\d+\.?\d*)\s+(\d+\.?\d*)\s+(\d+\.?\d*)\s+(\d+\.?\d*)/
      
          def matcher = { (line =~ abPattern) }
      
          if (matcher().size > 1) {
            println("matched")
          }
      
          matcher = null
          abPattern = null
        }
        return latency
      }
      

      If I throw a @NonCPS on the inner def matcher it fixes it.

            Unassigned Unassigned
            devth Trevor Hartman
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: