I think the problem is the implementation of FlowNode.getActions <https://github.com/jenkinsci/workflow-api-plugin/blob/cc1cb400f43f8478f0180a679e2fe470b1e089f0/src/main/java/org/jenkinsci/plugins/workflow/graph/FlowNode.java#L430> in workflow-api. The returned list probably needs to override the inherited implementation of `Collection.removeAll` for `Actionable.addOrReplaceAction` to work correctly.
>From a quick read I think the existing code only has issues if there is >already an action of the same type that needs to be replaced, which could >explain why the issue is infrequent. Devin > On Jan 8, 2021, at 12:11, Ullrich Hafner <[email protected]> wrote: > > Hi, > > I’m currently struggling with an exception in core that is caused by the > following code [1] in my plugin. I am setting the result of a pipeline step > if the quality gate fails: > > flowNode.addOrReplaceAction(new WarningAction(result).withMessage(message)); > > This call sometimes fails in core with: > > java.lang.UnsupportedOperationException > at > java.util.concurrent.CopyOnWriteArrayList$COWIterator.remove(CopyOnWriteArrayList.java:1182) > at java.util.AbstractCollection.removeAll(AbstractCollection.java:376) > at hudson.model.Actionable.addOrReplaceAction(Actionable.java:209) > at > io.jenkins.plugins.analysis.core.util.PipelineResultHandler.setResult(PipelineResultHandler.java:34) > > Is this a bug in core or am I using the API in a not supported way? (This > exception rarely occurs, however, at least 2 different people reported that > problem recently[2]). The affected code is in core for quite some years now > so I wonder why nobody has been hit by that problem before. > > [1] > https://github.com/jenkinsci/warnings-ng-plugin/blob/master/plugin/src/main/java/io/jenkins/plugins/analysis/core/util/PipelineResultHandler.java#L30 > > <https://github.com/jenkinsci/warnings-ng-plugin/blob/master/plugin/src/main/java/io/jenkins/plugins/analysis/core/util/PipelineResultHandler.java#L30> > [2] https://issues.jenkins.io/browse/JENKINS-64438 > <https://issues.jenkins.io/browse/JENKINS-64438> > > > -- > You received this message because you are subscribed to the Google Groups > "Jenkins Developers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jenkinsci-dev/DD7EB1C3-B0BE-4BC8-89AA-4A54DDB20980%40gmail.com > > <https://groups.google.com/d/msgid/jenkinsci-dev/DD7EB1C3-B0BE-4BC8-89AA-4A54DDB20980%40gmail.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "Jenkins Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/64BFB279-E37D-4946-A1E9-9AE689161C8C%40cloudbees.com.
