Fix: Correctly transfer FD ownership in polling event loop#15650
Merged
straight-shoota merged 1 commit intocrystal-lang:masterfrom Apr 13, 2025
Merged
Conversation
It only takes ownership the first time a fd is waited upon, and then never checked anymore. It causes issues where connecting a socket in one fiber then trying to read with a timeout in other fiber will never resume on IO ready, because we must be able to cancel the timer to be able to resume the fiber (oops). It also causes cross event loop instances enqueues that are fine with preview MT, but invalid with execution context MT.
beta-ziliani
approved these changes
Apr 10, 2025
straight-shoota
approved these changes
Apr 10, 2025
Qard
approved these changes
Apr 11, 2025
Contributor
|
Does this fix this ? AFAIK, above issue still happen on 1.16.0 |
Contributor
|
New regression issue #15658 since this PR was merged. |
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An event loop only takes ownership the first time a
fdis waited upon, and then never checks whether the current event loop owns thefd.It causes issues where connecting a socket in one fiber then trying to read with a timeout in other fiber will never resume on IO ready, because we must be able to cancel the timer to be able to resume the fiber (oops).
It also causes cross event loop instances enqueues that are fine with preview MT (inefficient, but it would push the fiber to its thread), but invalid with execution context MT as it would transfer a fiber to another context 😨
closes #15647