Title: Code causes TS Server to hang using 100% CPU and become non-responsive · Issue #23458 · microsoft/TypeScript · GitHub
Open Graph Title: Code causes TS Server to hang using 100% CPU and become non-responsive · Issue #23458 · microsoft/TypeScript
X Title: Code causes TS Server to hang using 100% CPU and become non-responsive · Issue #23458 · microsoft/TypeScript
Description: 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 consis...
Open Graph Description: 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 rep...
X Description: 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...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/23458
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Code causes TS Server to hang using 100% CPU and become non-responsive","articleBody":"\u003c!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->\r\n**TypeScript Version:** 2.9.0-dev.20180414 (also reproduces in 2.8.1)\r\n\r\n\u003c!-- Search terms you tried before logging this (so others can find this issue more easily) -->\r\n**Search Terms:** \r\nTSServer, CPU, autocomplete\r\n\r\n**Code**\r\n\r\n\r\n\r\n**Steps to reproduce**\r\n\r\nUnfortunately 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:\r\n\r\n1. Clone https://github.com/kpdonn/kpd-sql/tree/autocompleteHangsBug (note the `autocompleteHangsBug` branch)\r\n2. Run `yarn` to get dependencies \r\n3. Open [`typings-tests/autocompleteBug.ts`](https://github.com/kpdonn/kpd-sql/blob/autocompleteHangsBug/typings-tests/autocompleteBug.ts) in VS Code.\r\n4. Type `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.\r\n5. The TS service hangs and stops responding to any requests. CPU on my machine (macOS) shoots up to 100% and stays there.\r\n\r\n**Logs**\r\nI enabled verbose tsserver trace logs, however the only output it logs once it starts hanging is the following.\r\n\r\n```\r\n[Trace - 00:06:49] TypeScript Service: canceled request with sequence number 46\r\n[Trace - 00:06:50] TypeScript Service: canceled request with sequence number 49\r\n[Trace - 00:06:50] TypeScript Service: canceled request with sequence number 51\r\n[Trace - 00:06:55] TypeScript Service: canceled request with sequence number 55\r\n[Trace - 00:06:56] TypeScript Service: canceled request with sequence number 57\r\n[Trace - 00:06:57] TypeScript Service: canceled request with sequence number 58\r\n[Trace - 00:06:57] TypeScript Service: canceled request with sequence number 59\r\n[Trace - 00:06:58] TypeScript Service: canceled request with sequence number 60\r\n[Trace - 00:06:59] TypeScript Service: canceled request with sequence number 61\r\n```\r\n\r\nI 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.\r\n\r\n**What triggers it**\r\nI don't have any idea what the root cause is, but I know what makes it start happening. [This change in `everything.ts.`](https://github.com/kpdonn/kpd-sql/commit/50f1b7b45fac2cc25866945a987a94e18d43e7e0#diff-05dd9d3bb30ffcc3fa5e66f5093d36b1R791) When I remove `BeforeSelect` 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 from `SqlBuilder`. The code creating the types is pretty complicated, but I don't know why that specifically triggers the problem.\r\n\r\n**Related Issues:**\r\nPossibly #23390, #23259 or #23389.","author":{"url":"https://github.com/kpdonn","@type":"Person","name":"kpdonn"},"datePublished":"2018-04-17T05:39:04Z","url":"https://github.com/microsoft/TypeScript/issues/23458"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:5f39034a-f4a3-5905-30b2-2a7f7bc5a33c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DA26:161320:CD55D8:11087A9:6B01CAA4 |
| html-safe-nonce | 7a5e432baf6fefcb2bfa3a56a21e85158985cc34357ad1c88986f840c51fea4b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQTI2OjE2MTMyMDpDRDU1RDg6MTEwODdBOTo2QjAxQ0FBNCIsInZpc2l0b3JfaWQiOiI1NzI0MzQ0MTA0ODA1MDU5MjM2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | f4c5d4e47427bc30766812e5da3993d4931251dd753f8f406d587b131f2cb0e8 |
| hovercard-subject-tag | issue:314912399 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/23458/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ba7a739ee446175bb905f48dc5dcdbf47eab37ead9adf7fcde926b0468c8fcb6/microsoft/TypeScript/issues/23458 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ba7a739ee446175bb905f48dc5dcdbf47eab37ead9adf7fcde926b0468c8fcb6/microsoft/TypeScript/issues/23458 |
| og:image:alt | 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 rep... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | kpdonn |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 20929025 |
| octolytics-dimension-repository_nwo | microsoft/TypeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20929025 |
| octolytics-dimension-repository_network_root_nwo | microsoft/TypeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width