Skip to content

ConcurrentModificationException: Failed to serialize org.jenkinsci.plugins.githubautostatus.BuildStatusAction#buildStatuses #180

@jimklimov

Description

@jimklimov

Jenkins and plugins versions report

Part of https://issues.jenkins.io/browse/JENKINS-76294

Expected solution: similar to jenkinsci/lockable-resources-plugin#825

Visible problem: jobs occasionally crash when server (or other actions, like work with badges or lockable resources) decide to cause a WorkflowRun serialization, and the plugin changes underlying data at the wrong moment. As a clue, server and/or build logs then contain something like:

2025-10-22 05:06:05.328+0000 [id=75483] WARNING o.j.p.workflow.steps.scm.SCMStep#checkout
java.util.ConcurrentModificationException
        at java.base/java.util.HashMap$HashIterator.nextNode(HashMap.java:1605)
        at java.base/java.util.HashMap$EntryIterator.next(HashMap.java:1638)
        at java.base/java.util.HashMap$EntryIterator.next(HashMap.java:1636)
        at com.thoughtworks.xstream.converters.collections.MapConverter.marshal(MapConverter.java:76)
        at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
        at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:59)
        at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:83)
        at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:285)
        at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:272)
Caused: java.lang.RuntimeException: Failed to serialize org.jenkinsci.plugins.githubautostatus.BuildStatusAction#buildStatuses for class org.jenkinsci.plugins.githubautostatus.BuildStatusAction
        at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:276)
        at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:243)
        at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:174)
        at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:228)
        at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:165)
        at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
        at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:59)
        at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:44)
        at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:87)
        at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeBareItem(AbstractCollectionConverter.java:94)
        at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:66)
        at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeCompleteItem(AbstractCollectionConverter.java:81)
        at com.thoughtworks.xstream.converters.collections.CollectionConverter.marshal(CollectionConverter.java:75)
        at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
        at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:59)
        at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:83)
        at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:285)
        at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:272)
Caused: java.lang.RuntimeException: Failed to serialize hudson.model.Actionable#actions for class org.jenkinsci.plugins.workflow.job.WorkflowRun
        at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:276)
        at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:243)
        at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:174)
        at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:228)
        at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:165)
        at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
        at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:59)
        at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:44)
        at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:83)
        at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:37)
        at com.thoughtworks.xstream.XStream.marshal(XStream.java:1307)
        at com.thoughtworks.xstream.XStream.marshal(XStream.java:1296)
        at com.thoughtworks.xstream.XStream.toXML(XStream.java:1269)
        at hudson.util.XStream2.toXMLUTF8(XStream2.java:386)
        at PluginClassLoader for workflow-support//org.jenkinsci.plugins.workflow.support.PipelineIOUtils.writeByXStream(PipelineIOUtils.java:34)
        at PluginClassLoader for workflow-job//org.jenkinsci.plugins.workflow.job.WorkflowRun.save(WorkflowRun.java:1264)
        at hudson.util.PersistedList.onModified(PersistedList.java:190)
        at hudson.util.PersistedList._onModified(PersistedList.java:221)
        at hudson.util.PersistedList.add(PersistedList.java:82)
        at PluginClassLoader for workflow-job//org.jenkinsci.plugins.workflow.job.WorkflowRun.onCheckout(WorkflowRun.java:920)
        at PluginClassLoader for workflow-job//org.jenkinsci.plugins.workflow.job.WorkflowRun$SCMListenerImpl.onCheckout(WorkflowRun.java:1218)
        at PluginClassLoader for workflow-scm-step//org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:182)
        at PluginClassLoader for workflow-scm-step//org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:101)
        at PluginClassLoader for workflow-scm-step//org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:88)
        at PluginClassLoader for workflow-step-api//org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:49)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
        at java.base/java.lang.Thread.run(Thread.java:1583)

What Operating System are you using (both controller, and any agents involved in the problem)?

Jenkins LTS 2.528.1 and several before it
OpenIndiana, Linux

Reproduction steps

Probably involves jobs with a number of parallel stages, where each could do something that triggers a workflow save. Will try to conjure up a repro test case as part of work on the issue.

Expected Results

CME does not happen, noise is not logged, jobs do not crash.

Actual Results

Occasionally complex and long-running jobs are terminated due to no fault of the tested code (rather as part of exception handling with failed serialization).

Anything else?

No response

Are you interested in contributing a fix?

yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions