Skip to content
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

Deno lsp showing false errors and stops linting new code, requires reloading window to resolve #10368

Closed
KyleJune opened this issue Apr 25, 2021 · 7 comments · Fixed by #10555
Assignees
Labels
bug Something isn't working correctly lsp related to the language server

Comments

@KyleJune
Copy link
Contributor

In the video linked below, both primaryGroupServiceTests and secondaryGroupServiceTests are a valid first argument for the test function. I recorded this last week and no longer have the code. I tried finding a minimum reproduction path but it seems to happen randomly. To capture it happening I just had to record myself coding. It was most common for me when using backspace or deleting lines. Sometimes I would have it happen to me after running deno fmt in the terminal. If I use the command to restart language server, it doesn't resolve the issue. I end up having to frequently use the reload window command to resolve the issue.

https://www.youtube.com/watch?v=9kmzApeIxp8

Here is a link to the start of a discord conversation where others had noted that they experienced the same issue as me. https://discord.com/channels/684898665143206084/684898665151594506/835903650152972368

@wperron
Copy link
Contributor

wperron commented Apr 25, 2021

Moving this as it is an LSP issue rather than a linting issue

@wperron wperron transferred this issue from denoland/deno_lint Apr 25, 2021
@wperron wperron added lsp related to the language server bug Something isn't working correctly labels Apr 25, 2021
@danopia
Copy link
Contributor

danopia commented Apr 25, 2021

I've been experiencing this pretty often (depending on what I'm working on, ranging from 1/hr up to every minute or two) and it seems to be some sort of 'stuck request' issue.

Before reloading the window I usually try running pkill deno in a terminal. This usually results in a huge pile of "Connection disposed" or "Connection to server is erroring" messages appearing. Often the lsp comes back up and then everything updates after the pkill, but other times it stays broken and I reload the editor.

I only recently found Restart Language Server and both times I tried it, the incorrect error spans went away, but nothing replaced them and I still had to reload the window.

Assuming this is the same issue, it's pretty hard to figure out what's not working; I'm not sure what debugging I can do once the bad state is recreated.

Here's an instance where I had already backspaced ApiResponse to Response and the LSP didn't notice, until I tried pkill deno then everything works again:

Untitled_.Apr.25.2021.7_32.PM.mp4

Here's a screenshot from 20 days ago showing the other message spam that often happens after pkill deno:

Screenshot 2021-04-03 07 17 17

@kitsonk kitsonk self-assigned this Apr 25, 2021
@danopia
Copy link
Contributor

danopia commented Apr 26, 2021

Here's an example (again, already stuck, as I haven't been generally screen recording) where the Restart LSP option doesn't restore the LSP health.

Notice how the deno lsp processes running afterwards are not recent. I suspect that the restart command is also hanging waiting for an LSP command to complete. It seems there's a "shutdown" command that is issued, deep down in VSCode: https://github.com/microsoft/vscode-languageserver-node/blob/faa68d90a976f158a8403a0f5cce54117ce61dbb/client/src/common/client.ts#L202 which would explain why the Restart LSP command doesn't work in this case.

Untitled_.Apr.26.2021.9_13.AM.mp4

I then did pkill deno which gave the Connection to server is erroring spam, but (likely because of the restart LSP attempt) didn't restore LSP health either in this case.

@kitsonk
Copy link
Contributor

kitsonk commented Apr 30, 2021

@danopia I created #10438 to add additional logging when the client sends deno.interernalDebug to true and spent the day trying to recreate it (I have had it happen a couple times) and I couldn't get it recreate. Hopefully once the PRs get reviewed we can merge it and try to catch it a bit more in the wild.

My theory is that there are requests into tsc that are hanging for an unknown reason, that would explain all the subsequent behaviours, the problem is I just don't know what request it is. The additional debug logging should help try to catch it, or at least be able to see if there is an easy way to reproduce.

@danopia
Copy link
Contributor

danopia commented Apr 30, 2021

I'll definitely give that flag a try when it's available. I've had this happen a dozen times in one session, and any way of gathering info on what's not working should be useful 😃

I suspect that a slower machine leads to more occurences; just a hunch right now, but I seem to get more hangs when a deno --watch process is doing repeated checks in the background, which would create some competition for processor time.

@KyleJune
Copy link
Contributor Author

I suspect that a slower machine leads to more occurrences; just a hunch right now, but I seem to get more hangs when a deno --watch process is doing repeated checks in the background, which would create some competition for processor time.

My machine is fast and has 24GB of ram and I had it happening frequently. I don't use deno --watch but I do run tests frequently as I work on code. I'm using VS Code with WSL: Ubuntu-20.04.

@kitsonk
Copy link
Contributor

kitsonk commented May 7, 2021

