We are using Multibranch Pipeline job on Jenkins. It scans branches on master and if there are changes then build is triggered on one of the slaves. However, sometimes during the scan, we receive an exception:
java.io.IOException: Unable to delete '/var/lib/jenkins/jobs/sample.job.build/branches/feature-P.of17kqq8ojl6.-PFT-repo'. Tried 3 times (of a maximum of 3) waiting 0.1 sec between attempts.
at hudson.Util.deleteRecursive(Util.java:352)
at hudson.model.AbstractItem.performDelete(AbstractItem.java:691)
at org.jenkinsci.plugins.workflow.job.WorkflowJob.performDelete(WorkflowJob.java:642)
at hudson.model.AbstractItem.delete(AbstractItem.java:675)
at hudson.model.Job.delete(Job.java:676)
at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:289)
at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:165)
at jenkins.branch.MultiBranchProject$BranchIndexing.run(MultiBranchProject.java:1022)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:421)
Caused by: java.nio.file.FileSystemException:
/var/lib/jenkins/jobs/sample.job.build/branches/feature-P.of17kqq8ojl6.-PFT-repo/builds/58/.nfs00000000000e9e0d000000ba:
Device or resource busy at
sun.nio.fs.UnixException.translateToIOException(UnixException.java:91)
at
sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at
sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at
sun.nio.fs.UnixFileSystemProvider.implDelete(UnixFileSystemProvider.java:244)
at
sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:108)
at java.nio.file.Files.deleteIfExists(Files.java:1165) at
hudson.Util.tryOnceDeleteFile(Util.java:290) at
hudson.Util.tryOnceDeleteRecursive(Util.java:370) at
hudson.Util.tryOnceDeleteContentsRecursive(Util.java:389) at
hudson.Util.tryOnceDeleteRecursive(Util.java:369) at
hudson.Util.tryOnceDeleteContentsRecursive(Util.java:389) at
hudson.Util.tryOnceDeleteRecursive(Util.java:369) at
hudson.Util.tryOnceDeleteContentsRecursive(Util.java:389) at
hudson.Util.tryOnceDeleteRecursive(Util.java:369) at
hudson.Util.deleteRecursive(Util.java:347)
The only solution we have now is to restart master and remove files. Any ideas why it happens?
来源:https://stackoverflow.com/questions/48437602/multibranch-pipeline-job-scan-cannot-remove-files