-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix world's slowest stack overflow (#123)
* Fix world's slowest stack overflow 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 :) ) * Remove unneeded boolean 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
- Loading branch information
1 parent
9708978
commit a23b945
Showing
5 changed files
with
62 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
local drone = import './goto-infinite-recursion-bug-2.libsonnet'; | ||
{ | ||
steps: drone.step.withCommands([ | ||
'blabla', | ||
]), | ||
} |
15 changes: 15 additions & 0 deletions
15
pkg/server/testdata/goto-infinite-recursion-bug-2.libsonnet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
local drone = import './goto-infinite-recursion-bug-3.libsonnet'; | ||
{ | ||
pipeline: | ||
drone.pipeline.docker { | ||
new(name): | ||
super.new(name) | ||
+ super.clone.withRetries(3) | ||
+ super.clone.withDepth(10000) | ||
+ super.platform.withArch('amd64') | ||
+ super.withImagePullSecrets(['dockerconfigjson']), | ||
}, | ||
|
||
step: | ||
drone.pipeline.docker.step, | ||
} |
13 changes: 13 additions & 0 deletions
13
pkg/server/testdata/goto-infinite-recursion-bug-3.libsonnet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
local lib = | ||
{ | ||
pipeline: { | ||
docker: { | ||
step: { | ||
withCommands(commands): {}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
|
||
lib |