-
Notifications
You must be signed in to change notification settings - Fork 219
Prevent faulty third-party plugins to crash the server #154
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
Conversation
Hey @arian-f, thanks a lot for your contribution! I think this is an error in one of the PyLSP plugins, so it shouldn't be solved this way, but in the plugin itself. Could you post the output of |
yes, it's caused by
|
if you decide not to handle this kind of exception, it may still be beneficial to catch any exceptions there, make a warning of the offending plugin and then reraise the excpetion. As you see in the trace above, the offending plugin is not in the trace but rather it goes to pkg_resources. pkg_resources indicates a problem with toml, but the problem may as well be with pylsp-black not correctly specifying its dependencies. (Hope it's clear what's meant) With the exception caught the offending plugin is printed. |
I think that's a great idea! But instead of re-raising the exception, we should simply log it (as we're doing right now), so the server doesn't crash due to a faulty plugin. @arian-f, could you take care of that? |
I think I misunderstand your meaning: you're not saying spyder should catch the exception and log it? |
catch all exceptions to log them instead of specific exceptions. Co-authored-by: Carlos Cordoba <ccordoba12@gmail.com>
right, I merged your change. |
Co-authored-by: Carlos Cordoba <ccordoba12@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your help with this one @arian-f!
Note: After a careful look, I think issue #153 is not solved by this. |
I'm using this in spyder. There on loading pylsp-black, I get this error:
Which prevents LSP to start (in the status bar, LSP starting spins indefenitely)
not sure why it's not the expected ImportError, but when also catching the pkg_resources.DistributionNotFound spyder seems to work correctly minus the LSP plugin.
Not sure whether this is the way to go, but it seems to me in the spirit of the context, that is catching plugin's errors on loading.