nitro icon indicating copy to clipboard operation
nitro copied to clipboard

Getting "Error: EBUSY: resource busy or locked, access '\\.\pipe\nitro\worker-24144-2.sock' | Nuxt"

Open rpandyaescribe opened this issue 1 year ago • 2 comments

Environment

Nuxt - v3.7.4 Nitro - v2.6.3

Reproduction

I don't have a proper link to reproduce but using the specified version of nuxt in an app where you have multiple endpoints being called within the same timeframe will cause this error.

Describe the bug

When building the nuxt project, getting Error: EBUSY: resource busy or locked, access '\\.\pipe\nitro\worker-24144-2.sock' | Nuxt errors for random endpoints.

Additional context

No response

Logs

No response

rpandyaescribe avatar Sep 11 '24 20:09 rpandyaescribe

alisherabdimuminov avatar Oct 15 '24 18:10 alisherabdimuminov

please fix this. my all projects does not works

alisherabdimuminov avatar Oct 15 '24 18:10 alisherabdimuminov

I am experiencing the same issue. Due to this problem, I am unable to proceed with parallel processing. This is a critical issue that needs to be resolved quickly.

kdydesign avatar Nov 08 '24 04:11 kdydesign

The best way to solve this issue is to help making reproduction steps we cannot solve it without.

pi0 avatar Nov 08 '24 08:11 pi0

I am experiencing the same issue. My system is Windows10 https://github.com/hefty/nitro-app.git may help

hefty avatar Dec 12 '24 02:12 hefty

Having the same issue Windows 11, calling many endpoints at the same time (3).

franciscohermida avatar Jan 21 '25 11:01 franciscohermida

Can you please try nightly channel? We had recently some stability improvements.

pi0 avatar Jan 21 '25 11:01 pi0

Same issue using the nightly channel, I used the repro created by @hefty as I don't know exactly how to test a specific version of nitro in my nuxt 3 app.

franciscohermida avatar Jan 21 '25 21:01 franciscohermida

The code at src/core/dev-server/server.ts

const getWorkerAddress = () => { const address = currentWorker?.address; if (!address) { return; } if (address.socketPath) { try { accessSync(address.socketPath); } catch (error) { if (!lastError) { lastError = error; } console.log(error); if (error.message.includes('locked')) { return address; } return; } } return address; };

The server will check user's permission at each request coming, due to fs.accessSync not working properly (https://github.com/nodejs/node/issues/2949 ), caused this issue.

hefty avatar Jan 22 '25 01:01 hefty

Managed to reproduce with Nightly and trimmed down the reproduction here: nitro_2729_repro.zip (hopefully I got it right)

Instructions to reproduce in the README

lihbr avatar Jan 24 '25 10:01 lihbr

I guess you cannot access that file, it is a virtual file, node should resolve the real path in accessSync (if possible).

I have it working using local ip address instead localhost, nitro getting some internal error without adding ECONNRESET (check screenshot bellow):

  • change the localhost with
  • apply patch
  • run netstat -an and get local ip v4 address
  • run `pnpm nitro dev --host
  • run the test
// node_modules/.pnpm/[email protected][email protected]/node_modules/nitropack-nightly/dist/core/index.mjs
// L2449
        if (!address.socketPath.startsWith("\\\\") && error.code === "ENOENT") {
          if (!lastError) {
            lastError = error;
          }
          return;
        }

I can also run the test using localhost with this:

// node_modules/.pnpm/[email protected][email protected]/node_modules/nitropack-nightly/dist/core/index.mjs
// L2449
        if (!address.socketPath.startsWith("\\\\") && (error.code === "ENOENT" || "ECONNRESET")) {
          if (!lastError) {
            lastError = error;
          }
          return;
        }

Image test ouput with ip iddress

Image error using localhost without last patch

userquin avatar Jan 24 '25 15:01 userquin

I'm experiencing same error when multiple components fetch data simultaneously during page load. This happens even with only a few components.

After a 503 error, the requests automatically retry fetching. I'm looking for insights into what's causing this and how to resolve it. Currently, I'm adding random delays to the fetch requests to stagger them and avoid simultaneous fetching, but I would like to know if there's a better solution.

Image

sczat avatar Jan 24 '25 18:01 sczat

This seems fixed in 2.11, thanks!

franciscohermida avatar Mar 04 '25 21:03 franciscohermida