Skip to content

Handle EINTR to avoid crashing tests when debugging #156

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hornang
Copy link
Contributor

@hornang hornang commented May 13, 2025

I have experienced that the unit tests crashes when running them with a debugger and stopping at breakpoints. This is inconvenient.

I found out that it is probably the debugger's signal handlers that interferes with the system calls inside Mio as described in the libc manual.

The EINTR error propagates up to code in tlsserver.rs and it seems I can handle this by ignoring that particular error and call poll() again.

When running tests with a debugger on Linux, Mio's poll function may return
EINTR (interrupted system call) after halting on breakpoints, which causes the
test to panic.

The documentation for std::io::ErrorKind::Interrupted states that "interrupted
operations can typically be retried." This commit adds a conditional to ignore
this specific error and continue polling.
@hornang hornang force-pushed the handle-eintr-to-avoid-crashing-tests-when-debugging branch from 92a8971 to 2e6cc92 Compare May 23, 2025 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant