• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • core

      I have multiple jenkins installations that are restarted from time to time (one by scheduled jenkins job, others when updating plugins). Since a few days (i would say since 1.653 update), restart from the UI fails with an exception and I need to restart jenkins via command line:

      INFORMATION: Stopping Jenkins
      Mär 21, 2016 6:29:27 AM jenkins.model.Jenkins _cleanUpDisconnectComputers
      INFORMATION: Starting node disconnection
      Mär 21, 2016 6:29:28 AM hudson.TcpSlaveAgentListener$ConnectionHandler run
      INFORMATION: Accepted connection #1 from /127.0.0.1:53515
      Mär 21, 2016 6:29:28 AM jenkins.model.Jenkins _cleanUpShutdownPluginManager
      INFORMATION: Stopping plugin manager
      Mär 21, 2016 6:29:28 AM hudson.plugins.im.JenkinsIsBusyListener removeConnectionProvider
      INFORMATION: Last connection provider removed. Unregistering this instance.
      Mär 21, 2016 6:29:28 AM jenkins.model.Jenkins _cleanUpPersistQueue
      INFORMATION: Persisting build queue
      Mär 21, 2016 6:29:28 AM jenkins.model.Jenkins _cleanUpAwaitDisconnects
      INFORMATION: Waiting for node disconnection completion
      Mär 21, 2016 6:29:28 AM jenkins.model.Jenkins _cleanUpPluginServletFilters
      SCHWERWIEGEND: Failed to stop filters
      java.lang.UnsupportedOperationException
      at java.util.concurrent.CopyOnWriteArrayList$COWIterator.remove(CopyOnWriteArrayList.java:1176)
      at hudson.util.PluginServletFilter.cleanUp(PluginServletFilter.java:162)
      at jenkins.model.Jenkins._cleanUpPluginServletFilters(Jenkins.java:3237)
      at jenkins.model.Jenkins.cleanUp(Jenkins.java:2890)
      at hudson.lifecycle.UnixLifecycle.restart(UnixLifecycle.java:70)
      at jenkins.model.Jenkins$27.run(Jenkins.java:3846)

      Mär 21, 2016 6:29:28 AM jenkins.model.Jenkins cleanUp
      INFORMATION: Jenkins stopped
      Mär 21, 2016 6:29:28 AM jenkins.model.Jenkins$27 run
      WARNUNG: Failed to restart Jenkins
      java.lang.RuntimeException: Unexpected issues encountered during cleanUp: null
      at jenkins.model.Jenkins.cleanUp(Jenkins.java:2905)
      at hudson.lifecycle.UnixLifecycle.restart(UnixLifecycle.java:70)
      at jenkins.model.Jenkins$27.run(Jenkins.java:3846)
      Caused by: java.lang.UnsupportedOperationException
      at java.util.concurrent.CopyOnWriteArrayList$COWIterator.remove(CopyOnWriteArrayList.java:1176)
      at hudson.util.PluginServletFilter.cleanUp(PluginServletFilter.java:162)
      at jenkins.model.Jenkins._cleanUpPluginServletFilters(Jenkins.java:3237)
      at jenkins.model.Jenkins.cleanUp(Jenkins.java:2890)
      ... 2 more

          [JENKINS-33681] Jenkins fails to restart with an exception

          I have the same problem, which appears to have been introduced by the call to iterator.remove() introduced in 1.653 by https://github.com/jenkinsci/jenkins/commit/abf9fd36582ce6277dec929e89f078678e587209 which was a fix for https://issues.jenkins-ci.org/browse/JENKINS-33384

          I'm not a java developer, but it looks questionable to me whether that code has ever worked? Oracle's Java 7 docs for CopyOnWriteArrayList say:

          Element-changing operations on iterators themselves (remove, set, and add) are not supported. These methods throw UnsupportedOperationException.

          As far as I can see PluginServletFilter.list has been a CopyOnWriteArrayList since December 2014 .

          Andrew Coulton added a comment - I have the same problem, which appears to have been introduced by the call to iterator.remove() introduced in 1.653 by https://github.com/jenkinsci/jenkins/commit/abf9fd36582ce6277dec929e89f078678e587209 which was a fix for https://issues.jenkins-ci.org/browse/JENKINS-33384 I'm not a java developer, but it looks questionable to me whether that code has ever worked? Oracle's Java 7 docs for CopyOnWriteArrayList say: Element-changing operations on iterators themselves ( remove , set , and add ) are not supported. These methods throw UnsupportedOperationException. As far as I can see PluginServletFilter.list has been a CopyOnWriteArrayList since December 2014 .

          I've updated the priority from Minor to Major, as this is outright preventing restarting Jenkins except with a full shutdown / restart from the shell. I hope that's OK.

          Andrew Coulton added a comment - I've updated the priority from Minor to Major, as this is outright preventing restarting Jenkins except with a full shutdown / restart from the shell. I hope that's OK.

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          core/src/main/java/hudson/util/PluginServletFilter.java
          http://jenkins-ci.org/commit/jenkins/a5febd7666fd78542d45428505cc62c067315c43
          Log:
          [FIXED JENKINS-33681] Plugin filters were failing to be removed and blocking restart

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: core/src/main/java/hudson/util/PluginServletFilter.java http://jenkins-ci.org/commit/jenkins/a5febd7666fd78542d45428505cc62c067315c43 Log: [FIXED JENKINS-33681] Plugin filters were failing to be removed and blocking restart

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          core/src/main/java/hudson/util/PluginServletFilter.java
          http://jenkins-ci.org/commit/jenkins/ee1ff1fdac86cee9e1ddaeacde61d0361720d4ea
          Log:
          Merge pull request #2147 from stephenc/jenkins-33681

          [FIXED JENKINS-33681] Plugin filters were failing to be removed and blocking restart

          Compare: https://github.com/jenkinsci/jenkins/compare/a5124b5fd504...ee1ff1fdac86

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: core/src/main/java/hudson/util/PluginServletFilter.java http://jenkins-ci.org/commit/jenkins/ee1ff1fdac86cee9e1ddaeacde61d0361720d4ea Log: Merge pull request #2147 from stephenc/jenkins-33681 [FIXED JENKINS-33681] Plugin filters were failing to be removed and blocking restart Compare: https://github.com/jenkinsci/jenkins/compare/a5124b5fd504...ee1ff1fdac86

          dogfood added a comment -

          Integrated in jenkins_main_trunk #4520
          [FIXED JENKINS-33681] Plugin filters were failing to be removed and (Revision a5febd7666fd78542d45428505cc62c067315c43)

          Result = UNSTABLE
          stephen connolly : a5febd7666fd78542d45428505cc62c067315c43
          Files :

          • core/src/main/java/hudson/util/PluginServletFilter.java

          dogfood added a comment - Integrated in jenkins_main_trunk #4520 [FIXED JENKINS-33681] Plugin filters were failing to be removed and (Revision a5febd7666fd78542d45428505cc62c067315c43) Result = UNSTABLE stephen connolly : a5febd7666fd78542d45428505cc62c067315c43 Files : core/src/main/java/hudson/util/PluginServletFilter.java

          Great works, thank you. I give feedback as soon as the next release is rolled out.

          Michael michael@wyraz.de added a comment - Great works, thank you. I give feedback as soon as the next release is rolled out.

          Great, thanks for the quick response.

          Andrew Coulton added a comment - Great, thanks for the quick response.

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          core/src/main/java/hudson/util/PluginServletFilter.java
          http://jenkins-ci.org/commit/jenkins/c57af86955c2c799930a93cd955ed7f98c7dc504
          Log:
          [FIXED JENKINS-33681] Plugin filters were failing to be removed and blocking restart

          (cherry picked from commit a5febd7666fd78542d45428505cc62c067315c43)

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: core/src/main/java/hudson/util/PluginServletFilter.java http://jenkins-ci.org/commit/jenkins/c57af86955c2c799930a93cd955ed7f98c7dc504 Log: [FIXED JENKINS-33681] Plugin filters were failing to be removed and blocking restart (cherry picked from commit a5febd7666fd78542d45428505cc62c067315c43)

            kapilit007 Kapildev Gupta
            mwyraz Michael michael@wyraz.de
            Votes:
            3 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: