Skip to content

getCompletions in a very large array literal causes tsserver to spin #40100

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

Closed
minestarks opened this issue Aug 17, 2020 · 0 comments · Fixed by #40953
Closed

getCompletions in a very large array literal causes tsserver to spin #40100

minestarks opened this issue Aug 17, 2020 · 0 comments · Fixed by #40953
Assignees
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue

Comments

@minestarks
Copy link
Member

  1. Clone https://github.com/Leaflet/Leaflet
  2. Open route.js, which has a very large array declaration in it
  3. Trigger completion on the close brackets (]) in the middle of the array somewhere
  4. Watch tsserver eat 100% cpu for an hour

I haven't been able to attach to VS Code to take a callstack, but I have a tsserverfuzzer repro, which I believe is the same issue, and that one has the following callstack.

From stepping around in the debugger, the frame that it got stuck in seems to be findPrecedingMatchingToken - we never get out of that function.

find (tsserverlibrary.js:112323)
find (tsserverlibrary.js:112342)
find (tsserverlibrary.js:112342)
find (tsserverlibrary.js:112342)
find (tsserverlibrary.js:112342)
find (tsserverlibrary.js:112342)
find (tsserverlibrary.js:112342)
find (tsserverlibrary.js:112342)
findPrecedingToken (tsserverlibrary.js:112315)
findPrecedingMatchingToken (tsserverlibrary.js:112488)
getPossibleTypeArgumentsInfo (tsserverlibrary.js:112578)
isPossiblyTypeArgumentPosition (tsserverlibrary.js:112512)
isTypeOnlyCompletion (tsserverlibrary.js:116790)
filterGlobalCompletion (tsserverlibrary.js:116761)
getGlobalCompletions (tsserverlibrary.js:116734)
tryGetGlobalSymbols (tsserverlibrary.js:116625)
getCompletionData (tsserverlibrary.js:116419)
getCompletionsAtPosition (tsserverlibrary.js:115749)
getCompletionsAtPosition (tsserverlibrary.js:144114)
Session.getCompletions (tsserverlibrary.js:154586)
...

TypeScript Version: 3.9.3, 4.1.0-dev.2020081

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue
Projects
None yet
4 participants