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

Fix ConcurrentModificationException in PlotBuildAction class

    Details

    • Similar Issues:

      Description

      Background

      New class called PlotBuildAction was added when compatibility with Pipeline plugin was implemented in https://github.com/jenkinsci/plot-plugin/pull/32.
      Seems like this class current implementation is not thread safe and user reported 1st time issue with ConcurrentModificationException in PR comment. Exception was not reproducible to me even though I used provided by reporter Jenkins & Pipeline configurations.
      There was an attempt to blindly fix the issue in commit, but it didn't work out.
      Second report about the same exception appeared recently.

      Sam Van Oort proposed copy-on-write approach rather than synchronized for methods. It should be considered as potential fix.

      Environment

      What should be done

      • We need to reproduce ConcurrentModificationException while accessing plots array in PlotBuildAction and fix it.
      • It's good to have a test for the fix

      How to test

        Attachments

          Activity

          vgaidarji Veaceslav Gaidarji created issue -
          vgaidarji Veaceslav Gaidarji made changes -
          Field Original Value New Value
          Description h3. Background

          New class called [PlotBuildAction|https://github.com/jenkinsci/plot-plugin/blob/eb0f1ae3fdb48d5299ea04c93b445f445c0443dc/src/main/java/hudson/plugins/plot/PlotBuildAction.java] was added when compatibility with Pipeline plugin was implemented in https://github.com/jenkinsci/plot-plugin/pull/32.
          Seems like this class current implementation is not thread safe and user reported 1st time issue with ConcurrentModificationException in [PR comment|https://github.com/jenkinsci/plot-plugin/pull/32#issuecomment-335386273]. Exception was not reproducible to me even though I used provided by reporter Jenkins & Pipeline configurations.
          There was an attempt to blindly fix the issue in [commit|https://github.com/jenkinsci/plot-plugin/commit/35aaac24ae9b41136baa2a9dfb28aaee1c9e745b], but it didn't work out.
          [Second report|https://github.com/jenkinsci/plot-plugin/pull/32#commitcomment-25981039] about the same exception appeared recently.

          [~svanoort] proposed [copy-on-write approach|https://github.com/jenkinsci/plot-plugin/pull/32#discussion_r146071666] rather than synchronized for methods. It should be considered as potential fix.


          h3. What should be done

          - We need to reproduce ConcurrentModificationException while accessing plots array in [PlotBuildAction|https://github.com/jenkinsci/plot-plugin/blob/eb0f1ae3fdb48d5299ea04c93b445f445c0443dc/src/main/java/hudson/plugins/plot/PlotBuildAction.java] and fix it.
          - It's good to have a test for the fix

          h3. How to test

          - If issue is reproducible, test should be written
          - Gather feedback from https://github.com/dolfinsbizou and https://github.com/shawnhines as they reported about this exception and can verify on their environments
          h3. Background

          New class called [PlotBuildAction|https://github.com/jenkinsci/plot-plugin/blob/eb0f1ae3fdb48d5299ea04c93b445f445c0443dc/src/main/java/hudson/plugins/plot/PlotBuildAction.java] was added when compatibility with Pipeline plugin was implemented in [https://github.com/jenkinsci/plot-plugin/pull/32].
          Seems like this class current implementation is not thread safe and user reported 1st time issue with ConcurrentModificationException in [PR comment|https://github.com/jenkinsci/plot-plugin/pull/32#issuecomment-335386273]. Exception was not reproducible to me even though I used provided by reporter Jenkins & Pipeline configurations.
          There was an attempt to blindly fix the issue in [commit|https://github.com/jenkinsci/plot-plugin/commit/35aaac24ae9b41136baa2a9dfb28aaee1c9e745b], but it didn't work out.
           [Second report|https://github.com/jenkinsci/plot-plugin/pull/32#commitcomment-25981039] about the same exception appeared recently.

          [~svanoort] proposed [copy-on-write approach|https://github.com/jenkinsci/plot-plugin/pull/32#discussion_r146071666] rather than synchronized for methods. It should be considered as potential fix.
          h3. Environment
           - Plot plugin version is [1.2.0|https://github.com/jenkinsci/plot-plugin/releases/tag/plot-2.0.0].
           - [Environment|https://github.com/jenkinsci/plot-plugin/pull/32#issuecomment-339016012].

          h3. What should be done
           - We need to reproduce ConcurrentModificationException while accessing plots array in [PlotBuildAction|https://github.com/jenkinsci/plot-plugin/blob/eb0f1ae3fdb48d5299ea04c93b445f445c0443dc/src/main/java/hudson/plugins/plot/PlotBuildAction.java] and fix it.
           - It's good to have a test for the fix

          h3. How to test
           - If issue is reproducible, test should be written
           - Gather feedback from [https://github.com/dolfinsbizou] and [https://github.com/shawnhines] as they reported about this exception and can verify on their environments
          vgaidarji Veaceslav Gaidarji made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          vgaidarji Veaceslav Gaidarji made changes -
          Status In Progress [ 3 ] In Review [ 10005 ]
          vgaidarji Veaceslav Gaidarji made changes -
          Status In Review [ 10005 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]

            People

            • Assignee:
              vgaidarji Veaceslav Gaidarji
              Reporter:
              vgaidarji Veaceslav Gaidarji
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: