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

Lock held too long on Folder while deleting

XMLWordPrintable

      If you have a large folder and delete it, all jobs inside are first deleted. This could take a while (minutes?) if you have the Job Config History plugin installed, or generally if I/O is slow:

      "Handling POST /jenkins/job/.../doDelete ..." ...
         java.lang.Thread.State: RUNNABLE
              at java.io.UnixFileSystem.getBooleanAttributes0(Native Method)
              at java.io.UnixFileSystem.getBooleanAttributes(UnixFileSystem.java:242)
              at java.io.File.exists(File.java:819)
              at hudson.plugins.jobConfigHistory.HistoryFileFilter.accept(HistoryFileFilter.java:18)
              at java.io.File.listFiles(File.java:1291)
              at hudson.plugins.jobConfigHistory.FileHistoryDao.getRevisions(FileHistoryDao.java:330)
              at hudson.plugins.jobConfigHistory.FileHistoryDao.getRevisions(FileHistoryDao.java:320)
              at hudson.plugins.jobConfigHistory.FileHistoryDao.getRevisions(FileHistoryDao.java:314)
              at hudson.plugins.jobConfigHistory.FileHistoryDao.hasDuplicateHistory(FileHistoryDao.java:556)
              at hudson.plugins.jobConfigHistory.FileHistoryDao.checkDuplicate(FileHistoryDao.java:578)
              at hudson.plugins.jobConfigHistory.FileHistoryDao.saveItem(FileHistoryDao.java:263)
              at hudson.plugins.jobConfigHistory.JobConfigHistorySaveableListener.onChange(JobConfigHistorySaveableListener.java:29)
              at hudson.model.listeners.SaveableListener.fireOnChange(SaveableListener.java:81)
              at hudson.model.Descriptor.save(Descriptor.java:763)
              - locked <0x0000000541f80148> (a javaposse.jobdsl.plugin.DescriptorImpl)
              at javaposse.jobdsl.plugin.DescriptorImpl.removeSeedReference(DescriptorImpl.java:106)
              at javaposse.jobdsl.plugin.DescriptorImpl.access$000(DescriptorImpl.java:25)
              at javaposse.jobdsl.plugin.DescriptorImpl$GeneratedJobMapItemListener.onDeleted(DescriptorImpl.java:114)
              at hudson.model.listeners.ItemListener$4.apply(ItemListener.java:205)
              at hudson.model.listeners.ItemListener$4.apply(ItemListener.java:203)
              at hudson.model.listeners.ItemListener.forAll(ItemListener.java:167)
              at hudson.model.listeners.ItemListener.fireOnDeleted(ItemListener.java:203)
              at com.cloudbees.hudson.plugins.folder.AbstractFolder.onDeleted(AbstractFolder.java:606)
              at com.cloudbees.hudson.plugins.folder.AbstractFolder.onDeleted(AbstractFolder.java:115)
              at hudson.model.AbstractItem.delete(AbstractItem.java:584)
              at hudson.model.Job.delete(Job.java:665)
              at com.cloudbees.hudson.plugins.folder.AbstractFolder.performDelete(AbstractFolder.java:623)
              at hudson.model.AbstractItem.delete(AbstractItem.java:582)
              - locked <0x00000005477cbcd8> (a com.cloudbees.hudson.plugins.folder.Folder)
              at com.cloudbees.hudson.plugins.folder.AbstractFolder.performDelete(AbstractFolder.java:623)
              at hudson.model.AbstractItem.delete(AbstractItem.java:582)
              - locked <0x00000005472fd180> (a com.cloudbees.hudson.plugins.folder.Folder)
              at com.cloudbees.hudson.plugins.folder.AbstractFolder.performDelete(AbstractFolder.java:623)
              at hudson.model.AbstractItem.delete(AbstractItem.java:582)
              - locked <0x00000005472fb028> (a com.cloudbees.hudson.plugins.folder.Folder)
              at com.cloudbees.hudson.plugins.folder.AbstractFolder.performDelete(AbstractFolder.java:623)
              at hudson.model.AbstractItem.delete(AbstractItem.java:582)
              - locked <0x00000005448201a8> (a com.cloudbees.hudson.plugins.folder.Folder)
              at com.cloudbees.hudson.plugins.folder.AbstractFolder.performDelete(AbstractFolder.java:623)
              at hudson.model.AbstractItem.delete(AbstractItem.java:582)
              - locked <0x0000000544820210> (a com.cloudbees.hudson.plugins.folder.Folder)
              at com.cloudbees.hudson.plugins.folder.AbstractFolder.performDelete(AbstractFolder.java:623)
              at hudson.model.AbstractItem.delete(AbstractItem.java:582)
              - locked <0x0000000544820290> (a com.cloudbees.hudson.plugins.folder.Folder)
              at hudson.model.AbstractItem.doDoDelete(AbstractItem.java:543)
              at ...
      

      Note that the monitor is being held on the Folder while deleting its children. This means that view threads can hang during the process:

      "Handling GET /jenkins/job/.../ ... : ... View/index.jelly View/sidepanel.jelly AbstractFolder/tasks-bottom.jelly" ... BLOCKED on com.cloudbees.hudson.plugins.folder.Folder@... owned by "Handling POST /jenkins/job/.../doDelete ..." ...
      	at com.cloudbees.hudson.plugins.folder.Folder.getActions(Folder.java:161)
      	-  blocked on com.cloudbees.hudson.plugins.folder.Folder@4b4fc60a
      	at hudson.model.Actionable.getAllActions(Actionable.java:94)
      	at ...
      

            jglick Jesse Glick
            jglick Jesse Glick
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: