Skip to content

fix(uring): cancel staged receives on worker drop - #3180

Merged
kixelated merged 8 commits into
devfrom
codex/fix-uring-worker-drop
Aug 30, 2026
Merged

fix(uring): cancel staged receives on worker drop#3180
kixelated merged 8 commits into
devfrom
codex/fix-uring-worker-drop

Conversation

@kixelated

@kixelated kixelated commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Append targeted asynchronous cancellation SQEs behind every staged receive and futex operation, preserving FIFO coverage across partial submissions.
  • Retry non-waiting submissions after partial progress and use a finite EINTR retry budget until the residual SQ is empty or a real error occurs, so staged sends get bounded best-effort delivery.
  • Bound cancellation staging, batched completion dispatch, and completion waits with one teardown deadline.
  • Add structural regressions for retained sockets, SQ-capacity pressure, deadline expiry, residual submission, and interrupted-submit budget exhaustion.

Root cause

Worker teardown issued synchronous cancellation before submitting the SQ. A receive staged in the SQ was therefore invisible to cancellation, then submitted by the teardown pump and left pending until the safety timeout. Cancelling every operation after submission would regress #3141 by dropping staged sends. FIFO asynchronous cancels target only operations that can remain pending indefinitely and stay ordered after their targets even across partial submissions.

Public API changes

None.

Test plan

  • just rs fix -p moq-uring
  • just rs check -p moq-uring
  • just rs test -p moq-uring teardown_submit_interrupt_budget_is_finite (1 passed)
  • just rs test -p moq-uring expired_teardown_submits_residual_sqes (1 passed)
  • just rs test -p moq-uring teardown_stops_between_completions_at_the_deadline (1 passed)
  • just rs test -p moq-uring dropped_worker (2 passed)
  • just rs test -p moq-uring a_send_staged_on_the_way_out_still_goes (1 passed)
  • Reverted the original cancellation ordering locally and confirmed the retained-socket regression fails with the staged receive still alive

Closes #3173

(Written by GPT-5)

Submit staged SQEs before synchronous cancellation, then target only receive and futex operations so staged sends retain their delivery guarantee. Assert through a weak socket observer that teardown drains the receive instead of leaking it after the timeout.

Fixes #3173

Co-Authored-By: OpenAI Codex <codex@openai.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 30, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-30T15:58:41.029921Z e5cb9f9 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8acbeb306f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread rs/moq-uring/src/worker.rs Outdated
Comment thread rs/moq-uring/src/worker.rs Outdated
Queue asynchronous receive and futex cancellations behind their targets so partial submissions retain FIFO cancellation coverage without cancelling staged sends. Bound cancellation staging, submission, completion dispatch, and waits with one teardown deadline, and retry interrupted enters only within that budget.

Cover more receives than the submission queue can hold and assert every retained socket is released.

Co-Authored-By: OpenAI Codex <codex@openai.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c151ff6c5d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread rs/moq-uring/src/worker.rs
Co-Authored-By: OpenAI Codex <codex@openai.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1897867b3a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread rs/moq-uring/src/worker.rs Outdated
Co-Authored-By: OpenAI Codex <codex@openai.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 896bd72322

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread rs/moq-uring/src/worker.rs Outdated
Co-Authored-By: OpenAI Codex <codex@openai.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 48b9dd6928

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread rs/moq-uring/src/worker.rs Outdated
kixelated and others added 2 commits August 29, 2026 21:05
Co-Authored-By: OpenAI Codex <codex@openai.com>
Co-Authored-By: OpenAI Codex <codex@openai.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e5cb9f9cb8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread rs/moq-uring/src/worker.rs
Co-Authored-By: OpenAI Codex <codex@openai.com>
@kixelated
kixelated merged commit 4d711cb into dev Aug 30, 2026
2 checks passed
@kixelated
kixelated deleted the codex/fix-uring-worker-drop branch August 30, 2026 21:06
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.

1 participant