Skip to content
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

Fix world's slowest stack overflow #123

Merged
merged 2 commits into from
Aug 29, 2023

Conversation

julienduchesne
Copy link
Member

@julienduchesne julienduchesne commented Aug 29, 2023

When dealing with CRDsonnet libraries in our (Grafana Labs) repositories, the language server would lock up and use up all my CPU:

  • I thought it had something to do with CRDsonnet but I was wrong.
  • This happened because it was trying to find a field in the wrong nodestack repeatedly (see image). It didn't crash because it didn't loop quick enough?
  • This PR fixes the issue.
  • Obviously, the language server can't find fields that come from processing jsonschema, but at least it doesn't take up 4 full CPUs (it reached 1% CPU usage while testing :) )

image

When dealing with CRDsonnet libraries in our (Grafana Labs) repositories, the language server would lock up:

- I thought it had something to do with CRDsonnet but I was wrong.
- This happened because it was trying to find a field in the wrong nodestack repeatedly (see image)
- This PR fixes the issue.
- Obviously, the language server can't find fields that come from processing jsonschema, but at least it doesn't take up 4 full CPUs (it reached a full 1% CPU usage while testing :) )
All tests are still passing. `$` can be resolved across multiple files, so I guess the language server is just better now and doesn't need that safety
If this causes a bug, we should add a new test
@julienduchesne julienduchesne marked this pull request as ready for review August 29, 2023 02:38
@julienduchesne julienduchesne merged commit a23b945 into main Aug 29, 2023
3 checks passed
@julienduchesne julienduchesne deleted the julienduchesne/fix-slow-stackoverflow branch August 29, 2023 12:10
@zalegrala
Copy link

😌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants