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

zloop: ignore EINTR from poll if nonstop is enabled #2285

Merged
merged 2 commits into from
Apr 12, 2024

Conversation

oko256
Copy link
Contributor

@oko256 oko256 commented Apr 9, 2024

If SIGINT signal arrives while poll is blocking, regardless of attached signal handler it will cause the poll to return with errno EINTR. Currently, this causes zloop to return from the event loop. For nonstop mode to work as intended, we have to ignore EINTR in this case.

Added test cases that verify the functionality when catching an actual SIGINT signal with and without nonstop mode. Tested in Linux and Windows.

Fixes #2284

@oko256
Copy link
Contributor Author

oko256 commented Apr 9, 2024

According to CI it seems like MacOS is not happy with the way I try to test this. I'll try to figure out why.

If SIGINT signal arrives while poll is blocking, regardless of attached
signal handler it will cause the poll to return with errno EINTR.
Currently, this causes zloop to return from the event loop. For nonstop
mode to work as intended, we have to ignore EINTR in this case.

Added test cases that verify the functionality when catching an actual
SIGINT signal with and without nonstop mode. Tested in Linux and
Windows.
On macOS, in zsock STREAM test, when STREAM zsock was bound with
`tcp://*:*`, the respective connect to `tcp://127.0.0.1:<port>` was
unable to connect and got stuck indefinitely. Fixed by binding to
`tcp://127.0.0.1:*` instead like in other tests in zsock.
@oko256
Copy link
Contributor Author

oko256 commented Apr 10, 2024

The zloop macOS test issue was just too strict timing requirement on the test, so I relaxed those requirements a bit and now it passes nicely. The functionality itself was working just fine.

I also noticed that zsock tests have been failing apparently for some time on macOS, so I fixed that issue as well: other tests in zsock bind to 127.0.0.1:* but STREAM test was binding to *:* which didn't work on macOS and changing that fixed macOS tests as well.

@sphaero sphaero merged commit 774eb3b into zeromq:master Apr 12, 2024
9 of 11 checks passed
@sphaero
Copy link
Contributor

sphaero commented Apr 12, 2024

Thanks!

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.

zloop: nonstop does not work as intended (EINTR breaks loop)
2 participants