Closed cyberz closed 1 week ago
Can you share your tsconfig?
tsconfig.json
{
"files": [],
"references": [
{
"path": "./tsconfig.node.json"
},
{
"path": "./tsconfig.app.json"
}
]
}
tsconfig.node.json
{
"extends": "@tsconfig/node18/tsconfig.json",
"include": [
"vite.config.*",
"vitest.config.*",
"cypress.config.*",
"nightwatch.conf.*",
"playwright.config.*"
],
"compilerOptions": {
"composite": true,
"noEmit": true,
"module": "ESNext",
"moduleResolution": "Bundler",
"types": ["node"]
}
}
tsconfig.app.json
{
"extends": "@vue/tsconfig/tsconfig.dom.json",
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
"exclude": ["src/**/__tests__/*"],
"compilerOptions": {
// "moduleResolution": "node",
"composite": true,
"noEmit": true,
"baseUrl": "./",
"paths": {
"@/*": ["./src/*"]
},
}
}
project based on: https://github.com/TailAdmin/vue-tailwind-admin-dashboard
I have the same issue. I found too many '/tmp/vue-named-pipe-2.0.28-inferred-0' in lsof.
I have the same issue on my system, but hadn't managed to track it down as far as you have. It just seems that it only happens when I'm doing development and have the app running with npm run dev
and have done lots of changes so hmr has run lots of times.
Once the problem occurs, I have to restart my machine, so haven't been able to gather any particular data about it apart from that general observation.
The general suggestion seems to be to increase the maxfiles and maxfilesperproc settings, but I'm hesitant to do that without understanding the cause of the problem, and what the settings need to be.
The general suggestion seems to be to increase the maxfiles and maxfilesperproc settings,
I think all you'll get is a little more time between problems occurring because file descriptors keep getting bigger and not smaller. When the maxfiles and maxfilesperproc limits are reached, you will again experience problems with the operating system.
I just started experiencing this. I thought it had to do with a Chrome update, but perhaps it was the VS Code and/or Extension Updates.
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.
lsof | awk '{print $1, $2}' | sort | uniq -c | sort -nr | grep Code
605 Code\x20H 44465
603 Code\x20H 44501
88 Code\x20H 44425
while true; do lsof -p 44465 | wc -l; sleep 2; done
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.
For now, I made a habit of disabling and enabling the Vue - Official extension every now and then.
I hope this helps.
Thanks @peroneu that helps. We're investigating
@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.
We will also improve the implementation to reduce the need to create new connections.
@johnsoncodehk wow, that was fast. Much appreciated!
I installed the version linked to by @johnsoncodehk and I just ran into the same issue again.
Today I have updated the extension to v. 2.1.4, which I assume includes the fix from the file linked above. The update did indeed do something, but it doesn't solve the issue. Resizing the VSCode window doesn't increase the number of file descriptors anymore, but navigating through the file with the arrow keys does. Another thing is that before, there were 2 processes, each with a similar number of files opened. Now, there are 3 processes, and one of them is always approximately the sum of the other too. I have no idea if this means anything... :)
18489 Code\x20H 13887
9266 Code\x20H 9822
9266 Code\x20H 9821
The first number is the output from "lsof" and the second is the process id.
Just doing Select All, then Esc for 10 times opens about 90 new file descriptors. After a couple of hours of work, I ended up with almost 40,000 file descriptors opened.
The solution to disable and enable the extension still works, but it would be great to have it fixed.
@davidmatter @johnsoncodehk If there's anything else you'd like me to test, please let me know. Thanks!
@peroneu that's strange, I can't reproduce it anymore since 2.1.4. The number of open files is quite steady on my end. I think @johnsoncodehk wanted to have another look at the pipe code anyways. Are you using any kind of special extensions by any chance? Anything that integrates with the tsserver or the vue ecosystem?
I can't reproduce it, but I fixed the possible potential problem at https://github.com/vuejs/language-tools/commit/8064338a73cf622ad112c34f4b3091446beaf2de. Can you try the following version to see if it solves the problem?
Thanks a lot! I have built the extension from the commit above and it seems that it does indeed solve the issue for good. After about one hour of work I didn't get any superfluous file descriptors. Great job!
92 Code\x20H 22482
87 Code\x20H 22484
86 Code\x20H 25463
69 Code\x20H 22483
61 Code\x20H 22492
@peroneu thank you for confirming! The fix has been released for 2.1.6, if you still have problems please let me know.
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
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:For display PID instead of application name:
lsof -n +c 0 | sed -E 's/^[^ ]+[ ]+([^ ]+).*$/\1/' | uniq -c | sort | tail
result: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: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 launchLink to minimal reproduction
No response
Any additional comments?
No response