Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rollup is watching C:\ in windows environment, if dynamic imports are used #10096

Closed
7 tasks done
HerrDietz opened this issue Sep 13, 2022 · 0 comments · Fixed by #11261
Closed
7 tasks done

rollup is watching C:\ in windows environment, if dynamic imports are used #10096

HerrDietz opened this issue Sep 13, 2022 · 0 comments · Fixed by #11261

Comments

@HerrDietz
Copy link

HerrDietz commented Sep 13, 2022

Describe the bug

I'm not totaly sure if I'm on the right track here:

We noticed the node process terminated regulary when we ran our script for vite in watch mode (vite build --watch) after migrating to vite 3.x.
We are under the impression, that if you use dynamic imports in an windows environment, rollup is also watching C:\. This seems to lead to the error.

Sadly, the termination is not deterministic. At some point in time, after a change, the process just craches. I suspect the build time has something to do with the crash: longer build times seem to favor an error.

After digging into rollup, we noticed that at some point the path /@vite/dynamic-import-helper is watched. Somehow, this path is 'translated' into C:\ in my Windows environment.

I created a breakpoint in node_modules\rollup\dist\es\shared\watch.js in async _addToNodeFs(path, initialAdd, priorWh, depth, target) in line 3184
image

image

This does only happen if dynamic imports are used.

I am not entirely sure if both behaviors (watching C:\ and crashing) are related.

Reproduction

https://github.com/HerrDietz/vite-crash-reproducer/

System Info

System:                                                 
    OS: Windows 10 10.0.19044                             
    CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
    Memory: 3.65 GB / 15.88 GB                            
  Binaries:                                               
    Node: 16.17.0 - C:\Java\nodejs\node.EXE               
    npm: 8.11.0 - C:\Java\nodejs\npm.CMD                  
  Browsers:                                               
    Chrome: 105.0.5195.102                                
    Edge: Spartan (44.19041.1266.0), Chromium (105.0.1343.33)

Used Package Manager

npm

Logs

Click to expand!
build started...
✓ 98 modules transformed.
dist/vite-watch-reproducer.mjs      0.57 KiB / gzip: 0.35 KiB
dist/lazy-loaded-foo.90063862.mjs   0.11 KiB / gzip: 0.10 KiB
built in 42ms.

build started...
✓ 99 modules transformed.
dist/vite-watch-reproducer.mjs      0.57 KiB / gzip: 0.35 KiB
dist/lazy-loaded-foo.90063862.mjs   0.11 KiB / gzip: 0.10 KiB
built in 49ms.

build started...
✓ 100 modules transformed.
dist/vite-watch-reproducer.mjs      0.57 KiB / gzip: 0.35 KiB
dist/lazy-loaded-foo.90063862.mjs   0.11 KiB / gzip: 0.10 KiB
built in 34ms.
Waiting for the debugger to disconnect...
node:events:491
      throw er; // Unhandled 'error' event
      ^

Error: EBUSY: resource busy or locked, lstat 'C:\DumpStack.log.tmp'
Emitted 'error' event on FSWatcher instance at:
    at FSWatcher._handleError (file:///C:/foo/bar/vite-watch-reproducer/node_modules/rollup/dist/es/shared/watch.js:4397:10)      
    at ReaddirpStream.NodeFsHandler$1._boundHandleError (file:///C:/foo/bar/vite-watch-reproducer/node_modules/rollup/dist/es/shar
ed/watch.js:2873:43)
    at ReaddirpStream.emit (node:events:513:28)
    at emitErrorNT (node:internal/streams/destroy:157:8)
    at emitErrorCloseNT (node:internal/streams/destroy:122:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -4082,
  code: 'EBUSY',
  syscall: 'lstat',
  path: 'C:\\DumpStack.log.tmp'
}
Waiting for the debugger to disconnect...

Validations

patak-dev pushed a commit that referenced this issue Dec 9, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Dec 24, 2022
futurGH pushed a commit to futurGH/vite that referenced this issue Feb 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants