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

java.lang.NoSuchMethodError mightBePositionalArgumentConstructor

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • workflow-cps-plugin
    • None

      Cannot run any scripted pipeline builds.

      Background:

      • Trying to upgrade our jenkins server from 2.319.2 --> 2.387.2
      • The upgrade process is now scripted in terraform so I can re-run and destroy it without impacting our current 2.319.2 server.  I'm re-working this script until it runs cleanly.
      • The upgraded jenkins instance was working well with some minor issues I was working through... until yesterday when this exception popped up around the moment when the 2.387.2 release came out.

      Things I tried

      • Downgrading to 2.387.1 which was working before with the latest plugins installed - same issue. 

      The exception:

      java.lang.NoSuchMethodError: 'boolean org.kohsuke.groovy.sandbox.SandboxTransformer.mightBePositionalArgumentConstructor(org.codehaus.groovy.ast.expr.VariableExpression)'
          at com.cloudbees.groovy.cps.SandboxCpsTransformer.visitAssignmentOrCast(SandboxCpsTransformer.java:93)
          at com.cloudbees.groovy.cps.CpsTransformer$42.run(CpsTransformer.java:1171)
          at com.cloudbees.groovy.cps.CpsTransformer.makeChildren(CpsTransformer.java:446)
          at com.cloudbees.groovy.cps.CpsTransformer.makeNode(CpsTransformer.java:409)
          at com.cloudbees.groovy.cps.CpsTransformer.visitDeclarationExpression(CpsTransformer.java:1164)
          at org.codehaus.groovy.ast.expr.DeclarationExpression.visit(DeclarationExpression.java:89)
          at com.cloudbees.groovy.cps.CpsTransformer.visit(CpsTransformer.java:357)
          at com.cloudbees.groovy.cps.CpsTransformer.visitExpressionStatement(CpsTransformer.java:589)
          at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
          at com.cloudbees.groovy.cps.CpsTransformer.visit(CpsTransformer.java:357)
          at com.cloudbees.groovy.cps.CpsTransformer.visit(CpsTransformer.java:363)
          at com.cloudbees.groovy.cps.CpsTransformer$5.run(CpsTransformer.java:515)
          at com.cloudbees.groovy.cps.CpsTransformer.makeChildren(CpsTransformer.java:446)
          at com.cloudbees.groovy.cps.CpsTransformer.makeNode(CpsTransformer.java:409)
          at com.cloudbees.groovy.cps.CpsTransformer.visitBlockStatement(CpsTransformer.java:512)
          at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
          at com.cloudbees.groovy.cps.CpsTransformer.visit(CpsTransformer.java:357)
          at com.cloudbees.groovy.cps.CpsTransformer$2.run(CpsTransformer.java:388)
          at com.cloudbees.groovy.cps.CpsTransformer.makeChildren(CpsTransformer.java:446)
          at com.cloudbees.groovy.cps.CpsTransformer.makeNode(CpsTransformer.java:409)
          at com.cloudbees.groovy.cps.CpsTransformer.visitWithSafepoint(CpsTransformer.java:374)
          at com.cloudbees.groovy.cps.CpsTransformer.visitMethod(CpsTransformer.java:231)
          at com.cloudbees.groovy.cps.SandboxCpsTransformer.visitMethod(SandboxCpsTransformer.java:73)
          at com.cloudbees.groovy.cps.CpsTransformer.call(CpsTransformer.java:136)
          at com.cloudbees.groovy.cps.SandboxCpsTransformer.call(SandboxCpsTransformer.java:29)
          at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1087)
          at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:624)
          at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:602)
          at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:579)
          at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:323)
          at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:293)
          at groovy.lang.GroovyShell.parseClass(GroovyShell.java:677)
          at groovy.lang.GroovyShell.parse(GroovyShell.java:689)
          at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:142)
          at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:127)
          at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:572)
          at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:524)
          at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:334)
          at hudson.model.ResourceController.execute(ResourceController.java:101)
          at hudson.model.Executor.run(Executor.java:442)

      GitHub has been notified of this commit's build result

      Finished: FAILURE

          [JENKINS-71003] java.lang.NoSuchMethodError mightBePositionalArgumentConstructor

          Michael created issue -
          Michael made changes -
          Priority Original: Minor [ 4 ] New: Critical [ 2 ]

          Mark Waite added a comment -

          I suspect there is an error in your scripted Pipeline syntax rather than a bug in a plugin. Double check your syntax

          Mark Waite added a comment - I suspect there is an error in your scripted Pipeline syntax rather than a bug in a plugin. Double check your syntax

          Michael added a comment - - edited

          My upgrade script uses the jenkins cli to upgrade all of the plugins. Then it restarts into quiet mode so no new builds are triggered on the new instances until we have a chance to verify it's working properly. Here is the snippet:

          # quiet down so no jobs build...
          eval "$JENKINS_CLI quiet-down"
          
          UPDATE_LIST=$(eval "$JENKINS_CLI list-plugins " | grep -e ')$' | awk '\{ print $1 }' | tr '\n' ' ')
          if [ ! -z "$UPDATE_LIST" ]; then
            echo "Updating Jenkins Plugins: $UPDATE_LIST"
            eval "$JENKINS_CLI install-plugin $UPDATE_LIST"
            eval "$JENKINS_CLI safe-restart"
            eval "$JENKINS_CLI quiet-down" || true
          fi
          

          ...I'm noticing a 503 error on the quiet-down call (that wasn't there before) and when I go to the plugin manager it appears that the updates to the plugins were not applied, and a restart is pending. I will update this again when I have a chance to retry it and capture the log messages.
           

          Michael added a comment - - edited My upgrade script uses the jenkins cli to upgrade all of the plugins. Then it restarts into quiet mode so no new builds are triggered on the new instances until we have a chance to verify it's working properly. Here is the snippet: # quiet down so no jobs build... eval "$JENKINS_CLI quiet-down" UPDATE_LIST=$(eval "$JENKINS_CLI list-plugins " | grep -e ')$' | awk '\{ print $1 }' | tr '\n' ' ') if [ ! -z "$UPDATE_LIST" ]; then echo "Updating Jenkins Plugins: $UPDATE_LIST" eval "$JENKINS_CLI install-plugin $UPDATE_LIST" eval "$JENKINS_CLI safe-restart" eval "$JENKINS_CLI quiet-down" || true fi ...I'm noticing a 503 error on the quiet-down call (that wasn't there before) and when I go to the plugin manager it appears that the updates to the plugins were not applied, and a restart is pending. I will update this again when I have a chance to retry it and capture the log messages.  

          Devin Nusbaum added a comment -

          This should only happen if you upgrade script-security to a version that includes this security fix but do not update workflow-cps at the same time (see the warning message at the bottom of that section). Make sure both plugins are updated to at least the versions described on that page.

          Devin Nusbaum added a comment - This should only happen if you upgrade script-security to a version that includes this security fix but do not update workflow-cps at the same time (see the warning message at the bottom of that section). Make sure both plugins are updated to at least the versions described on that page.
          Michael made changes -
          Attachment New: screenshot-1.png [ 60244 ]
          Michael made changes -
          Attachment New: screenshot-2.png [ 60245 ]
          Michael made changes -
          Comment [ More detail:

          FAILING ON FIRST STARTUP AFTER UPGRADE...
          (this used to pass without any error messages)

          + systemctl daemon-reload
          + systemctl stop jenkins
          + systemctl start jenkins
          Job for jenkins.service failed because a timeout was exceeded.
          See "systemctl status jenkins.service" and "journalctl -xeu jenkins.service" for details.

          ...PLUGINS ARE UPDATED USING CLI...

          Installing pipeline-milestone-step from update center
          Installing git-client from update center
          Installing ws-cleanup from update center

          ..FAILS AGAIN ON RESTART/QUIETDOWN...
          (this also used to pass without any error messages)

          + eval 'java -jar ~ec2-user/jenkins-cli.jar -s [http://localhost:8080/] -auth devopsadmin:119b5e71661f7d36423a8fff4f53786984 safe-restart'
          ++ java -jar /home/ec2-user/jenkins-cli.jar -s [http://localhost:8080/] -auth devopsadmin:119b5e71661f7d36423a8fff4f53786984 safe-restart
          + eval 'java -jar ~ec2-user/jenkins-cli.jar -s [http://localhost:8080/] -auth devopsadmin:119b5e71661f7d36423a8fff4f53786984 quiet-down'
          ++ java -jar /home/ec2-user/jenkins-cli.jar -s [http://localhost:8080/] -auth devopsadmin:119b5e71661f7d36423a8fff4f53786984 quiet-down
          java.io.IOException: Server returned HTTP response code: 503 for URL: [http://localhost:8080/cli?remoting=false]
          at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1997)
          at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1589)
          at hudson.cli.FullDuplexHttpStream.<init>(FullDuplexHttpStream.java:73)
          at hudson.cli.CLI.plainHttpConnection(CLI.java:392)
          at hudson.cli.CLI._main(CLI.java:321)
          at hudson.cli.CLI.main(CLI.java:103)

          ...CAN VISIT IN BROWSER...

          [^screenshot-1.png]

          In the browser none of the updates are applied. I can select them all and perform the plugin upgrades in the management screen and it works, so the issue is just one that is popping up trying to use the CLI jar. Those CLI updates were working and now they are not. ]
          Michael made changes -
          Attachment Original: screenshot-1.png [ 60244 ]
          Michael made changes -
          Attachment Original: screenshot-2.png [ 60245 ]

            Unassigned Unassigned
            mkelandis Michael
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: