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

NetBSD/OpenBSD compatibility for KQueue selector, some FreeBSD fixes #72

Merged
merged 2 commits into from
Aug 21, 2023

Conversation

Math2
Copy link
Contributor

@Math2 Math2 commented Aug 17, 2023

NetBSD/OpenBSD do not support EVFILT_USER. Use self-pipe trick already implemented for EPoll.

Fix two tests on NetBSD. One failed because NetBSD does not have bidirectional pipes (and did not return the expected errno). The other seems related to SIGCHLD timing.

Fix #process_wait failing erratically on BSDs. kevent() can return an EVFILT_PROC/NOTE_EXIT event before the process is ready to be picked up by a WNOHANG wait.

Types of Changes

  • Bug fix.
  • Maintenance.

Contribution

Notes

This is on top of the "main" branch, but it works well on top of "fix-file-descriptor-race" too.

There's a REALLY annoying issue with kevent() waiting on processes that are terminating but not "fully" terminated apparently. And the fix I found isn't pretty (but it works). I think it would be cleaner if ruby did a wait without WNOHANG later on for processes that we know are terminating. But that would be a lot more changes (right now WNOHANG is what makes it choose to not call back into the scheduler...).

Copy link
Member

@ioquatix ioquatix left a comment

Choose a reason for hiding this comment

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

Looking good, just some minor structural feedback.

ext/io/event/selector/kqueue.c Outdated Show resolved Hide resolved
NetBSD/OpenBSD do not support EVFILT_USER. Use self-pipe trick already
implemented for EPoll.

Fix two tests on NetBSD. One failed because NetBSD does not have
bidirectional pipes (and did not return the expected errno). The other
seems related to SIGCHLD timing.

Fix #process_wait failing erratically on BSDs. kevent() can return an
EVFILT_PROC/NOTE_EXIT event before the process is ready to be picked up
by a WNOHANG wait.
@ioquatix ioquatix merged commit 7a14eb7 into socketry:main Aug 21, 2023
19 of 22 checks passed
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.

2 participants