Skip to content

fix: improve EOFError exception when remote nvim crashes #589

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

Merged
merged 1 commit into from
Jan 30, 2025

Conversation

wookayin
Copy link
Member

@wookayin wookayin commented Jan 10, 2025

Problem: When the remote Nvim instance is aborted or terminates, the pynvim client will face an exception OSError: EOF. It is not very clear what is wrong and why EOF is received.

Solution: This happens when the remote the nvim process terminates unexpectedly (or a tcp/file socket is broken or gets disconnected). We can provide a bit more detailed information about why the asyncio session is stopping, through asyncio Protocol. An EOFError will be raised instead of OSError.

For example, during pynvim's unit tests we may see:

    EOFError: process_exited: pid = 40000, return_code = -6

which means that the Nvim subprocess (pid = 40000) exited unexpectedly after getting SIGABRT (signal 6), i.e. assertion failure. Other error messages such as SIGSEGV (signal 11) or connection lost (through socket) are also possible.

@wookayin wookayin requested a review from justinmk January 10, 2025 04:03
@wookayin wookayin force-pushed the handle-process-termination branch 2 times, most recently from 82d798f to 290203f Compare January 10, 2025 04:05
Copy link
Member

@justinmk justinmk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extremely useful!

@wookayin wookayin force-pushed the handle-process-termination branch 2 times, most recently from 5ff0407 to 06bfe75 Compare January 10, 2025 22:51
@justinmk
Copy link
Member

Mind rebasing?

Problem: When the remote Nvim instance is aborted or terminates, the
pynvim client will face an exception `OSError: EOF`. It is not very
clear what is wrong and why EOF is received.

Solution: This happens when the remote the nvim process terminates
unexpectedly (or a tcp/file socket is broken or gets disconnected). We
can provide a bit more detailed information about why the asyncio
session is stopping, through asyncio Protocol. An `EOFError` will be
raised instead of OSError.

For example, during pynvim's unit tests we may see:
```
    EOFError: process_exited: pid = 40000, return_code = -6
```
which means that the Nvim subprocess (pid = 40000) exited unexpectedly
after getting SIGABRT (signal 6).  Other error messages (different
signals such as SIGSEGV/segfault) or connection lost (when connected
through socket, etc.) are also possible.
@wookayin wookayin force-pushed the handle-process-termination branch from 06bfe75 to 7f0f4fb Compare January 30, 2025 17:06
@wookayin
Copy link
Member Author

Sorry for my recent inactivities. I've rebased and resolved the conflict, so please feel free to merge this one.

@justinmk justinmk merged commit ef3d029 into neovim:master Jan 30, 2025
24 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants