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

Prefer kqueue when on OSX >= v10.12.2 #268

Merged

Conversation

jcmfernandes
Copy link
Contributor

@jcmfernandes jcmfernandes commented Feb 21, 2021

Description

This a regression I introduced in 2.5.5 (sorry!). I got my hands on a Mac to confirm it (and test this fix).

I'm also taking the chance to address #266 (comment) as given that we check for linux/io_uring.h in extconf.rb, and that header was only introduced in Linux 5.1, my change is safe. In fact, while libev was looking for Linux >= 4.14 to compile safely, the backend is only activated on systems with kernel >= 5.6.1.

Types of Changes

  • Bug fix.

Testing

  • I added tests for my changes.
  • I tested my changes locally.
  • I tested my changes in staging.
  • I tested my changes in production.

We guarantee that the system supports io_uring by checking the presence of
header linux/io_uring.h in extconf.rb and libev includes a runtime check that
hides the io_uring backend if the kernel < 5.6.1.
Oops! I failed here. Nothing major, but I removed the kqueue suggestion by
mistake.
@ioquatix ioquatix merged commit 90d9599 into socketry:master Feb 21, 2021
@ioquatix
Copy link
Member

Should I release v2.5.6 with these changes?

@ioquatix ioquatix added this to the v2.5.6 milestone Feb 21, 2021
@jcmfernandes
Copy link
Contributor Author

Thanks for the quick reply @ioquatix!

I don't fully grasp the performance impact of using poll instead of kqueue on OSX. But given that probably no one uses OSX in production, and therefore this only impacts development environments, IMHO it's not an urgent fix that requires a release. Proof is that no one reported it; I noticed it while reading the code.

At the same time, if releasing isn't much of an hassle, it becomes a "why not?".

I would love to get more information on #266 but it seems like the reporter went missing.

@ioquatix
Copy link
Member

kqueue is the event driven notification system which has efficient registration. poll is just a slightly more generic interface than select but performance is comparable (bad).

@tarcieri
Copy link
Contributor

The reason kqueue wasn't the default for macOS in the past was due to alleged bugs:

http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#OS_X_AND_DARWIN_BUGS

See also #125

@ioquatix
Copy link
Member

Yeah, it's notoriously unreliable, and I'm not sure if that's still the case, but when I did enable it a year or so ago, I felt it was stable enough (all tests in async were passing).

@smridge
Copy link

smridge commented Mar 5, 2021

I'm also taking the chance to address #266 (comment) as given that we check for linux/io_uring.h in extconf.rb, and that header was only introduced in Linux 5.1, my change is safe. In fact, while libev was looking for Linux >= 4.14 to compile safely, the backend is only activated on systems with kernel >= 5.6.1.

I can confirm this was resolved! Many 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.

4 participants