Ok, I haven't been able to use debug builds of my Deno on my machine for an extended period of time due to another bug, and now that that is fixed, I have been able to run debug builds on my machine. Debug builds run significantly slower than release builds which means they tend to catch these things a lot easier and lo and behold, I was working on a project where I was getting these hangs ever couple of minutes, so I switched over to the diagnostic branch and caught it, which is giving me more information to narrow down what is going on.

So I have at least a set of breadcrumbs to try to chase down now. It looks like some sort of deadlock issue in tsc, which is sort of what I expected, thought I don't know exactly what it is yet.

kitsonk added a commit to denoland/vscode_deno that referenced this issue May 11, 2021
Also integrate upstream formatting changes in deno fmt.

Ref: denoland/deno#10368
@ry ry closed this as completed in #10555 May 11, 2021
LumaKernel added a commit to LumaKernel/coc-denoland that referenced this issue Aug 7, 2021
* feat: code lens for references (denoland#308)

* feat: disable most of builtin language service when deno enabled (denoland#307)

* 0.0.8

* feat: add applyCodeActionCommand command (denoland#312)

* fix: remove deno/applyCodeActionCommand (denoland#315)

* New high-res logo (denoland#274)

* feat: add implementations code lens configuration option (denoland#319)

* feat: add initialize workspace command (denoland#316)

* feat: support deno cache quick fix (denoland#322)

* chore: add screenshot to README (denoland#323)

* 0.0.9

* 0.0.10

* fix: typo in init command (denoland#327)

* feat: add a welcome screen for extension (denoland#329)

* feat: use preview instead of display for status (denoland#330)

* chore: README improvements (denoland#331)

* Release 3.0.0, canary is now main (denoland#332)

* 3.0.1

* Fix typo (denoland#337)

Grammar + context

* chore: activate extension on command (denoland#336)

* docs: recommend import_map.json instead of import-map.json (denoland#340)

Resolves denoland#338

* chore: move Releases.md to CHANGELOG.md for better marketplace integration (denoland#344)

Closes denoland#342

* feat: add deno.path setting (denoland#350)

* 3.1.0

* feat: read-add debug support (denoland#351)

Co-authored-by: CGQAQ <[email protected]>

* feat: add settings to affect completions (denoland#368)

* fix: manual `deno` command resolution on windows. (denoland#367)

Fixes denoland#361

* 3.2.0

* feat: support for relative path resolution (using workspaces) in deno.path (denoland#381)

Co-authored-by: Kitson Kelly <[email protected]>

* feat: add version notification message (denoland#383)

* feat: add restart language server command (denoland#385)

Resolves denoland#372

* feat: add support for import registry completions (denoland#380)

* 3.3.0

* typo in ImportCompletions.md (denoland#390)

* fix: activate on reloadImportRegistries command (denoland#407)

Fixes: denoland#394

* feat: handle per resource configuration (denoland#411)

Requires Deno with denoland/deno#10488.

Ref: denoland#348 
Resolves: denoland#314
Resolves: denoland#297

* feat: add internalDebug config flag (denoland#406)

Also integrate upstream formatting changes in deno fmt.

Ref: denoland/deno#10368

* 3.4.0

* feat: recognise json(c) & markdown files (denoland#404)

* 3.5.0

* docs: fix broken link in README (denoland#426)

* feat: support registry auto discovery (denoland#427)

* fix: bump semver of extension (denoland#429)

* 3.5.1

* feat: add support for tasks and test code lens (denoland#436)

* 3.6.0

* fix: update packaging and pin vsce version (denoland#440)

Fixes denoland#439

* 3.6.1

* feat: add support for import map in test code lens (denoland#446)

* fix: activate extension on markdown / json / jsonc (denoland#447)

* fix: setting then clearing "deno.path" config should not use empty string for path (denoland#452)

* fix: better handling when language server fails to start (denoland#454)

* 3.7.0

* fix: remove trailing slash in example (denoland#471)

* chore: remove test header from bug report issue template (denoland#479)

* feat: add ability to set cache directory in settings (denoland#477)

Closes denoland#287

* fix: properly handle plugin configuration at startup (denoland#474)

Fixes denoland#473

Co-authored-by: Kitson Kelly <[email protected]>
Co-authored-by: Luca Casonato <[email protected]>
Co-authored-by: Kirill Reunov <[email protected]>
Co-authored-by: Liam Murphy <[email protected]>
Co-authored-by: Ryan Dahl <[email protected]>
Co-authored-by: Jesse Jackson <[email protected]>
Co-authored-by: CGQAQ <[email protected]>
Co-authored-by: David Sherret <[email protected]>
Co-authored-by: Hector Menendez <[email protected]>
Co-authored-by: Heyward Fann <[email protected]>
Co-authored-by: Satya Rohith <[email protected]>
Co-authored-by: yaegassy <[email protected]>
Co-authored-by: Cedric Vangout <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly lsp related to the language server
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants