Skip to content

Support for TSServer Request Cancelation - #22437

Merged
Matt Bierner (mjbvz) merged 1 commit into
microsoft:masterfrom
mjbvz:ts-cancel
Mar 20, 2017
Merged

Matt Bierner (mjbvz) merged 1 commit into
microsoft:masterfrom
mjbvz:ts-cancel

Conversation

@mjbvz

@mjbvz Matt Bierner (mjbvz) commented Mar 11, 2017 •

Copy link
Copy Markdown
Contributor

#18053

Adds support for canceling ongoing TSServer requests using per request cancelation. This PR is a WIP currently.

Vladimir Matveev (@vladima) and Mohamed Hegazy (@mhegazy) can you take a quick look at the PR to see if it looks correct. I keep getting error from the TSServer that look like this:

shell.ts:468 Error processing request. Mismatched request id, expected undefined, actual 4
Error: Mismatched request id, expected undefined, actual 4
    at Object.resetRequest (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/cancellationToken.js:57:27)
    at IOSession.Session.resetCurrentRequest (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:73291:40)
    at IOSession.Session.executeWithRequestId (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:73299:26)
    at IOSession.Session.executeCommand (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:73305:33)
    at IOSession.Session.onMessage (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:73325:35)
    at Interface.<anonymous> (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:74477:27)
    at emitOne (events.js:96:13)
    at Interface.emit (events.js:188:7)
    at Interface._onLine (readline.js:232:10)
    at Interface.<anonymous> (readline.js:365:12)

It seems the expected request is never set. I think there is a bug on this line with currentRequestId = currentRequestId: https://github.com/Microsoft/TypeScript/blob/6117ed77087b5d84774ee545bd3cad3d059caa75/src/server/cancellationToken/cancellationToken.ts#L51

Here's a PR with a fix: microsoft/TypeScript#14594

@mjbvz Matt Bierner (mjbvz) self-assigned this Mar 11, 2017
Matt Bierner (mjbvz) pushed a commit to microsoft/TypeScript that referenced this pull request Mar 11, 2017
While working on microsoft/vscode#22437, I believe there is a bug in the per request cancellation in the  `setRequest` function on the line `currentRequestId = currentRequestId ;` This causes `currentRequestId` to always be undefined

Fix is to assign the `currentRequestId` to `requestId`
Mohamed Hegazy (mhegazy) pushed a commit to microsoft/TypeScript that referenced this pull request Mar 13, 2017
While working on microsoft/vscode#22437, I believe there is a bug in the per request cancellation in the  `setRequest` function on the line `currentRequestId = currentRequestId ;` This causes `currentRequestId` to always be undefined

Fix is to assign the `currentRequestId` to `requestId`
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants