Can't use rd on \_work\_temp\... on Windows 10 Pro
I'm having this problem with running on a self hosted Windows 10 x64 machine. I am not sure why the rd command fails maybe was something to do with either current wd or else some other related process that is launched during the runner. I'm attaching the config file for the workflow as well and the build log.
main.yml.txt Win10GithubRunnerfailure.txt
##[debug]Removed matchers: 'checkout-git'
node:child_process:397
ex = new Error('Command failed: ' + cmd + '\n' + stderr);
^
Error: Command failed: rd /s /q "C:\actions-runner\_work\_temp\1b19991b-e599-4929-8de9-b9fedb87a66c"
The process cannot access the file because it is being used by another process.
at ChildProcess.exithandler (node:child_process:397:12)
at ChildProcess.emit (node:events:390:28)
at maybeClose (node:internal/child_process:1064:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5) {
killed: false,
code: 32,
signal: null,
cmd: 'rd /s /q "C:\\actions-runner\\_work\\_temp\\1b19991b-e599-4929-8de9-b9fedb87a66c"',
stdout: '',
stderr: 'The process cannot access the file because it is being used by another process.\r\n'
}
##[debug]Node Action run completed with exit code 1
##[debug]Finishing: Run actions/checkout@v3
I have run into the exact same issue on Win10 Pro x64 when testing out a self-hosted runner setup with actions/checkout@v3
Error: Command failed: rd /s /q "E:\actions-runner\_work\_temp\01fa925a-faec-495d-8d96-4d0de1babefd"
The process cannot access the file because it is being used by another process.
at ChildProcess.exithandler (node:child_process:397:12)
at ChildProcess.emit (node:events:390:28)
at maybeClose (node:internal/child_process:1064:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5) ***
killed: false,
code: 32,
signal: null,
cmd: 'rd /s /q "E:\\actions-runner\\_work\\_temp\\01fa925a-faec-495d-8d96-4d0de1babefd"',
stdout: '',
stderr: 'The process cannot access the file because it is being used by another process.\r\n'
For anyone else who finds this in the future, use actions/checkout@v2 instead and it'll work. It still has that same error in the logs but it doesn't stop the action completing and it seems to be successful.
anyone have solution for v3 ? v2 seems way slow for 5GB repo !
Actually, the same problem happened on actions/checkout@v2, but not error but just warning occured without stopping steps or jobs as below.
(this is with checkout@v2 https://github.com/actions/checkout/tree/7884fcad6b5d53d10323aee724dc68d8b9096a2e )
"E:\Program Files\Git\cmd\git.exe" log -1 --format='%H'
...
...
(node:7256) UnhandledPromiseRejectionWarning: Error: Command failed: rd /s /q "E:\gh-runner\_work\_temp\bc931090-ce6d-4781-8bc4-277a535e6a0e"
...
The process cannot access the file because it is being used by another process.
at ChildProcess.exithandler (child_process.js:308:12)
at ChildProcess.emit (events.js:314:20)
at maybeClose (internal/child_process.js:1022:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
(node:7256) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:7256) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
checkout@v2, which uses node12, make the Error: Command failed: rd /s /q to warning.
checkout@v3, which uses node16, make this problem error
because from node15, the default behaviour changed as the message Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
This is also written in the Node.js document
v15.0.0 | Changed default mode to throw. Previously, a warning was emitted.
https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode
I have attempted to debug this, and I am pretty sure that the error occurs here. My suspicion is that there is some lingering git process that is still using this folder when checkout attempts to delete it, but I do not know how I would go about testing / fixing it.
Fixed on v3 for me by ensuring core.fsmonitor=false in C:\Program Files\Git\etc\gitconfig