-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Code causes TS Server to hang using 100% CPU and become non-responsive #23458
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
Comments
For the record: The reason it's nonresponsive is likely because we don't check cancellation tokens within @mhegazy Do you want us to make |
That makes sense and explains why it only manifests after I add the extra From my perspective it'd be very welcome if it could just cancel printing the type and be responsive to other requests because I don't care about actually seeing the expanded type there, I just want the static typing and ideally the autocomplete from it. Also based on that information it sounds like this is related to #18754, #6070 and #13095. |
@mhegazy we've added the cancellation - is there anything else we want to do here? |
We should add a limit on the generated type.. both for performance and for readability purposes.. |
We just want to truncate signature help and quick info, right? |
Our current truncation logic is not ideal for readability, but more importantly, it does not save the work, we will do the work, generate a humongous string, then truncate it. we would be better off both for readability and performance to have a smarter "truncation" logic that is deeper in the stack. |
@kpdonn we now have truncation enabled in our LS requests - if you could try tonight's nightly at some point and give us a holler as to weather it's made the experience better, that'd be nice. |
TypeScript Version: 2.9.0-dev.20180414 (also reproduces in 2.8.1)
Search Terms:
TSServer, CPU, autocomplete
Code
Steps to reproduce
Unfortunately I haven't been able to produce a self contained reproduction, but I can reproduce it consistently in the project I'm working on using just the code above. Specific steps:
autocompleteHangsBug
branch)yarn
to get dependenciestypings-tests/autocompleteBug.ts
in VS Code.db.with("a", db.
in that file and try to autocomplete. Note that actually typing it does matter. It does not reproduce for me if not manually typed.Logs
I enabled verbose tsserver trace logs, however the only output it logs once it starts hanging is the following.
I didn't see any stack traces or anything that seemed interesting before those lines start appearing, but if providing the logs will help let me know and I'll add them.
What triggers it
I don't have any idea what the root cause is, but I know what makes it start happening. This change in
everything.ts.
When I removeBeforeSelect
that was added there try to follow the steps to reproduce it again(after restarting tsserver), it no longer happens.BeforeSelect
is a mapped type that filters out a handful of methods fromSqlBuilder
. The code creating the types is pretty complicated, but I don't know why that specifically triggers the problem.Related Issues:
Possibly #23390, #23259 or #23389.
The text was updated successfully, but these errors were encountered: