Skip to content

rt: fix io_uring shutdown errors - #8634

Open
ThanhDodeurOdoo wants to merge 1 commit into
tokio-rs:tokio-1.51.xfrom
ThanhDodeurOdoo:io-uring-shutdown-eintr
Open

ThanhDodeurOdoo wants to merge 1 commit into
tokio-rs:tokio-1.51.xfrom
ThanhDodeurOdoo:io-uring-shutdown-eintr

Conversation

@ThanhDodeurOdoo

@ThanhDodeurOdoo ThanhDodeurOdoo commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Shutdown errors can leave operations pending. Panicking then drops
operation resources that the kernel may still be using.

Drain available completions before retrying EINTR, EBUSY or EAGAIN
from shutdown waits. Also retry EINTR during submission .

Before panicking on other shutdown errors, leak thé operation slab
to keep pending buffers alive (same for submission
flush failures).

@github-actions github-actions Bot added the R-loom-time-driver Run loom time driver tests on this PR label Oct 13, 2026
@ThanhDodeurOdoo

Copy link
Copy Markdown
Contributor Author

will write a test, just waiting for feedback before

@Darksonn Darksonn added C-bug Category: This is a bug. A-tokio Area: The main tokio crate M-runtime Module: tokio/runtime M-io Module: tokio/io T-io-uring Topic: Linux io_uring I-unsound 💥 A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 13, 2026

@Darksonn Darksonn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for catching this! Left two comments on the error handling in UringContext::drop — once those are addressed, please also go ahead and add a test in tokio/tests/fs_uring.rs.

Comment thread tokio/src/runtime/io/driver/uring.rs Outdated
Comment thread tokio/src/runtime/io/driver/uring.rs Outdated
@Darksonn Darksonn added S-waiting-on-author Status: awaiting some action (such as code changes) from the PR or issue author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 13, 2026
@ThanhDodeurOdoo ThanhDodeurOdoo changed the title rt: fix handle EINTR during io_uring shutdown rt: fix io_uring shutdown errors Oct 13, 2026
@ThanhDodeurOdoo
ThanhDodeurOdoo force-pushed the io-uring-shutdown-eintr branch 3 times, most recently from 571338d to f744863 Compare October 14, 2026 04:35
@ThanhDodeurOdoo

Copy link
Copy Markdown
Contributor Author

just added a test ( a FIFO to keep I/O pending). I checked that fails without the fix

@ThanhDodeurOdoo
ThanhDodeurOdoo marked this pull request as ready for review October 14, 2026 04:39
@Darksonn Darksonn added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: awaiting some action (such as code changes) from the PR or issue author. labels Oct 14, 2026
Comment thread tokio/tests/fs_uring.rs Outdated
Shutdown errors can leave operations pending. Panicking then drops
operation resources that the kernel may still be using.

Drain available completions before retrying EINTR, EBUSY or EAGAIN
from shutdown waits. Also retry EINTR during submission .

Before panicking on other shutdown errors, leak thé operation slab
to keep pending buffers alive (same for submission
flush failures).
@ThanhDodeurOdoo
ThanhDodeurOdoo force-pushed the io-uring-shutdown-eintr branch from f744863 to c658c83 Compare October 15, 2026 01:34

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-tokio Area: The main tokio crate C-bug Category: This is a bug. I-unsound 💥 A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness M-io Module: tokio/io M-runtime Module: tokio/runtime R-loom-time-driver Run loom time driver tests on this PR S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-io-uring Topic: Linux io_uring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants