Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

🐛 rome check . seems to run in an infinite loop with 99% CPU usage #3330

Closed
1 task done
RobinMalfait opened this issue Oct 4, 2022 · 3 comments · Fixed by #3339
Closed
1 task done

🐛 rome check . seems to run in an infinite loop with 99% CPU usage #3330

RobinMalfait opened this issue Oct 4, 2022 · 3 comments · Fixed by #3339
Assignees
Labels
A-Core Area: core S-Bug: confirmed Status: report has been confirmed as a valid bug

Comments

@RobinMalfait
Copy link

Environment information

OS Information:
- macOS Monterey, version 12.5.1 (21G83)
- Apple M1 Max

Context:
- Wanted to play with the new version in Tailwind CSS to see how it behaves when running `rome format . --write` or `rome check .`

Installation:
- `npm install rome@next --save-dev`

Versions:
- Node: v18.8.0
- NPM: 8.18.0

What happened?

Every now and then when you release a new version, I try to play with it on a real codebase, in my case I'm playing with things in the Tailwind CSS codebase (https://github.com/tailwindlabs/tailwindcss).

I basically installed rome:

npm install rome@next --save-dev

... once that was done, I executed:

rome check .

It shows a bunch of output already, but then just hangs, and it looks like this:
image

When I looked at activity monitor I saw this:
image

I eventually had to quit rome by using ctrl+c and luckily that worked without me force killing the process.

Expected result

I would have expected that the command (rome check .) did its job and once it was done, that it exited the process successfully.

Code of Conduct

  • I agree to follow Rome's Code of Conduct
@RobinMalfait RobinMalfait added the S-To triage Status: user report of a possible bug that needs to be triaged label Oct 4, 2022
@sebmck
Copy link
Contributor

sebmck commented Oct 4, 2022

I think I encountered something similar. It occurs during console printing after the lint run has completed. In my case it was trying to format a huge multi-megabyte file. Does that sound similar to your situation?

@RobinMalfait
Copy link
Author

Aha! Yep it's stuck on a 3.4 MB .js file. It's 116 281 lines of code long file. It's also a generated files so might be useful to ignore that one specific file.

Could be nice if Rome warned about large files and ignore them or ask you if it should be handled or not. Not sure, just thinking about improving the UX.

@leops
Copy link
Contributor

leops commented Oct 5, 2022

We already have a file size threshold to avoid printing the diff to the console if it's over 1 MiB, so the fix for this could simply be to move this check earlier in the pipeline, probably before we even start parsing (and it would also benefit the Language Server to avoid hogging CPU and memory when a user opens a minified bundle in their editor). It may need some sort of escape hatch though, like an --ignore-size-limit flag on the CLI for users that really do want to reformat a minified bundle ...

@leops leops added S-Bug: confirmed Status: report has been confirmed as a valid bug A-Core Area: core and removed S-To triage Status: user report of a possible bug that needs to be triaged labels Oct 5, 2022
@leops leops self-assigned this Oct 5, 2022
@ematipico ematipico added this to the 10.0.0 milestone Oct 5, 2022
@leops leops moved this to Done in Rome 2022 Oct 6, 2022
@ematipico ematipico removed this from the 10.0.0 milestone Oct 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Core Area: core S-Bug: confirmed Status: report has been confirmed as a valid bug
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants