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

java.lang.UnsupportedOperationException in RecordIssuesStep

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Labels:
      None
    • Environment:
    • Similar Issues:
    • Released As:
      workflow-api 2.41

      Description

      While recording ideaInspection, we get the following exception:

      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)
      	at io.jenkins.plugins.analysis.core.steps.IssuesPublisher.attachAction(IssuesPublisher.java:120)
      	at io.jenkins.plugins.analysis.core.steps.IssuesRecorder.publishResult(IssuesRecorder.java:721)
      	at io.jenkins.plugins.analysis.core.steps.IssuesRecorder.record(IssuesRecorder.java:651)
      	at io.jenkins.plugins.analysis.core.steps.IssuesRecorder.perform(IssuesRecorder.java:617)
      	at io.jenkins.plugins.analysis.core.steps.RecordIssuesStep$Execution.run(RecordIssuesStep.java:1024)
      	at io.jenkins.plugins.analysis.core.steps.RecordIssuesStep$Execution.run(RecordIssuesStep.java:985)
      	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
      	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:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at java.lang.Thread.run(Thread.java:748)
      

      The pipeline code:

      recordIssues(
      	failOnError: true,
      	enabledForFailure: true,
      	ignoreFailedBuilds: false,
      	qualityGates: [[threshold: 1, type: 'TOTAL', unstable: true]],
      	tools: [
      		ideaInspection(pattern: 'idea-inspection-output/**'),
      	],
      )
      

      This is identical in all projects. It is not related to the specific inspection result itself, as long as a failing inspection is reported. Projects without inspection errors will be a success.

      Please find attached a minimal example. Disabling failOnError will make the sample running. The only errors I see in my logs are:

      [IntelliJ IDEA Inspections] [-ERROR-] Can't create fingerprints for some files:
      [IntelliJ IDEA Inspections] [-ERROR-] - '$PROJECT_DIR$/testsrc/com/example/ExampleTest.java', IO exception has been thrown: java.nio.file.NoSuchFileException: $PROJECT_DIR$/testsrc/com/example/ExampleTest.java
      

      I'm not sure if this is related to the exception, but even if this is handled as an error in the sense of failOnError, there should be no exception.

        Attachments

          Issue Links

            Activity

            Hide
            danielbeck Daniel Beck added a comment -

            This looks as if the CopyOnWriteArrayList did not implement removeAll and the fallback implementation using iterator fails (as documented, COWIterator#remove doesn't work).

            But that removeAll implementation in CopyOnWriteArrayList has been around forever…

            Show
            danielbeck Daniel Beck added a comment - This looks as if the  CopyOnWriteArrayList did not implement removeAll and the fallback implementation using iterator fails (as documented, COWIterator#remove doesn't work). But that removeAll implementation in CopyOnWriteArrayList has been around forever…
            Hide
            dnusbaum Devin Nusbaum added a comment -

            Replied on the mailing list as well, but I think the problem is that the implementation of FlowNode.getActions returns an anonymous implementation of AbstractList that needs to override removeAll for Actionable.addOrReplaceAction to work correctly when replacing an existing Action.

            Show
            dnusbaum Devin Nusbaum added a comment - Replied on the mailing list as well, but I think the problem is that the implementation of FlowNode.getActions returns an anonymous implementation of AbstractList that needs to override removeAll for Actionable.addOrReplaceAction to work correctly when replacing an existing Action .
            Hide
            drulli Ulli Hafner added a comment -

            Devin Nusbaum Thanks for spotting it! I'll add workflow-api as component here in Jira.

            Show
            drulli Ulli Hafner added a comment - Devin Nusbaum Thanks for spotting it! I'll add workflow-api as component here in Jira.
            Hide
            dnusbaum Devin Nusbaum added a comment -

            Fixed in https://github.com/jenkinsci/workflow-api-plugin/pull/133 by Bill Collins. Thanks! The fix has been merged but it has not yet been released.

            Show
            dnusbaum Devin Nusbaum added a comment - Fixed in https://github.com/jenkinsci/workflow-api-plugin/pull/133 by Bill Collins . Thanks! The fix has been merged but it has not yet been released.
            Hide
            dnusbaum Devin Nusbaum added a comment -

            This was fixed in Pipeline: API plugin version 2.41. Thanks Bill Collins!

            Show
            dnusbaum Devin Nusbaum added a comment - This was fixed in Pipeline: API plugin version 2.41. Thanks Bill Collins !

              People

              Assignee:
              mrginglymus Bill Collins
              Reporter:
              mheinzerling Martin Heinzerling
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: