Skip to content

Wrap loop_yield() in rb_protect() - #217

Merged
samuel-williams-shopify merged 3 commits into
mainfrom
uninterruptible-cancellation
Aug 26, 2026
Merged

Wrap loop_yield() in rb_protect()#217
samuel-williams-shopify merged 3 commits into
mainfrom
uninterruptible-cancellation

Conversation

@tavianator

@tavianator tavianator commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

IO_Event_Selector_URing_Waiting_cancel_and_wait is designed to keep
on-stack variables alive while io_uring might still access them. But if
the fiber is interrupted inside the while (waiting->completion) loop,
we may not wait long enough. Fix this by wrapping the loop body in
rb_protect so we can clean up completely.

Types of Changes

  • Bug fix.

Contribution

@tavianator
tavianator force-pushed the uninterruptible-cancellation branch from 7946dee to d80c7dc Compare August 26, 2026 21:28
tavianator and others added 3 commits August 27, 2026 11:05
`IO_Event_Selector_URing_Waiting_cancel_and_wait` is designed to keep
on-stack variables alive while io_uring might still access them.  But if
the fiber is interrupted inside the `while (waiting->completion)` loop,
we may not wait long enough.  Fix this by wrapping the loop body in
`rb_protect` so we can clean up completely.

Fixes: #216
Signed-off-by: Samuel Williams <samuel.williams@shopify.com>
Assisted-By: devx/efad4cc8-cf12-4d6e-8c55-6f2c3a6683d2
Signed-off-by: Samuel Williams <samuel.williams@shopify.com>
Assisted-By: devx/efad4cc8-cf12-4d6e-8c55-6f2c3a6683d2
@samuel-williams-shopify
samuel-williams-shopify force-pushed the uninterruptible-cancellation branch from f479246 to 93c3b62 Compare August 26, 2026 23:05
@samuel-williams-shopify
samuel-williams-shopify merged commit b3cb352 into main Aug 26, 2026
58 of 64 checks passed
@samuel-williams-shopify
samuel-williams-shopify deleted the uninterruptible-cancellation branch August 26, 2026 23:32
ioquatix pushed a commit that referenced this pull request Aug 27, 2026
`IO_Event_Selector_URing_Waiting_cancel_and_wait` is designed to keep
on-stack variables alive while io_uring might still access them.  But if
the fiber is interrupted inside the `while (waiting->completion)` loop,
we may not wait long enough.  Fix this by wrapping the loop body in
`rb_protect` so we can clean up completely.
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