-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
wat_server uses 100% CPU #11
Comments
Can it be reproduced by using |
You can click on the And yes, |
I can't reproduce. When I run such command, wat_server only consumes about 5%. (CPU: Intel i7-12700K) |
Sounds like a reproduction to me? The macOS Activity Monitor reports percentage of a core rather than of the entire CPU, so if your percentage is of the entire CPU, then 12 cores translates to roughly 60% of a core, which is still way more than the 0% it should be using after receiving a |
I may have ideas and I will investigate tomorrow. |
Does this problem only occur after receving |
I haven't done that detailed debugging yet so I'm not sure; if I were to look more into it right now, the first thing I'd try would be to cut out some number of messages from the end of |
OK, I did a bit more digging. One interesting thing to note is that, while VS Code seems to always send the It seems that I did an experiment with your VS Code extension in which I changed the restart command from calling So, it seems that at least one issue is that |
I'm not sure if it's helpful, but do you have conditions to test on other systems? I don't have a Mac. (It's okay for you to say no.) |
I haven't tried it on other systems, but I can if you need me to. Just to clarify: are you saying that when you run this on your machine, the CPU usage stabilizes at 0%? Because as I said before, if your |
I think I reproduced it. As a language server, it shouldn't consume 5% CPU. |
This is my previous implementation. Once I encountered the error message, I decided to not exit until receiving |
If the connection closes, the language server should terminate. You can print an error or not depending on your preference I suppose, but it's definitely incorrect for the language server to keep running, even on a timer. Unless I'm misunderstanding something? |
As another data point, take a look at the implementation in the Upon receiving a (Also, just to clarify: while rust-analyzer uses that library, it doesn't call that specific function I linked above, and instead does its own thing that doesn't have a timeout, as far as I'm aware. But the point is, in both cases, there's no waiting around after the connection closes.) |
Solution may fix these two issues. |
This is a followup on g-plane/vscode-wasm#4. First I cloned this repo at commit 212e1e8 into
~/github/g-plane/wasm-language-tools
, rancargo build --release
, and put the following script namedwat_server
on myPATH
:I then used that script via version 1.5.6 of the WebAssembly Language Tools VS Code extension to generate an
input.txt
file to make this issue reproducible. After I closed that VS Code window, thewat_server
process remained running while using 100% of one of my cores, so I manually terminated it.Finally, I reproduced the issue by running
cat input.txt | cargo run --release
, which again produced a runningwat_server
process using 100% of one of my cores. In that case I was able to terminate the process via^C
since it was just in my terminal.The text was updated successfully, but these errors were encountered: