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

      The following two threads cause a dead lock:

      	at hudson.model.AbstractProject.save(AbstractProject.java:268)
      	-  blocked on hudson.maven.MavenModuleSet@57164bd1
      	at hudson.plugins.copyartifact.CopyArtifact$ListenerImpl.onRenamed(CopyArtifact.java:331)
      	at hudson.model.AbstractItem.renameTo(AbstractItem.java:296)
      	-  locked hudson.model.FreeStyleProject@29a74e2b
      	-  locked com.cloudbees.hudson.plugins.folder.Folder@29a1da29
      	at hudson.model.Job.renameTo(Job.java:577)
      	at hudson.model.Job.doDoRename(Job.java:1311)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:601)
      	at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:288)
      	at org.kohsuke.stapler.interceptor.RequirePOST$Processor.invoke(RequirePOST.java:29)
      	at org.kohsuke.stapler.Function$InterceptedFunction.invoke(Function.java:389)
      
      	at hudson.model.Project.getPublishersList(Project.java:114)
      	-  blocked on hudson.model.FreeStyleProject@29a74e2b
      	at hudson.model.Project.buildDependencyGraph(Project.java:172)
      	at hudson.model.DependencyGraph.build(DependencyGraph.java:90)
      	at jenkins.model.Jenkins.rebuildDependencyGraph(Jenkins.java:3563)
      	at hudson.model.AbstractItem.delete(AbstractItem.java:515)
      	-  locked hudson.maven.MavenModuleSet@57164bd1
      	at hudson.model.Job.delete(Job.java:587)
      	-  locked hudson.maven.MavenModuleSet@57164bd1
      	at com.cloudbees.hudson.plugins.folder.Folder.performDelete(Folder.java:505)
      	at hudson.model.AbstractItem.delete(AbstractItem.java:507)
      	-  locked com.cloudbees.hudson.plugins.folder.Folder@44bf68c1
      	at hudson.model.AbstractItem.doDoDelete(AbstractItem.java:484)
      

          [JENKINS-18589] Deadlock

          Kohsuke Kawaguchi created issue -

          To generally reduce the likelihood of dead locks like this, we should prefer lock-less code wherever possible. I'm changing Project.getPublishersList() to not to require a locking by using a volatile field.

          I experimented a little with using AtomicReference, which looks cleaner, but making this work transparently with XStream turns out to be very difficult, especially when the element in XML may not be present.

          The other obvious approach is to the instantiation code in onLoad, but this method is getting complex enough that we need to worry about fixing up fields in the correct order, and IIRC the reason we moved the initializer into the getter method in the first place was because we had such an ordering issue.

          Kohsuke Kawaguchi added a comment - To generally reduce the likelihood of dead locks like this, we should prefer lock-less code wherever possible. I'm changing Project.getPublishersList() to not to require a locking by using a volatile field. I experimented a little with using AtomicReference , which looks cleaner, but making this work transparently with XStream turns out to be very difficult, especially when the element in XML may not be present. The other obvious approach is to the instantiation code in onLoad , but this method is getting complex enough that we need to worry about fixing up fields in the correct order, and IIRC the reason we moved the initializer into the getter method in the first place was because we had such an ordering issue.
          Kohsuke Kawaguchi made changes -
          Link New: This issue is related to JENKINS-15817 [ JENKINS-15817 ]

          Code changed in jenkins
          User: Kohsuke Kawaguchi
          Path:
          changelog.html
          core/src/main/java/hudson/matrix/MatrixProject.java
          core/src/main/java/hudson/model/AbstractProject.java
          core/src/main/java/hudson/model/Project.java
          maven-plugin/src/main/java/hudson/maven/AbstractMavenProject.java
          test/src/test/groovy/hudson/model/AbstractProjectTest.groovy
          test/src/test/resources/hudson/model/AbstractProjectTest/vectorTriggers.xml
          http://jenkins-ci.org/commit/jenkins/7facc7733c7040536d4074a2c5805b75ee1d8f35
          Log:
          [FIXED JENKINS-18589]

          Use DescribableList to handle the copy-on-write semantics correctly. The vector class just doesn't cut it, and we've been setting a new value to this field, which will violates all sorts of the concurrent programming practice.

          This change has the nice side effect of removing class="vector" from the persisted XML. A test is added to make sure we can still read back such an XML.

          Compare: https://github.com/jenkinsci/jenkins/compare/6ceafac2cd6b...7facc7733c70

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kohsuke Kawaguchi Path: changelog.html core/src/main/java/hudson/matrix/MatrixProject.java core/src/main/java/hudson/model/AbstractProject.java core/src/main/java/hudson/model/Project.java maven-plugin/src/main/java/hudson/maven/AbstractMavenProject.java test/src/test/groovy/hudson/model/AbstractProjectTest.groovy test/src/test/resources/hudson/model/AbstractProjectTest/vectorTriggers.xml http://jenkins-ci.org/commit/jenkins/7facc7733c7040536d4074a2c5805b75ee1d8f35 Log: [FIXED JENKINS-18589] Use DescribableList to handle the copy-on-write semantics correctly. The vector class just doesn't cut it, and we've been setting a new value to this field, which will violates all sorts of the concurrent programming practice. This change has the nice side effect of removing class="vector" from the persisted XML. A test is added to make sure we can still read back such an XML. Compare: https://github.com/jenkinsci/jenkins/compare/6ceafac2cd6b...7facc7733c70
          SCM/JIRA link daemon made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]
          James Nord made changes -
          Labels New: lts-candidate

          dogfood added a comment -

          Integrated in jenkins_main_trunk #2687

          Result = UNSTABLE

          dogfood added a comment - Integrated in jenkins_main_trunk #2687 Result = UNSTABLE

          Code changed in jenkins
          User: Stefan Hirche
          Path:
          src/main/java/hudson/ivy/AbstractIvyProject.java
          http://jenkins-ci.org/commit/ivy-plugin/802921415942bc9c90e81d07ce05910c856bfaae
          Log:
          Triggers is not a field anymore, it's a method now, following fix for issue JENKINS-18589

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stefan Hirche Path: src/main/java/hudson/ivy/AbstractIvyProject.java http://jenkins-ci.org/commit/ivy-plugin/802921415942bc9c90e81d07ce05910c856bfaae Log: Triggers is not a field anymore, it's a method now, following fix for issue JENKINS-18589

          @kohsuke any ideas on how to maintain backward compatibility for ivy-plugin? or should we bump required core to 1.5xx?

          for (Trigger<?> trigger : getTriggers().values()) might be an option albeit ugly..

          Johno Crawford added a comment - @kohsuke any ideas on how to maintain backward compatibility for ivy-plugin? or should we bump required core to 1.5xx? for (Trigger<?> trigger : getTriggers().values()) might be an option albeit ugly..

          Code changed in jenkins
          User: Johno Crawford
          Path:
          src/main/java/hudson/ivy/AbstractIvyProject.java
          http://jenkins-ci.org/commit/ivy-plugin/9c967e3833e4542e16920756a239ab09009923fe
          Log:
          Triggers is not a field anymore, it's a method now, following fix for issue JENKINS-18589

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Johno Crawford Path: src/main/java/hudson/ivy/AbstractIvyProject.java http://jenkins-ci.org/commit/ivy-plugin/9c967e3833e4542e16920756a239ab09009923fe Log: Triggers is not a field anymore, it's a method now, following fix for issue JENKINS-18589

            kohsuke Kohsuke Kawaguchi
            kohsuke Kohsuke Kawaguchi
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: