[JIRA] (JENKINS-42720) ConcurrentModificationException when serializing LockableResourcesManager

6 views
Skip to first unread message

stefan.thurnherr@gmail.com (JIRA)

unread,
Mar 13, 2017, 11:37:02 AM3/13/17
to jenkinsc...@googlegroups.com
Stefan Thurnherr created an issue
 
Jenkins / Bug JENKINS-42720
ConcurrentModificationException when serializing LockableResourcesManager
Issue Type: Bug Bug
Assignee: Unassigned
Components: lockable-resources-plugin
Created: 2017/Mar/13 3:36 PM
Environment: Jenkins v2.47
latest pipeline plugins
latest lockable-resources-plugin
Priority: Minor Minor
Reporter: Stefan Thurnherr

Not fully serializable. This occurred in one of our multi-branch pipeline builds, all previous/subsequent builds went fine.

java.lang.RuntimeException: Failed to serialize org.jenkins.plugins.lockableresources.LockableResourcesManager#queuedContexts for class org.jenkins.plugins.lockableresources.LockableResourcesManager
	at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:256)
	at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:224)
	at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:138)
	at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:209)
	at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:150)
	at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
	at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
	at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
	at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:82)
	at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:37)
	at com.thoughtworks.xstream.XStream.marshal(XStream.java:1026)
	at com.thoughtworks.xstream.XStream.marshal(XStream.java:1015)
	at com.thoughtworks.xstream.XStream.toXML(XStream.java:988)
	at hudson.XmlFile.write(XmlFile.java:170)
	at hudson.model.Descriptor.save(Descriptor.java:871)
	at org.jenkins.plugins.lockableresources.LockableResourcesManager.unlockNames(LockableResourcesManager.java:361)
	at org.jenkins.plugins.lockableresources.LockStepExecution$Callback.finished(LockStepExecution.java:84)
	at org.jenkinsci.plugins.workflow.steps.BodyExecutionCallback$TailCall.onSuccess(BodyExecutionCallback.java:114)
	at org.jenkinsci.plugins.workflow.cps.CpsBodyExecution$SuccessAdapter.receive(CpsBodyExecution.java:362)
	at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:60)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
	at sun.reflect.GeneratedMethodAccessor274.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
	at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
	at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
	at sun.reflect.GeneratedMethodAccessor273.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
	at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
	at com.cloudbees.groovy.cps.Next.step(Next.java:74)
	at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:154)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:33)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:30)
	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:30)
	at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:165)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:328)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:80)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:240)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:228)
	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.ConcurrentModificationException
	at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901)
	at java.util.ArrayList$Itr.next(ArrayList.java:851)
	at com.thoughtworks.xstream.converters.collections.CollectionConverter.marshal(CollectionConverter.java:73)
	at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
	at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
	at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
	at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:265)
	at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:252)
	... 53 more
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo

stefan.thurnherr@gmail.com (JIRA)

unread,
Mar 13, 2017, 11:44:02 AM3/13/17
to jenkinsc...@googlegroups.com
Stefan Thurnherr updated an issue
Change By: Stefan Thurnherr
Not fully serializable. This occurred in one of our multi-branch pipeline builds, all previous/subsequent builds went fine.

{code}
{code}

our Jenkinsfiel looks basically like this:

{code}
    timestamps {
        node {
            stage('Prepare workspace') {
                properties(...) // set up git connection properties
                checkout scm
                String jdkHome = "${tool name: 'jdk8', type: 'hudson.model.JDK'}"
                env.PATH = "${jdkHome}/bin:${env.PATH}"
            }
            
            mainBuildStages()
            milestone(label: 'MainBuild-Done')
        }
    
        stage('Integration testing') {
            lock(resource: 'integrationTestsLock', inversePrecedence: true) {
                integrationTestsStage()
                milestone(label:'IntegrationTests-Done')
            }
        }
    }

def mainBuildStages() {
    // run main build using mvn
}

def integrationTestsStage() {
    def pipelineRunBranches = [:]
    
    pipelineRunBranches['itests-withEmptyDatabase'] = {
        node {
            // unstash and run itests using mvn
        }
    }

    pipelineRunBranches['itests-withPopulatedDatabase'] = {
        node {
           // unstash and run other itests using mvn
        }
    }

    parallel pipelineRunBranches
}
{code}

stefan.thurnherr@gmail.com (JIRA)

unread,
Mar 13, 2017, 11:46:01 AM3/13/17
to jenkinsc...@googlegroups.com


The error occurred at the very end, just before the pipeline was done:
{code}
[....]
[Pipeline] // parallel
[Pipeline] milestone (IntegrationTests-Done)
16:25:48 Trying to pass milestone 1
[Pipeline] }
[Pipeline] // lock
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // timestamps
--> here the exception occurred
{code}

stefan.thurnherr@gmail.com (JIRA)

unread,
Mar 13, 2017, 11:47:02 AM3/13/17
to jenkinsc...@googlegroups.com
try {
    timestamps {
        node {
            stage('Prepare workspace') {
                properties(...) // set up git connection properties
                checkout scm
                String jdkHome = "${tool name: 'jdk8', type: 'hudson.model.JDK'}"
                env.PATH = "${jdkHome}/bin:${env.PATH}"
            }
            
            mainBuildStages()
            milestone(label: 'MainBuild-Done')
        }
    
        stage('Integration testing') {
            lock(resource: 'integrationTestsLock', inversePrecedence: true) {
                integrationTestsStage()
                milestone(label:'IntegrationTests-Done')
            }
        }
    }
} catch (err) {
    // email notifications etc
    throw err
}

stefan.thurnherr@gmail.com (JIRA)

unread,
Mar 13, 2017, 11:49:01 AM3/13/17
to jenkinsc...@googlegroups.com
Stefan Thurnherr updated an issue
Change By: Stefan Thurnherr
Environment:
Jenkins v2.47
latest pipeline plugins
latest lockable-resources-plugin v1.11.1

cosbug@gmail.com (JIRA)

unread,
Feb 16, 2019, 5:19:02 AM2/16/19
to jenkinsc...@googlegroups.com
Constantin Bugneac commented on Bug JENKINS-42720
 
Re: ConcurrentModificationException when serializing LockableResourcesManager

experiencing the same issue, are there any workarounds meanwhile ?

This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

tobias-jenkins@23.gs (JIRA)

unread,
Oct 12, 2019, 11:21:03 AM10/12/19
to jenkinsc...@googlegroups.com

I suspect this was about the same issue as JENKINS-44597, which was fixed in release 2.1 - If you see similar issues, please open a new issue with new evidence.

This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

tobias-jenkins@23.gs (JIRA)

unread,
Oct 12, 2019, 11:21:03 AM10/12/19
to jenkinsc...@googlegroups.com
Tobias Gruetzmacher resolved as Fixed
Change By: Tobias Gruetzmacher
Status: Open Resolved
Resolution: Fixed
Released As: lockable-resources 2.1

stefan.thurnherr@gmail.com (JIRA)

unread,
Oct 18, 2019, 3:11:04 PM10/18/19
to jenkinsc...@googlegroups.com

stefan.thurnherr@gmail.com (JIRA)

unread,
Oct 18, 2019, 3:11:06 PM10/18/19
to jenkinsc...@googlegroups.com

Yes thanks, I confirm that this is solved, I haven't seen this issue in the last months. So closing this issue.

Reply all
Reply to author
Forward
0 new messages