tools icon indicating copy to clipboard operation
tools copied to clipboard

πŸ›VSCode extension stuck at 100% cpu usage

Open jpike88 opened this issue 2 years ago β€’ 38 comments

Environment information

same Rome rage as here

https://github.com/rome/tools/issues/4182#issuecomment-1410177376

too big to paste in this issue creation page for some reason

What happened?

After working for a while, saving a file gets stuck and these kinds of messages appear, spinning indefinitely:

Screenshot 2023-01-31 at 6 11 09 pm

If I look at how Rome is doing in the activity monitor, it's stuck spinning at 100% like so: Screenshot 2023-01-31 at 6 00 25 pm

Seems like there's an infinite loop issue happening? Not sure what else it could be.

If I just dismiss the dialogs, I notice that the Rome process continues to be maxed out, looks like it's stuck. Only way to stop is either close vscode or kill the process directly.

Expected result

Rome not cause CPU to max out at 100% forever!

Code of Conduct

  • [X] I agree to follow Rome's Code of Conduct

jpike88 avatar Jan 31 '23 11:01 jpike88

@Conaclos @ematipico this is becoming a real pain to deal with, it's really hampering our continued ability to use this.

latest Rome rage attached

CLI:
  Version:              11.0.0-nightly.97e48b4
  Color support:        true

Platform:
  CPU Architecture:     aarch64
  OS:                   macos

Environment:
  ROME_LOG_DIR:         unset
  NO_COLOR:             unset
  TERM:                 "xterm-256color"
  JS_RUNTIME_VERSION:   "v16.14.2"
  JS_RUNTIME_NAME:      "node"
  NODE_PACKAGE_MANAGER: "npm/9.1.1"

Rome Configuration:
  Status:               Loaded successfully
  Formatter disabled:   true
  Linter disabled:      false

Workspace:
  Open Documents:       0

Discovering running Rome servers...

Running Rome Server: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

β„Ή The client isn't connected to any server but rage discovered this running Rome server.

jpike88 avatar Feb 26 '23 05:02 jpike88

sorry #4220 may cause this problem, @Conaclos @ematipico could you revert that once? I suspect this function uses recursive: https://github.com/rome/tools/pull/4220/files#diff-c7e026db5551c56a2d889fc340f6dad25cf7cee4a1bf6b1b199a93e30ce9fd48R171

unvalley avatar Feb 26 '23 14:02 unvalley

@unvalley This seems unlikely to cause the issue. The last nightly was released two weeks ago.

Why do you think it is caused by this rule?

Conaclos avatar Feb 26 '23 14:02 Conaclos

@Conaclos oh sorry, I thought it was the latest version of the commit.

unvalley avatar Feb 26 '23 14:02 unvalley

Hi @jpike88 ,

We need your help to triage this issue.

You would need to find a way to reproduce the issue consistently. This issue might be around some code/file.

When you see that the Rome process goes crazy, you would need to give us the logs of the LSP server, preferably around the time the issue occurred. And the output trace in the VSCode extension.

You would need to give us the configuration you're using.

Sorry for the request, this is what we need from you to help. If you're able to create a repository, that would be awesome! Thank you

ematipico avatar Feb 26 '23 14:02 ematipico

is there a way I can just run it with some sort of profiling enabled and have the logs dump as they happen? I wouldn't have the slightest clue how to reproduce it, it tends to happen once I've been working for a while and I have a monorepo with a few TS project scattered throughout it, I work in the one vscode workspace.

jpike88 avatar Feb 26 '23 15:02 jpike88

We don't have any profiling for now.

Thing is, this might be a combination of project/files/code/LSP, so it's really difficult for us help you, unless there's a deterministic way to understand the root of the issue.

You can navigate the logs of the LSP server: https://rustdocs.rome.tools/rome_cli/index.html#logs

ematipico avatar Feb 26 '23 15:02 ematipico

Ok good news, I can get it to stall on a particular file I have. But Rome and Rome Trace panels in VSCode tell me nothing. What next?

jpike88 avatar Feb 26 '23 15:02 jpike88

More useful info: if I run rome check or rome ci on that same file, it runs fine and doesn't get stuck. This seems to be specific to the language server implementation.

jpike88 avatar Feb 26 '23 15:02 jpike88

OK so looks like it was't one file in particular, it just decides at some arbitrary point to start playing up. Rome output terminal says nothing:

[cli-stdout] data 84
[cli] exit 0
Connecting to "/var/folders/0v/w61lqyb97l37zrp46x8s24900000gn/T/rome-socket-11.0.0-nightly.97e48b4" ...
[Info  - 14:18:32] Server initialized with PID: 84108

