Jenkins failed to delete a file - why? How to prevent?
We are using Jenkins to run our system tests on a regular schedule. The Jenkins job downloads some python scripts from Perforce, runs them and compares the outputs with known-good results.
The problem is, sometimes downloading from Perforce fails:
12:46:19 operating system will not allow deletion of file c:\Jenkins\...(redacted)...\p4j5949332513673726584.tmp on client.
In the error message, P4 is a common abbreviation for Perforce. We have a Jenkins plugin called P4 which downloads files from Perforce; I guess it's this plugin that writes this error message. I think something is holding the temporary file open, that's why it couldn't be deleted.
What can I do to prevent this? I imagine that it can be caused by an antivirus, some person quietly browsing in the Jenkins's file system, a random cosmic ray, etc. How can I even start investigating this?
Did we do something fundamentally wrong in configuring our Jenkins job this way? Something which would completely prevent this issue from happening?