language-tools: Error: ENFILE: file table overflow and Too many open files in system
Vue - Official extension or vue-tsc version
v2.0.28
VSCode version
1.92.0
Vue version
3.3.11
TypeScript version
5.3.3
System Info
System:
OS: macOS 14.6
CPU: (10) arm64 Apple M1 Pro
Memory: 65.58 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 20.12.2 - ~/.nvm/versions/node/v20.12.2/bin/node
Yarn: 1.22.22 - ~/.nvm/versions/node/v20.12.2/bin/yarn
npm: 10.5.0 - ~/.nvm/versions/node/v20.12.2/bin/npm
Browsers:
Chrome: 127.0.6533.90
Safari: 17.6
Steps to reproduce
While working on a project once a day I have next errors:
"ENFILE: file table overflow ..." and as result "Too many open files in system"
Random apps crash and won’t launch
First I checked applications that opened a lot of files:
lsof -n +c 0 | cut -f1 -d' ' | uniq -c | sort | tail
result:
277 Electron
282 UserEvent
343 Code\x20H
380 corespotl
405 Dropbox
423 Google
589 Code\x20H
737 Google
33370 Code\x20H
65589 Code\x20H
For display PID instead of application name:
lsof -n +c 0 | sed -E 's/^[^ ]+[ ]+([^ ]+).*$/\1/' | uniq -c | sort | tail
result:
260 83525
277 8145
282 1588
380 52538
423 76542
589 16855
16290 92232
16336 8637
33370 8636
65589 92363
Process info:
ps aux | grep 92363
result:
92363 0.0 0.4 1596757920 62368 ?? S 2:44PM 0:58.75 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin) /Users/alex/.vscode/extensions/vue.volar-2.0.28/server.js --node-ipc --clientProcessId=92229
Kill process:
sudo kill 92363
Check opened files again:
lsof -n +c 0 | cut -f1 -d' ' | uniq -c | sort | tail
result:
235 com.docker.backend
277 Electron
282 UserEventAgent
302 Dropbox
380 corespotlightd
423 Google\x20Chrome
473 Code\x20Helper\x20(Plugin)
589 Code\x20Helper\x20(Plugin)
610 Google\x20Chrome\x20Helper\x20(Renderer)
835 Code\x20Helper\x20(Plugin)
What is expected?
What is actually happening?
Once a day I have next errors:
"ENFILE: file table overflow ..." and and as result "Too many open files in system"
Random apps crash and won’t launch
Link to minimal reproduction
No response
Any additional comments?
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 23 (4 by maintainers)
I too have started experiencing this a few weeks ago and found out it has something to do with the Vue - Official extension. I’ve made some tests and here are my findings, maybe it helps the devs to pinpoint the issue.
My setup:
When I navigate through a .vue file, for every arrow key that I press, or selection that I make, a few new file descriptors are opened by two Code Helper (plugin) processes. Also, if I resize the VSCode window while the .vue file is the active file, the number of opened files descriptors grows by a dozen per second.
One of the plugin processes opens files named: /tmp/vue-named-pipe-2.1.2-inferred-1 The other process opens files named like this: ->0xf3c0ac39308920db
I happens only if the Vue - Official extension is enabled. As soon as I disable the extension, all the file descriptors are closed.
How I tested it
lsof | awk '{print $1, $2}' | sort | uniq -c | sort -nr | grep Codewhile true; do lsof -p 44465 | wc -l; sleep 2; doneConclusion
At least in my case, it doesn’t have anything to do with running the project or “npm run dev”. It is enough to have a .vue file (even if it’s empty) in the foreground and select something in it or resize the VSCode window, in order for the file descriptor count to grow. If the number of opened file descriptors gets high enough (10000+), it begins to return errors when saving files and eventually other apps in the system start crashing. If I disable the Vue - Official extension, all the files descriptors are closed and everything gets back to normal.
Temporary solution
For now, I made a habit of disabling and enabling the Vue - Official extension every now and then.
I hope this helps.
For me, after a couple of days of work without restarting the extension, these are the top file counts. I guess something still isn’t totally right, but it’s much better than before.
@peroneu thank you for confirming! The fix has been released for 2.1.6, if you still have problems please let me know.
@peroneu thank you for the information! The leaking problem should be solved in https://github.com/vuejs/language-tools/commit/8bc2416283516324f3ec12b3badf839dafcc2a62, you can use the following version temporarily.
volar-2.1.4-alpha.0.vsix.zip
We will also improve the implementation to reduce the need to create new connections.
Thanks @peroneu that helps. We’re investigating