and Rome Trace is empty. But definitely only a problem limited to VSCode and not the CLI tool.

jpike88 avatar Feb 28 '23 06:02 jpike88

Screenshot 2023-02-28 at 1 34 21 pm

This happens when I try to just quit VSCode, whatever Rome's doing it's also blocking VSCode. Terminating the Rome process directly allows VSCode to quit properly, only other alternative is for VSCode to crash.

jpike88 avatar Feb 28 '23 06:02 jpike88

it just decides at some arbitrary point to start playing up

This is wrong, turns out it occurs on particaruly sensitive files. Whatever it's doing seems to be dependent on the file I'm trying to save.

But paste this file is either Rome tools playground, or trying via CLI works fine.

jpike88 avatar Feb 28 '23 06:02 jpike88

Great, we have some info.

It could be that documents are not synchronized anymore, of your VSCode has some configuration that uses Rome (maybe organized imports?)

Feel free to create a repo or provide the logs once you're able to replicate the issue.

ematipico avatar Mar 05 '23 15:03 ematipico

There are no logs, if there was anything worth providing I'd do it but as I said the log output for the Rome and Rome Trace outputs are practically empty.

What Rome needs is a proper debug mode that can spit out enough debug messages that it's useful to begin with, or even better spit out some kind of profiler or stack analyser that would allow you to generate a flame graph or something like that. Otherwise would be exceptionally difficult for me to try and create a reproducible case with this as it isn't happening in a predicable pattern.

jpike88 avatar Mar 06 '23 04:03 jpike88

Sorry I just realised I had to change trace to verbose in vscode settings for the extension. I'll see what it spits out

jpike88 avatar Mar 06 '23 04:03 jpike88

I have a file isolated with the problem (kind of) but prefer to send it to you privately. Let me know the best way

jpike88 avatar Mar 06 '23 04:03 jpike88

I'd like to investigate this issue since I'm trying to fix an utf encoding problem, maybe it can be relative.

denbezrukov avatar Mar 06 '23 07:03 denbezrukov

@denbezrukov I am happy to send you the file I mentioned privately, it's has a non-trivial amount of code in it

jpike88 avatar Mar 06 '23 14:03 jpike88

I'm also able to freeze the Rome playground with my example as well

jpike88 avatar Mar 06 '23 14:03 jpike88

@jpike88 Is it possible to send it on Discord?

denbezrukov avatar Mar 06 '23 15:03 denbezrukov

Sure, what's your username

jpike88 avatar Mar 06 '23 15:03 jpike88

Β @jpike88 Β Denis Bezrukov#0630 https://discord.gg/rome

denbezrukov avatar Mar 06 '23 20:03 denbezrukov

Since updating to latest nightly, I feel like this problem might be getting worse since it's happening on a file I don't remember having problems with previously. It's becoming extremely frustrating to use the Rome extension and I'm considering just disabling it. Is there any progress on figuring this out?

jpike88 avatar Mar 15 '23 06:03 jpike88

I'm still tackling problem with unicode. If anyone wants to help with this problem, that would be great.

denbezrukov avatar Mar 15 '23 07:03 denbezrukov

@jpike88 we're aware of the issue, there's no need to pressure.

We're just a bunch of volunteers trying to make the best out of it.

This behaviour is extremely unhelpful

ematipico avatar Mar 15 '23 09:03 ematipico

Oh? I thought Rome is funded?

jpike88 avatar Mar 15 '23 09:03 jpike88

I don't mean to pressure. I appreciate the work you guys are doing, and will just bear with it. If I could code in Rust I would have contributed already especially to fixing this problem as it is quite acute.

jpike88 avatar Mar 15 '23 10:03 jpike88

Oh? I thought Rome is funded?

It was, yes. You can check discord for more info https://discord.com/channels/678763474494423051/678763474930761739/1068580995219083346

ematipico avatar Mar 15 '23 11:03 ematipico

Oh wow I didn't know! I'm sorry to hear about it.

Despite the situation I'm sticking with it, even with the current issues it's still a breath of fresh air to eslint, I could never go back. I'm certain you guys will find a continuing uptake of both funding and contributors in the meantime, don't lose hope, it's too good to ignore. I'm both happy it's in rust to maximise performance, not so happy I can't just jump in to make contributions so fast! Maybe it's time to brush up on some Rust...

jpike88 avatar Mar 15 '23 11:03 jpike88