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

Fix Select selector backend per-IO waiter queue handling #63

Merged
merged 1 commit into from
Jul 26, 2023

Conversation

Math2
Copy link
Contributor

@Math2 Math2 commented Jul 24, 2023

When multiple fibers wait on different events for the same IO object and only a subset of the polled events happen, some of the fibers could be woken up prematurely (with a subset of the events they asked for) and dropped from the queue.

Fix by re-inserting the waiters into the IO object's queue when none of their events were triggered.

Types of Changes

  • Bug fix.

Contribution

I tried to modify the existing code as little as possible to fix this, but it's really starting to make the per-IO queue handling way more complicated than it should be...

When multiple fibers wait on different events for the same IO object and
only a subset of the polled events happen, some of the fibers could be
woken up prematurely (with a subset of the events they asked for) and
dropped from the queue.

Fix by re-inserting the waiters into the IO object's queue when none of
their events were triggered.
@ioquatix
Copy link
Member

This looks good to me. Thanks for including a test. I'll think about the queue implementation.

@ioquatix ioquatix merged commit f34e4aa into socketry:main Jul 26, 2023
@ioquatix
Copy link
Member

Thanks for this, I'm going to merge it as it fixes the issue, but I might re-evaluate how the IO wait queue is handled.

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