I'd like to confirm that I am having the same issues as reported by Ioannis on Jenkins 2.107.2. This is causing a major problem for us as our artifacts are not getting cleaned up do to the job being "in use" when the LogRotator runs and we are constantly running out of disk space because of it. When the LogRotator runs I get the following error in my log:
Failed to rotate log java.io.IOException: M:\jenkins-jobs\Build-CheckoutInstall\builds\2415 is in use at hudson.model.Run.delete(Run.java:1505) at hudson.tasks.LogRotator.perform(LogRotator.java:145) at hudson.model.Job.logRotate(Job.java:472) at hudson.model.Run.execute(Run.java:1791) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:429)
This does not appear to happen to all of our projects, but I can't find the common thread between the jobs it is happening on. It also does not appear to hold logs from builds that fail, only builds that succeed. I attempted to run the file leak detector Oleg provided, but I am getting the same error that Ioannis is. This is nearly a show stopper for us, as our Jenkins system runs out of disk space constantly while we can't clean artifacts.
Attached is a screenshot of some of the very many log files being held by Jenkins right now.
If there's anything I can do to help track this down, or if you can tell me what I'm doing wrong with the file leak detector, please let me know!