我们在Jenkins上使用Multibranch Pipeline作业。它扫描master上的分支,如果有更改,则在其中一个slave上触发build。但是,有时在扫描期间,我们会收到一个例外:
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)
我们现在唯一的解决方案是重新启动master并删除文件。任何想法为什么会发生?