Skip to content
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

_eth_reader logs errors when read(2) hits EINTR and EAGAIN #368

Open
eschaton opened this issue Mar 15, 2024 · 3 comments
Open

_eth_reader logs errors when read(2) hits EINTR and EAGAIN #368

eschaton opened this issue Mar 15, 2024 · 3 comments

Comments

@eschaton
Copy link

When running a VAX simulator with networking via tap from the latest SIMH on NetBSD 9.3, I get periodic _eth_reader errors that the read would block.

This appears to be from the code in the HAVE_TAP_NETWORK calling read(2) and not handling the case where it returns <0 with errno set to EAGAIN or EINTR. The proper thing to do in those cases would be to treat the read(2) as having received 0 bytes, and retrying the loop.

I've worked around this centrally by wrapping the part that increases the error count and calls _eth_error() to avoid doing so when errno is set to EAGAIN or EINTR.

@pkoning2
Copy link
Member

The code is a bit hard to read, but... does it set non-blocking mode on the file descriptor? If not, EAGAIN would not be expected. And why would EINTR be returned?

@eschaton
Copy link
Author

It does appear to set non-blocking (look for FIONBIO).

@eschaton
Copy link
Author

Oh, and any UNIX system call can return EINTR at any time, Google "PC losering problem…"

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

No branches or pull requests

2 participants