workers-sdk: πŸ› BUG: EBUSY: resource busy or locked, rmdir

Which Cloudflare product(s) does this pertain to?

Wrangler core

What version(s) of the tool(s) are you using?

3.13.0

What version of Node are you using?

18.18.0

What operating system are you using?

Windows 10

Describe the Bug

  • npm create cloudflare@latest
  • npm run start
  • Every time you exit (via CTRL +C), you’ll now get an error like this:
Error: EBUSY: resource busy or locked, rmdir '\\?\C:\Users\james\AppData\Local\Temp\miniflare-dfe8276bbdf83d5203566d99a9aee2e4\cache'
    at rmdirSync (node:fs:1229:10)
    at _rmdirSync (node:internal/fs/rimraf:235:5)
    at rimrafSync (node:internal/fs/rimraf:193:7)
    at node:internal/fs/rimraf:253:9
    at Array.forEach (<anonymous>)
    at _rmdirSync (node:internal/fs/rimraf:250:7)
    at rimrafSync (node:internal/fs/rimraf:193:7)
    at Object.rmSync (node:fs:1278:10)
    at E:\GitHub\bitter-sun-7847\node_modules\miniflare\dist\src\index.js:7528:27
    at process.exit (E:\GitHub\bitter-sun-7847\node_modules\exit-hook\index.js:15:3) {
  errno: -4082,
  syscall: 'rmdir',
  code: 'EBUSY',
  path: '\\\\?\\C:\\Users\\james\\AppData\\Local\\Temp\\miniflare-dfe8276bbdf83d5203566d99a9aee2e4\\cache'
}

Worker script for context, though it doesn’t seem to actually matter if you use cache or not:

export default {
	async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
		const cache = caches.default;
		const response = await cache.match(request);
		if(response){
			return response;
		}
		const finalResponse = new Response('Hello worker!', { status: 200 });
		ctx.waitUntil(cache.put(request, finalResponse.clone()));
		return finalResponse;
	},
};

This is not an issue with wrangler 3.12.

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

No response

About this issue

  • Original URL
  • State: closed
  • Created 9 months ago
  • Comments: 16 (16 by maintainers)

Most upvoted comments

No worries at all, happy to help!

Those most recent patches do indeed appear have to resolved it for me! πŸ₯³ I can no longer reproduce it with those patches applied. Thanks!