Locked logs files and cannot delete a job or folder

36 views
Skip to first unread message

l0id...@gmail.com

unread,
Nov 17, 2017, 9:04:17 AM11/17/17
to Jenkins Users
Hello,

I am constantly getting this error in Jenkins when I try to delete a job or
folder either manually through UI or by calling API.

The processexplorer was used for realizing what process locks a log file - that is the Jenkins's service.
Service is running under a special user account (not the default one). This account don't have any issues with the filesystem permissions.

Yes, the folder where is Jenkins is installed is "tools)"
---

A problem occurred while processing the request. Please check our bug
tracker to see if a similar problem has already been reported. If it is
already reported, please vote and put a comment on it to let us gauge the
impact of the problem. If you think this is a new issue, please file a new
issue. When you file an issue, make sure to add the entire stack trace,
along with the version of Jenkins and relevant plugins. The users list
might be also useful in understanding what has happened.
Stack trace

java.nio.file.FileSystemException:
c:\tools)\Jenkins\jobs\Core\jobs\Plans\jobs\PDFTests\jobs\PDFTests.Test1\builds\3\log:
The process cannot access the file because it is being used by another
process.

    at sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
    at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
    at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
    at sun.nio.fs.WindowsFileSystemProvider.implDelete(Unknown Source)
    at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(Unknown Source)
    at java.nio.file.Files.deleteIfExists(Unknown Source)
    at hudson.Util.tryOnceDeleteFile(Util.java:287)
    at hudson.Util.tryOnceDeleteRecursive(Util.java:364)
    at hudson.Util.tryOnceDeleteContentsRecursive(Util.java:383)
    at hudson.Util.tryOnceDeleteRecursive(Util.java:363)
    at hudson.Util.tryOnceDeleteContentsRecursive(Util.java:383)
    at hudson.Util.tryOnceDeleteRecursive(Util.java:363)
    at hudson.Util.tryOnceDeleteContentsRecursive(Util.java:383)
    at hudson.Util.tryOnceDeleteRecursive(Util.java:363)
    at hudson.Util.deleteRecursive(Util.java:341)
Caused: java.io.IOException: Unable to delete
'c:\tools)\Jenkins\jobs\Core\jobs\Plans\jobs\PDFTests\jobs\PDFTests.Test1'.
Tried 3 times (of a maximum of 3) waiting 0.1 =D1=81=D0=B5=D0=BA=D1=83=D0=
=BD=D0=B4 between attempts.
    at hudson.Util.deleteRecursive(Util.java:346)
    at hudson.model.AbstractItem.performDelete(AbstractItem.java:584)
    at hudson.model.Job.performDelete(Job.java:276)
    at hudson.model.AbstractProject.performDelete(AbstractProject.java:379)
    at hudson.model.AbstractItem.delete(AbstractItem.java:573)
    at hudson.model.Job.delete(Job.java:683)
    at
com.cloudbees.hudson.plugins.folder.AbstractFolder.delete(AbstractFolder.ja=
va:1330)
Caused: java.io.IOException: Failed to delete Core =C2=BB Plans =C2=BB PDFT=
ests =C2=BB
PDFTests.Test1
    at
com.cloudbees.hudson.plugins.folder.AbstractFolder.delete(AbstractFolder.ja=
va:1335)
    at hudson.model.AbstractItem.doDoDelete(AbstractItem.java:534)
    at java.lang.invoke.MethodHandle.invokeWithArguments(Unknown Source)
    at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:343=
)
    at
org.kohsuke.stapler.interceptor.RequirePOST$Processor.invoke(RequirePOST.ja=
va:52)
    at
org.kohsuke.stapler.PreInvokeInterceptedFunction.invoke(PreInvokeIntercepte=
dFunction.java:26)
    at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:184)
    at
org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:11=
7)
    at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:129)
    at
org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:5=
8)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845)
    at org.kohsuke.stapler.MetaClass$5.doDispatch(MetaClass.java:248)
    at
org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:5=
8)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845)
    at org.kohsuke.stapler.MetaClass$5.doDispatch(MetaClass.java:248)
    at
org.kohsuke.stapler.NameBased
----- Message truncated -----

James Nord

unread,
Nov 18, 2017, 7:29:16 AM11/18/17
to Jenkins Users
What version of jenkins?

There was a bug fixed around this area since time around 2.3x IIRC.

Otherwise may be someone is viewing the console from the run. Windows will not let you delete a file even if it is the same process that has it open and owns the lock.

Can you see this on the latest Jenkins on a new test job (to make sure no one else interacts with the job) also what type of job (pipeline Freestyle etc)

l0id...@gmail.com

unread,
Nov 18, 2017, 3:12:16 PM11/18/17
to Jenkins Users
The current version is 2.46.2
Is it safe to update from this version to the latest (will I be able to rollback) and what should be installed additionally (like java 7,8)?

I am sure that nobody watches logs, I just create a job, run it, try to delete and get the error.
Reply all
Reply to author
Forward
0 new messages