sublimelsp / LSP-file-watcher-chokidar

Chokidar-based file watcher implementation for LSP
MIT License
18 stars 1 forks source link

KeyError on on_payload #7

Open giampaolo opened 8 months ago

giampaolo commented 8 months ago

I cannot tell how to reproduce this reliably, but sometimes I get:

LSP-file-watcher-chokidar: ERROR: on_payload(): Handler already deleted
LSP-file-watcher-chokidar: ERROR: on_payload(): Handler already deleted
Traceback (most recent call last):
  File "/home/giampaolo/.config/sublime-text/Installed Packages/LSP.sublime-package/plugin/core/transports.py", line 155, in invoke
  File "/home/giampaolo/.config/sublime-text/Installed Packages/LSP-file-watcher-chokidar.sublime-package/watcher.py", line 233, in on_payload
KeyError: '45'
LSP-file-watcher-chokidar: ERROR: on_payload(): Handler already deleted
LSP-file-watcher-chokidar: ERROR: on_payload(): Handler already deleted
Traceback (most recent call last):
  File "/home/giampaolo/.config/sublime-text/Installed Packages/LSP.sublime-package/plugin/core/transports.py", line 155, in invoke
  File "/home/giampaolo/.config/sublime-text/Installed Packages/LSP-file-watcher-chokidar.sublime-package/watcher.py", line 233, in on_payload
KeyError: '45'
LSP-file-watcher-chokidar: ERROR: on_payload(): Handler already deleted
LSP-file-watcher-chokidar: ERROR: on_payload(): Handler already deleted
Traceback (most recent call last):
  File "/home/giampaolo/.config/sublime-text/Installed Packages/LSP.sublime-package/plugin/core/transports.py", line 155, in invoke
  File "/home/giampaolo/.config/sublime-text/Installed Packages/LSP-file-watcher-chokidar.sublime-package/watcher.py", line 233, in on_payload
KeyError: '45'
LSP-file-watcher-chokidar: ERROR: on_payload(): Handler already deleted
LSP-file-watcher-chokidar: ERROR: on_payload(): Handler already deleted
Traceback (most recent call last):
  File "/home/giampaolo/.config/sublime-text/Installed Packages/LSP.sublime-package/plugin/core/transports.py", line 155, in invoke
  File "/home/giampaolo/.config/sublime-text/Installed Packages/LSP-file-watcher-chokidar.sublime-package/watcher.py", line 233, in on_payload
KeyError: '45'
LSP-file-watcher-chokidar: ERROR: on_payload(): Handler already deleted
LSP-file-watcher-chokidar: ERROR: on_payload(): Handler already deleted
Traceback (most recent call last):
  File "/home/giampaolo/.config/sublime-text/Installed Packages/LSP.sublime-package/plugin/core/transports.py", line 155, in invoke
  File "/home/giampaolo/.config/sublime-text/Installed Packages/LSP-file-watcher-chokidar.sublime-package/watcher.py", line 233, in on_payload
KeyError: '45'

For me this typically happens on save, and I have some other plugins which may edit the view's text, so that is probable related.

rchl commented 8 months ago

Which LSP packages are you using?

Also if you can catch this when this happens then it would also be useful to provide output from LSP: Log Panel.

giampaolo commented 8 months ago

My LSP packages are:

        "LSP",
        "LSP-bash",
        "LSP-file-watcher-chokidar",
        "LSP-json",
        "LSP-pyright",

Unfortunately I cannot reproduce it right now. :(

photex commented 7 months ago

I've just started working on an LSP-OmniSharp update and I'm seeing this a lot:

reloading settings Packages/LSP-OmniSharp/LSP-OmniSharp.sublime-settings
Traceback (most recent call last):
  File "/home/chipc/.config/sublime-text/Installed Packages/LSP.sublime-package/plugin/core/transports.py", line 155, in invoke
  File "/home/chipc/.config/sublime-text/Installed Packages/LSP-file-watcher-chokidar.sublime-package/watcher.py", line 233, in on_payload
KeyError: '38'
Traceback (most recent call last):
  File "/home/chipc/.config/sublime-text/Installed Packages/LSP.sublime-package/plugin/core/transports.py", line 155, in invoke
  File "/home/chipc/.config/sublime-text/Installed Packages/LSP-file-watcher-chokidar.sublime-package/watcher.py", line 233, in on_payload
KeyError: '38'
Traceback (most recent call last):
  File "/home/chipc/.config/sublime-text/Installed Packages/LSP.sublime-package/plugin/core/transports.py", line 155, in invoke
  File "/home/chipc/.config/sublime-text/Installed Packages/LSP-file-watcher-chokidar.sublime-package/watcher.py", line 233, in on_payload
KeyError: '38'
Traceback (most recent call last):
  File "/home/chipc/.config/sublime-text/Installed Packages/LSP.sublime-package/plugin/core/transports.py", line 155, in invoke
  File "/home/chipc/.config/sublime-text/Installed Packages/LSP-file-watcher-chokidar.sublime-package/watcher.py", line 233, in on_payload
KeyError: '38'
rchl commented 7 months ago

Does it happen after you edit the plugin file?

If so then it sounds like the code that is supposed to unregister the controller doesn't run. Not sure if it's a side effect of plugin reloading that happens on saving it, some bug or maybe even expected. Hard to say without reproduction steps.

photex commented 7 months ago

Ah yes, I’m seeing it during editing. I don’t see it during startup.

giampaolo commented 7 months ago

I've just started working on an LSP-OmniSharp update and I'm seeing this a lot:

Yep it also happens to me a lot. I ended up uninstalling LSP-file-watcher-chokidar because it caused too much noise in the output menu. :(

The error doesn't emit a full traceback, so it's not clear exactly where the exception is raised from, but the fix per se should be easy (check that key exists first).

rchl commented 7 months ago

I've just started working on an LSP-OmniSharp update and I'm seeing this a lot:

Yep it also happens to me a lot. I ended up uninstalling LSP-file-watcher-chokidar because it caused too much noise in the output menu. :(

The error doesn't emit a full traceback, so it's not clear exactly where the exception is raised from, but the fix per se should be easy (check that key exists first).

Are you also working on LSP packages? I need a way to reproduce to understand the issue and potentially fix it. Adding random checks is not necessarily a correct solution because in that case the watcher would still be live and keep using resources.

giampaolo commented 7 months ago

Are you also working on LSP packages?

No.

kapitanluffy commented 7 months ago

@giampaolo @photex in any case, are you guys using one of these packages? https://packagecontrol.io/browse/authors/kapitanluffy

It is happening to me too and I am trying to figure it out too on my end