-
Notifications
You must be signed in to change notification settings - Fork 7
Uncaught BrokenPipeError makes Neovim+deoplete unusable while error message is printing #14
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
Comments
I feel like I used to catch this… I did extensive testing around it. It disappeared amongst my attempt to refactor the code. The best commit to view how this should look is 5fd58b3 No need to print anything in case of BrokenPipeError, what is important is to remove the connection from the list of active ones. |
I see -- so if the connection is lost, the idea is to forget about that connection and silently wait for a new one? |
Removing the connection is to handle the case where someone is listening on a specific port (e.g. 5600) and then restarts the repl on that same port. If you didn't pop the connection, 99% of users would never notice. As it would appear to immediately resume working using the new port as supplied by acid/fireplace. |
This seems to be more complex by nature of me adopting an OO-style. My instinct tells me me to pass around a "deregister me" function into the right places so that it can be deregistered from the innermost point. No idea if this is possible or nice in python though. |
I took a brief look at the code, and if I'm not mistaken, don't we need to re-add the try/catch around these lines? Is it an issue of not having access to the list of connections in the context manager? If so, maybe a possible solution would be to pass the context manager around to functions that need it? I would also argue that global state is not always bad. I feel like for some things like active connections, it can be useful to define them at the top level so that they're easily accessible when some function deep down in the innards needs to access them. |
I think that global state is actually more confusing here.
The nrepl variable is expected to fulfil an "interface" (duck typed), this
allows for us to support both acid and fireplace.
It's possible someday that a plugin would handle its own persistent
connections (acid might do this, just coincidentally it uses the same
python library that clj omni uses, so the api is identical).
…On 12 Sep 2017 9:32 pm, "Dave Yarwood" ***@***.***> wrote:
I took a brief look at the code, and if I'm not mistaken, don't we need to
re-add the try/catch around these lines
<https://github.com/clojure-vim/async-clj-omni/blob/master/pythonx/async_clj_omni/cider.py#L53-L61>
?
Is it an issue of not having access to the list of connections in the
context manager? If so, maybe a possible solution would be to pass the
context manager around to functions that need it?
I would also argue that global state is not always bad. I feel like for
some things like active connections, it can be useful to define them at the
top level so that they're easily accessible when some function deep down in
the innards needs to access them.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#14 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AF2h2lQpo4gHvOpLMqtmT72Ub0TRO-xnks5shupNgaJpZM4PU5Wb>
.
|
I didn't clarify, by using a global var, you suddenly need to be more aware
about which client you're talking to, to choose the right global var for
example.
…On 12 Sep 2017 9:51 pm, "Dominic Monroe" ***@***.***> wrote:
I think that global state is actually more confusing here.
The nrepl variable is expected to fulfil an "interface" (duck typed), this
allows for us to support both acid and fireplace.
It's possible someday that a plugin would handle its own persistent
connections (acid might do this, just coincidentally it uses the same
python library that clj omni uses, so the api is identical).
On 12 Sep 2017 9:32 pm, "Dave Yarwood" ***@***.***> wrote:
> I took a brief look at the code, and if I'm not mistaken, don't we need
> to re-add the try/catch around these lines
> <https://github.com/clojure-vim/async-clj-omni/blob/master/pythonx/async_clj_omni/cider.py#L53-L61>
> ?
>
> Is it an issue of not having access to the list of connections in the
> context manager? If so, maybe a possible solution would be to pass the
> context manager around to functions that need it?
>
> I would also argue that global state is not always bad. I feel like for
> some things like active connections, it can be useful to define them at the
> top level so that they're easily accessible when some function deep down in
> the innards needs to access them.
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <#14 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AF2h2lQpo4gHvOpLMqtmT72Ub0TRO-xnks5shupNgaJpZM4PU5Wb>
> .
>
|
Ah, I see. After looking at this a bit more, I think another solution might be to add an Then, in If that approach sounds OK to you, I wouldn't make taking a crack at a PR for this. |
I tried hacking something up in my local clone of async-clj-omni in ~/.vim/bundle, and I think it might fix this issue. The Python I wrote is syntactically valid (initially it wasn't, and the plugin complained, then I fixed it), but I'm not 100% sure it will work yet. I should know soon, as I start using the plugin more today. If it works, I'm happy to make a PR out of my changes. |
Look forward to it. Make sure to update for both fireplace & acid. No need to test the one you don't use, best effort is enough. Can always fix it. |
Hmm, it looks like the AcidManager class has a It seems like the ideal thing might be to abstract out the connection management stuff so that both fireplace.py and acid.py can use it, and have both implementations handle BrokenPipeError by removing the connection from |
Uh oh!
There was an error while loading. Please reload this page.
I run into this problem fairly often, where I am developing in Neovim, connected to a REPL, and for one reason or another, I end up needing to restart the REPL, so I Ctrl-C it and restart. This breaks the plugin's connection to the REPL, so the next time deoplete needs to autocomplete something (i.e. I start typing), my typing is interrupted by a stacktrace, which I have to ENTER through one line at a time:
EDIT: I could have swore there was a BrokenPipeError printed at the bottom, before... I may have accidentally deleted that line. Ugh, sorry...
It's not clear to me if the root of the problem lies in deoplete or clj-async-omni, as I'm not sure how they interact with each other.
Assuming that clj-async-omni is at the top of the stack, would it make sense for clj-async-omni to catch BrokenPipeError and do something less cumbersome? (e.g. print an "nREPL connection was lost." message and stop trying to connect to it)
The text was updated successfully, but these errors were encountered: