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

MavenBuild$ProxyImpl.setResult illegally called after build is COMPLETED

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • maven-plugin
    • Jenkins 1.587

      This one seems to be rather tricky.

      After upgrade to 1.587, I saw this exception during the the run of the sonar plugin in a post step:

      20:19:33 Warte bis Jenkins die Datensammlung abgeschlossen hat
      20:19:33 [ERROR] Internal error: java.lang.IllegalStateException: cannot change build result while in COMPLETED -> [Help 1]
      20:19:33 org.apache.maven.InternalErrorException: Internal error: java.lang.IllegalStateException: cannot change build result while in COMPLETED
      20:19:33 	at org.apache.maven.lifecycle.internal.BuilderCommon.handleBuildError(BuilderCommon.java:128)
      20:19:33 	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:95)
      20:19:33 	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
      20:19:33 	at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
      20:19:33 	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
      20:19:33 	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
      20:19:33 	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
      20:19:33 	at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:117)
      20:19:33 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      20:19:33 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      20:19:33 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      20:19:33 	at java.lang.reflect.Method.invoke(Method.java:597)
      20:19:33 	at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)
      20:19:33 	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
      20:19:33 	at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:178)
      20:19:33 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      20:19:33 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      20:19:33 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      20:19:33 	at java.lang.reflect.Method.invoke(Method.java:597)
      20:19:33 	at hudson.maven.Maven3Builder.call(Maven3Builder.java:136)
      20:19:33 	at hudson.maven.Maven3Builder.call(Maven3Builder.java:71)
      20:19:33 	at hudson.remoting.UserRequest.perform(UserRequest.java:121)
      20:19:33 	at hudson.remoting.UserRequest.perform(UserRequest.java:49)
      20:19:33 	at hudson.remoting.Request$2.run(Request.java:324)
      20:19:33 	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
      20:19:33 	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      20:19:33 	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      20:19:33 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
      20:19:33 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
      20:19:33 	at java.lang.Thread.run(Thread.java:662)
      20:19:33 Caused by: java.lang.IllegalStateException: cannot change build result while in COMPLETED
      20:19:33 	at hudson.model.Run.setResult(Run.java:458)
      20:19:33 	at hudson.maven.MavenBuild$ProxyImpl.setResult(MavenBuild.java:494)
      20:19:33 	at hudson.maven.MavenBuild$ProxyImpl2.setResult(MavenBuild.java:547)
      20:19:33 	at sun.reflect.GeneratedMethodAccessor318.invoke(Unknown Source)
      20:19:33 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      20:19:33 	at java.lang.reflect.Method.invoke(Method.java:483)
      20:19:33 	at hudson.model.Executor$1.call(Executor.java:579)
      20:19:33 	at hudson.util.InterceptingProxy$1.invoke(InterceptingProxy.java:23)
      20:19:33 	at com.sun.proxy.$Proxy91.setResult(Unknown Source)
      20:19:33 	at sun.reflect.GeneratedMethodAccessor318.invoke(Unknown Source)
      20:19:33 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      20:19:33 	at java.lang.reflect.Method.invoke(Method.java:483)
      20:19:33 	at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:320)
      20:19:33 	at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:295)
      20:19:33 	at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:254)
      20:19:33 	at hudson.remoting.UserRequest.perform(UserRequest.java:121)
      20:19:33 	at hudson.remoting.UserRequest.perform(UserRequest.java:49)
      20:19:33 	at hudson.remoting.Request$2.run(Request.java:324)
      20:19:33 	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
      20:19:33 	at org.jenkinsci.remoting.CallableDecorator.call(CallableDecorator.java:18)
      20:19:33 	at hudson.remoting.CallableDecoratorList$1.call(CallableDecoratorList.java:21)
      20:19:33 	at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
      20:19:33 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      20:19:33 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      20:19:33 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      20:19:33 	at java.lang.Thread.run(Thread.java:745)
      20:19:33 	at ......remote call to channel(Native Method)
      20:19:33 	at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1356)
      20:19:33 	at hudson.remoting.UserResponse.retrieve(UserRequest.java:221)
      20:19:33 	at hudson.remoting.Channel.call(Channel.java:752)
      20:19:33 	at hudson.remoting.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:173)
      20:19:33 	at com.sun.proxy.$Proxy7.setResult(Unknown Source)
      20:19:33 	at hudson.maven.MavenBuildProxy$Filter.setResult(MavenBuildProxy.java:235)
      20:19:33 	at hudson.maven.Maven3Builder$MavenExecutionListener.recordProjectEnded(Maven3Builder.java:554)
      20:19:33 	at hudson.maven.Maven3Builder$MavenExecutionListener.projectSucceeded(Maven3Builder.java:538)
      20:19:33 	at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:74)
      20:19:33 	at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:42)
      20:19:33 	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:91)
      20:19:33 	... 28 more
      

      A also found mentions of similar behaviour here: https://groups.google.com/forum/#!topic/jenkinsci-users/jrkAQyq6jLs

      Downgrading to 1.583 did work for me.

      Somehow, the State of the run seems to be changed to COMPLETED before the actual build is finished.

      I think the reason for this to show up only now lies here: https://github.com/jenkinsci/jenkins/commit/28dfd90d2d6ae99c57eb174871c46f4e07e303ba#diff-c4f9931d88bca347279b881007d71f0eL445

      Earlier, since asserts are disabled by default, it never presented a problem until this change.

          [JENKINS-25406] MavenBuild$ProxyImpl.setResult illegally called after build is COMPLETED

          Daniel Beck added a comment -

          I don't see how core is involved. Sure, it's change caused this in a way, but it appears to be plugins misbehaving.

          Adding maven plugin as it appears to be a project of that type. Unfortunately, the issue report doesn't say.

          Reducing priority. There's a reason we default to Minor, and it's not so everything is made Critical or Blocker.

          Could you explain how this issue can be reproduced, preferably when building sample code or an open source project? Faulty configuration? Only happens when using Sonar Plugin + Violations Plugin? Both? Either? Which versions of these plugins?

          Daniel Beck added a comment - I don't see how core is involved. Sure, it's change caused this in a way, but it appears to be plugins misbehaving. Adding maven plugin as it appears to be a project of that type. Unfortunately, the issue report doesn't say. Reducing priority. There's a reason we default to Minor, and it's not so everything is made Critical or Blocker. Could you explain how this issue can be reproduced, preferably when building sample code or an open source project? Faulty configuration? Only happens when using Sonar Plugin + Violations Plugin? Both? Either? Which versions of these plugins?

          Robert Hook added a comment -

          I've experienced the same problem - I upgraded from 1.583 to 1.590, and updated all plugins, and now all of my maven based builds are failing in this fashion. I am invoking sonar via maven

          install findbugs:check checkstyle:checkstyle javadoc:javadoc sonar:sonar
          

          note that I am not using the sonar jenkins plugin, this is coming from Maven.

          I can definitely confirm that all jobs were not failing with this prior to updating to 1.590

          Robert Hook added a comment - I've experienced the same problem - I upgraded from 1.583 to 1.590, and updated all plugins, and now all of my maven based builds are failing in this fashion. I am invoking sonar via maven install findbugs:check checkstyle:checkstyle javadoc:javadoc sonar:sonar note that I am not using the sonar jenkins plugin, this is coming from Maven. I can definitely confirm that all jobs were not failing with this prior to updating to 1.590

          Jesse Glick added a comment -

          Seems like a bug in the Maven plugin. Not sure why it was trying to set the result of a completed build. If it really needs to do so for some special reason, it should use the protected Result result field by special permission of the MavenBuild.

          Jesse Glick added a comment - Seems like a bug in the Maven plugin. Not sure why it was trying to set the result of a completed build. If it really needs to do so for some special reason, it should use the protected Result result field by special permission of the MavenBuild .

          Jesse Glick added a comment -

          Note that functional tests will run with assertions enabled, so it seems likely that this bug is only triggered under some condition that is not covered by the existing tests.

          Jesse Glick added a comment - Note that functional tests will run with assertions enabled, so it seems likely that this bug is only triggered under some condition that is not covered by the existing tests.

          Code changed in jenkins
          User: Mirko Friedenhagen
          Path:
          src/main/java/hudson/plugins/violations/ViolationsReport.java
          http://jenkins-ci.org/commit/violations-plugin/677dc8981b161f11368db8aebe4d94473ae6f757
          Log:
          Use reflection to access protected field result from the build, see JENKINS-25406 as well.

          As of https://github.com/jenkinsci/jenkins/commit/28dfd90d2d6ae99c57eb174871c46f4e07e303ba#diff-c4f9931d88bca347279b881007d71f0eL445
          the field may not be set anymore directly when the build already was completed.
          TODO: the summary still thinks the build was a SUCCESS.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Mirko Friedenhagen Path: src/main/java/hudson/plugins/violations/ViolationsReport.java http://jenkins-ci.org/commit/violations-plugin/677dc8981b161f11368db8aebe4d94473ae6f757 Log: Use reflection to access protected field result from the build, see JENKINS-25406 as well. As of https://github.com/jenkinsci/jenkins/commit/28dfd90d2d6ae99c57eb174871c46f4e07e303ba#diff-c4f9931d88bca347279b881007d71f0eL445 the field may not be set anymore directly when the build already was completed. TODO: the summary still thinks the build was a SUCCESS.

          Robert Hook added a comment -

          Still broken as at 1.599

          Robert Hook added a comment - Still broken as at 1.599

          dan russell added a comment - - edited

          We just upgraded to 1.596 and have the same issue on a native maven build using sonar "clean install sonar:sonar -P sonar"

          jenkins 1.596
          Sonar Plugin 2.1
          maven project plugin 2.3 same result on updating plugin to 2.8

          4:32:54 Waiting for Jenkins to finish collecting data
          14:32:54 [ERROR] Internal error: java.lang.IllegalStateException: cannot change build result while in COMPLETED -> [Help 1]
          14:32:54 org.apache.maven.InternalErrorException: Internal error: java.lang.IllegalStateException: cannot change build result while in COMPLETED

          dan russell added a comment - - edited We just upgraded to 1.596 and have the same issue on a native maven build using sonar "clean install sonar:sonar -P sonar" jenkins 1.596 Sonar Plugin 2.1 maven project plugin 2.3 same result on updating plugin to 2.8 4:32:54 Waiting for Jenkins to finish collecting data 14:32:54 [ERROR] Internal error: java.lang.IllegalStateException: cannot change build result while in COMPLETED -> [Help 1] 14:32:54 org.apache.maven.InternalErrorException: Internal error: java.lang.IllegalStateException: cannot change build result while in COMPLETED

          Kevin Cross added a comment -

          We have just upgraded to Jenkins 1.596.2 with Maven plugin 2.9 and we are seeing the same problem.

          In tests it seems that we only get the problem when maven "sonar:sonar" goal is being run from a maven job type (the job xml root element is "maven2-moduleset"). When we run the same maven goals from a Freestyle job (the job xml root element is "project") we do not see the issue.

          Kevin Cross added a comment - We have just upgraded to Jenkins 1.596.2 with Maven plugin 2.9 and we are seeing the same problem. In tests it seems that we only get the problem when maven "sonar:sonar" goal is being run from a maven job type (the job xml root element is "maven2-moduleset"). When we run the same maven goals from a Freestyle job (the job xml root element is "project") we do not see the issue.

          Jesse Glick added a comment -

          kevinhcross well the affected code is in the Maven plugin, so certainly freestyle projects would be immune. Generally speaking I would recommend avoiding this plugin unless you are relying on one of its currently irreplaceable features, such as snapshot triggers.

          Jesse Glick added a comment - kevinhcross well the affected code is in the Maven plugin, so certainly freestyle projects would be immune. Generally speaking I would recommend avoiding this plugin unless you are relying on one of its currently irreplaceable features, such as snapshot triggers.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/main/java/hudson/maven/MavenBuild.java
          http://jenkins-ci.org/commit/maven-plugin/9ff0c92f0061108e9d9be89490953580df7360a7
          Log:
          JENKINS-25406 Still a bug somewhere, but downgrade to a warning in the log until it can be diagnosed and fixed properly.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/hudson/maven/MavenBuild.java http://jenkins-ci.org/commit/maven-plugin/9ff0c92f0061108e9d9be89490953580df7360a7 Log: JENKINS-25406 Still a bug somewhere, but downgrade to a warning in the log until it can be diagnosed and fixed properly.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/main/java/hudson/maven/MavenBuild.java
          http://jenkins-ci.org/commit/maven-plugin/f32d1924477e9a5eb34b013d6a9815f4a53d0e0b
          Log:
          Merge pull request #40 from jglick/setResult-JENKINS-25406

          JENKINS-25406 Downgrade ISE to log warning

          Compare: https://github.com/jenkinsci/maven-plugin/compare/21dc73c7f3a7...f32d1924477e

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/hudson/maven/MavenBuild.java http://jenkins-ci.org/commit/maven-plugin/f32d1924477e9a5eb34b013d6a9815f4a53d0e0b Log: Merge pull request #40 from jglick/setResult- JENKINS-25406 JENKINS-25406 Downgrade ISE to log warning Compare: https://github.com/jenkinsci/maven-plugin/compare/21dc73c7f3a7...f32d1924477e

          martinro added a comment -

          Similar problem here with Jenkins ver. 1.609.1 mit Maven builds and violations are checked (and the violation limits are exceeded).
          Maven integration plugin 2.10
          Violation plugin 0.7.11

          ERROR: Processing failed due to a bug in the code. Please report this to jenkinsci-users@googlegroups.com
          java.lang.IllegalStateException: cannot change build result while in COMPLETED
          at hudson.model.Run.setResult(Run.java:462)
          at hudson.plugins.violations.ViolationsReport.setBuildResult(ViolationsReport.java:542)
          at hudson.plugins.violations.hudson.maven.ViolationsMavenReporter.end(ViolationsMavenReporter.java:100)
          at hudson.maven.AbstractMavenBuilder.end(AbstractMavenBuilder.java:104)
          at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:865)
          at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:536)
          at hudson.model.Run.execute(Run.java:1741)
          at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:537)
          at hudson.model.ResourceController.execute(ResourceController.java:98)
          at hudson.model.Executor.run(Executor.java:374)

          martinro added a comment - Similar problem here with Jenkins ver. 1.609.1 mit Maven builds and violations are checked (and the violation limits are exceeded). Maven integration plugin 2.10 Violation plugin 0.7.11 ERROR: Processing failed due to a bug in the code. Please report this to jenkinsci-users@googlegroups.com java.lang.IllegalStateException: cannot change build result while in COMPLETED at hudson.model.Run.setResult(Run.java:462) at hudson.plugins.violations.ViolationsReport.setBuildResult(ViolationsReport.java:542) at hudson.plugins.violations.hudson.maven.ViolationsMavenReporter.end(ViolationsMavenReporter.java:100) at hudson.maven.AbstractMavenBuilder.end(AbstractMavenBuilder.java:104) at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:865) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:536) at hudson.model.Run.execute(Run.java:1741) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:537) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:374)

          Daniel Beck added a comment -

          martinro Please file a new issue against violations plugin.

          Daniel Beck added a comment - martinro Please file a new issue against violations plugin.

          Jesse Glick added a comment -

          Right, that is a distinct bug, since it is not coming from MavenBuild$ProxyImpl.setResult.

          Jesse Glick added a comment - Right, that is a distinct bug, since it is not coming from MavenBuild$ProxyImpl.setResult .

          martinro added a comment -

          Filed a new issue ~JENKINS-28880

          martinro added a comment - Filed a new issue ~ JENKINS-28880

          Rene de Gek added a comment -

          I have been running into this error. I have the feeling that is related to the parallel build option. (job config - build - advanced)

          Does that make any sense?
          Do other people have this option enabled? If yes...

          Rene de Gek added a comment - I have been running into this error. I have the feeling that is related to the parallel build option. (job config - build - advanced) Does that make any sense? Do other people have this option enabled? If yes...

            Unassigned Unassigned
            paux Stephan Pauxberger
            Votes:
            17 Vote for this issue
            Watchers:
            27 Start watching this issue

              Created:
              Updated: