Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove usages of Guice #72

Merged
merged 3 commits into from
Jan 6, 2022
Merged

Remove usages of Guice #72

merged 3 commits into from
Jan 6, 2022

Conversation

basil
Copy link
Member

@basil basil commented Jan 4, 2022

Experimenting with removing deprecated usages of Guice. In its current form, BuildTriggerStepTest#storedForm fails, so this PR is not ready for merge. The error is:

Stack trace
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 5.58 s <<< FAILURE! - in org.jenkinsci.plugins.workflow.support.steps.build.BuildTriggerStepTest
[ERROR] org.jenkinsci.plugins.workflow.support.steps.build.BuildTriggerStepTest.storedForm  Time elapsed: 5.525 s  <<< FAILURE!
java.lang.AssertionError: 
unexpected build status; build log was:
------
Started by user unknown or anonymous
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] build
Scheduling project: ds
Starting building: ds #1
Resuming build at Mon Jan 03 16:36:18 PST 2022 after Jenkins restart
[Pipeline] End of Pipeline
an exception which occurred:
        in field org.jenkinsci.plugins.workflow.cps.CpsThread.step
        in object org.jenkinsci.plugins.workflow.cps.CpsThread@6f8622c1
        in object of type org.jenkinsci.plugins.workflow.cps.CpsThread
        in object of type java.util.TreeMap
        in field org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.threads
        in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@74c3e926
        in object of type org.jenkinsci.plugins.workflow.cps.CpsThreadGroup
Caused: java.io.InvalidClassException: org.jenkinsci.plugins.workflow.support.steps.build.BuildTriggerStepExecution; Class does not extend stream superclass
        at org.jboss.marshalling.river.RiverUnmarshaller.doReadClassDescriptor(RiverUnmarshaller.java:1046)
        at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1355)
        at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:272)
        at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:220)
        at org.jboss.marshalling.river.RiverUnmarshaller.readFields(RiverUnmarshaller.java:1853)
        at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1767)
        at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1395)
        at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:272)
        at org.jboss.marshalling.river.BlockUnmarshaller.readObject(BlockUnmarshaller.java:149)
        at org.jboss.marshalling.river.BlockUnmarshaller.readObject(BlockUnmarshaller.java:135)
        at org.jboss.marshalling.MarshallerObjectInputStream.readObjectOverride(MarshallerObjectInputStream.java:53)
        at org.jboss.marshalling.river.RiverObjectInputStream.readObjectOverride(RiverObjectInputStream.java:307)
        at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:484)
        at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:451)
        at java.base/java.util.TreeMap.buildFromSorted(TreeMap.java:2563)
        at java.base/java.util.TreeMap.buildFromSorted(TreeMap.java:2503)
        at java.base/java.util.TreeMap.readObject(TreeMap.java:2450)
        at org.jboss.marshalling.reflect.JDKSpecific$SerMethods.callReadObject(JDKSpecific.java:100)
        at org.jboss.marshalling.reflect.SerializableClass.callReadObject(SerializableClass.java:212)
        at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1746)
        at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1395)
        at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:272)
        at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:220)
        at org.jboss.marshalling.river.RiverUnmarshaller.readFields(RiverUnmarshaller.java:1853)
        at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1767)
        at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1395)
        at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:272)
        at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:205)
        at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:41)
        at org.jenkinsci.plugins.workflow.support.pickles.serialization.RiverReader$SandboxedUnmarshaller.lambda$readObject$0(RiverReader.java:250)
        at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:237)
        at org.jenkinsci.plugins.workflow.support.pickles.serialization.RiverReader$SandboxedUnmarshaller.sandbox(RiverReader.java:237)
        at org.jenkinsci.plugins.workflow.support.pickles.serialization.RiverReader$SandboxedUnmarshaller.readObject(RiverReader.java:250)
        at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution$2.onSuccess(CpsFlowExecution.java:793)
        at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution$2.onSuccess(CpsFlowExecution.java:786)
        at org.jenkinsci.plugins.workflow.support.concurrent.Futures$1.run(Futures.java:153)
        at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:253)
        at com.google.common.util.concurrent.ExecutionList$RunnableExecutorPair.execute(ExecutionList.java:149)
        at com.google.common.util.concurrent.ExecutionList.add(ExecutionList.java:105)
        at com.google.common.util.concurrent.AbstractFuture.addListener(AbstractFuture.java:155)
        at org.jenkinsci.plugins.workflow.support.concurrent.Futures.addCallback(Futures.java:163)
        at org.jenkinsci.plugins.workflow.support.concurrent.Futures.addCallback(Futures.java:93)
        at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.loadProgramAsync(CpsFlowExecution.java:783)
        at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.onLoad(CpsFlowExecution.java:750)
        at org.jenkinsci.plugins.workflow.job.WorkflowRun.getExecution(WorkflowRun.java:691)
        at org.jenkinsci.plugins.workflow.job.WorkflowRun.onLoad(WorkflowRun.java:550)
        at hudson.model.RunMap.retrieve(RunMap.java:225)
        at hudson.model.RunMap.retrieve(RunMap.java:57)
        at jenkins.model.lazy.AbstractLazyLoadRunMap.load(AbstractLazyLoadRunMap.java:501)
        at jenkins.model.lazy.AbstractLazyLoadRunMap.load(AbstractLazyLoadRunMap.java:483)
        at jenkins.model.lazy.AbstractLazyLoadRunMap.getByNumber(AbstractLazyLoadRunMap.java:381)
        at hudson.model.RunMap.getById(RunMap.java:205)
        at org.jenkinsci.plugins.workflow.job.WorkflowRun$Owner.run(WorkflowRun.java:940)
        at org.jenkinsci.plugins.workflow.job.WorkflowRun$Owner.get(WorkflowRun.java:951)
        at org.jenkinsci.plugins.workflow.flow.FlowExecutionList$1.computeNext(FlowExecutionList.java:65)
        at org.jenkinsci.plugins.workflow.flow.FlowExecutionList$1.computeNext(FlowExecutionList.java:57)
        at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143)
        at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138)
        at org.jenkinsci.plugins.workflow.flow.FlowExecutionList$ItemListenerImpl.onLoaded(FlowExecutionList.java:178)
        at jenkins.model.Jenkins.(Jenkins.java:1019)
        at hudson.model.Hudson.(Hudson.java:85)
        at org.jvnet.hudson.test.JenkinsRule.newHudson(JenkinsRule.java:688)
        at org.jvnet.hudson.test.JenkinsRule.before(JenkinsRule.java:404)
        at org.jvnet.hudson.test.JenkinsRule$1.evaluate(JenkinsRule.java:595)
        at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:299)
        at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:293)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
Caused: java.io.IOException: Failed to load build state
        at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution$3.onSuccess(CpsFlowExecution.java:865)
        at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution$3.onSuccess(CpsFlowExecution.java:863)
        at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution$4$1.run(CpsFlowExecution.java:917)
        at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$1.run(CpsVmExecutorService.java:38)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
        at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
        at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)
Finished: FAILURE

Expected: is
but: was
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
at org.junit.Assert.assertThat(Assert.java:964)
at org.jvnet.hudson.test.JenkinsRule.assertBuildStatus(JenkinsRule.java:1439)
at org.jvnet.hudson.test.JenkinsRule.assertBuildStatusSuccess(JenkinsRule.java:1468)
at org.jenkinsci.plugins.workflow.support.steps.build.BuildTriggerStepTest.storedForm(BuildTriggerStepTest.java:518)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.jvnet.hudson.test.JenkinsRule$1.evaluate(JenkinsRule.java:601)
at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:299)
at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:293)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.lang.Thread.run(Thread.java:829)

Retaining AbstractStepImpl as in jenkinsci/workflow-step-api-plugin#81 does not chase the problem away (not that I expected it to, as in this case the AbstractStepExecutionImpl keeps a transient reference to its AbstractStepImpl). The stack trace indicates some deeper serialization issue with regard to program.dat which I have not yet tried to debug. The local data for this test was last updated in 2019 in #22, so it should be current/valid I think.

@@ -39,7 +46,7 @@
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;

public class BuildTriggerStep extends AbstractStepImpl {
public class BuildTriggerStep extends Step {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is fine because it was not Serializable to begin with.

basil and others added 2 commits January 4, 2022 07:41
…ld/BuildTriggerStepExecution.java

Co-authored-by: Jesse Glick <jglick@cloudbees.com>
@basil basil marked this pull request as ready for review January 4, 2022 15:44
@jglick jglick requested a review from car-roll January 4, 2022 16:29
@jglick jglick added the dependencies Pull requests that update a dependency file label Jan 6, 2022
@jglick jglick merged commit 22e6e05 into jenkinsci:master Jan 6, 2022
@basil basil deleted the guice branch January 6, 2022 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants