Skip to content

rt: do not leak fd when cancelling io_uring open operation - #7983

Merged
Darksonn merged 24 commits into
tokio-rs:masterfrom
mattiapitossi:7979
Apr 8, 2026
Merged

Darksonn merged 24 commits into
tokio-rs:masterfrom
mattiapitossi:7979

Conversation

@mattiapitossi

@mattiapitossi mattiapitossi commented Mar 21, 2026 •

Copy link
Copy Markdown
Member

Motivation

fixes: #7979

Solution

When we receive a CQ that contains a cancelled event (open op), we now close the related fd.

result of PoC run after the fix

thread 'main' (1) panicked at src/main.rs:58:9:
expected many leaked fds, saw 1
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
before=7
after=8
leaked=1

@mattiapitossi mattiapitossi added C-bug Category: This is a bug. A-tokio Area: The main tokio crate M-fs Module: tokio/fs T-io-uring Topic: Linux io_uring labels Mar 21, 2026
@mattiapitossi mattiapitossi changed the title fs: ensure fds are closed when invoking cancel op (WIP) fs: ensure fds are closed when invoking cancel op Mar 22, 2026
@mattiapitossi mattiapitossi changed the title fs: ensure fds are closed when invoking cancel op rt: ensure fds are closed when invoking cancel op Mar 22, 2026
@mattiapitossi mattiapitossi changed the title rt: ensure fds are closed when invoking cancel op rt: (io-uring) ensure fds are closed when invoking cancel op Mar 22, 2026
@mattiapitossi
mattiapitossi marked this pull request as ready for review March 22, 2026 12:55
@mattiapitossi mattiapitossi self-assigned this Mar 22, 2026
Comment thread tokio/src/runtime/io/driver/uring.rs Resolved
Comment thread tokio/src/runtime/io/driver/uring.rs Resolved
Comment thread tokio/tests/fs_uring.rs Resolved
Comment thread tokio/tests/fs_uring.rs Resolved

@themavik themavik 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.

Closing the cancelled open fd with OwnedFd::from_raw_fd on Lifecycle::Cancelled(CancelData::Open(_)) fixes the leak. nit: the regression test allows up to 64 extra fds (leaked <= 64) — catches a gross leak but could miss a small steady drip.

Comment thread tokio/src/runtime/io/driver/uring.rs Resolved
Comment thread tokio/tests/fs_uring.rs Resolved

for cqe in self.ring_mut().completion() {
let idx = cqe.user_data() as usize;
ops.remove(idx);

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.

Could FDs leak here too ?

This comment was marked as outdated.

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.

Interesting, @mattiapitossi will this leak FDs?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Unless I'm not considering something, I would expect that when the process finishes all the FDs will be automatically closed. The drop is just ensuring that every operations terminates, so I'm not expecting that we should also close the related fd.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

There could be some situations though where the runtime gets dropped, but the process is still running so you could still have the leak in those cases (unless we handled all the cases in the dispatch_completion). So probably, for those cases, adding a close in the drop does not hurt?

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.

We should close fds in runtime exit too. There are valid use-cases to create and destroy many runtimes throughout lifetime of single program.

@Darksonn

Copy link
Copy Markdown
Member

We can make a point release with this if you change the base to tokio-1.50.x

@mufeedvh

Copy link
Copy Markdown

The finder of this issue here.

I think this still needs changes: the fix covers Cancelled(Open) in dispatch_completions() / runtime drop, but it does not cover the case where the open CQE has already been stored as Lifecycle::Completed(cqe) and the future is then dropped before being re-polled.

That path still leaks because Open::complete() is the only place that adopts the fd, while cancel_op() currently does this for Lifecycle::Completed(_):

Lifecycle::Completed(_) => {
    ops.remove(index);
}

So a successful completed OpenAt result can still be discarded without adopting or closing the fd.

I reproduced this on this PR branch by:

  1. polling open() once to Pending,
  2. letting it complete and get stored as Completed(cqe),
  3. dropping/aborting before the inner open() is polled again.

Runnable PoC for the completed-then-dropped-before-repoll path
[package]
name = "tokio_uring_completed_drop_poc"
version = "0.1.0"
edition = "2021"

[workspace]

[dependencies]
tokio = { path = "$REPO_ROOT/tokio", features = ["fs", "rt", "rt-multi-thread", "time", "io-uring", "sync"] }
use std::fs;
use std::future::Future;
use std::path::PathBuf;
use std::pin::Pin;
use std::task::{Context, Poll};
use std::time::Duration;

use tokio::sync::mpsc::{unbounded_channel, UnboundedSender};
use tokio::time::timeout;

/// Count currently-open fds in this process.
fn fd_count() -> usize {
    fs::read_dir("/proc/self/fd").unwrap().count()
}

/// Wrapper future used to hit the missing cleanup path.
///
/// First poll:
/// - polls the inner `tokio::fs::OpenOptions::open()` future once,
/// - expects `Pending` so we know we took the io_uring path,
/// - registers the task waker with Tokio's uring machinery.
///
/// Second poll:
/// - happens after the kernel completes the open and Tokio stores the CQE as
///   `Lifecycle::Completed(cqe)` and wakes the task,
/// - **intentionally does not poll the inner open future again**,
/// - stays pending forever so the task can be aborted.
///
/// Aborting the task here drops the inner `open()` future while Tokio still has
/// a completed CQE sitting in the slab. Today that goes through
/// `cancel_op(... Lifecycle::Completed(_))`, which removes the slab entry
/// without adopting or closing the returned fd.
struct PollOpenOnceThenNeverRepoll<F> {
    inner: Pin<Box<F>>,
    first_poll_tx: Option<UnboundedSender<()>>,
    second_poll_tx: Option<UnboundedSender<()>>,
    polled_once: bool,
}

impl<F: Future> Future for PollOpenOnceThenNeverRepoll<F> {
    type Output = ();

    fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
        if !self.polled_once {
            let poll = self.inner.as_mut().poll(cx);
            assert!(
                matches!(poll, Poll::Pending),
                "open did not use io_uring path in this environment"
            );

            self.polled_once = true;
            self.first_poll_tx.take().unwrap().send(()).unwrap();
            return Poll::Pending;
        }

        // We were polled again after the inner open completed and woke the task.
        // Crucially, we do *not* re-poll the inner future here.
        if let Some(tx) = self.second_poll_tx.take() {
            tx.send(()).unwrap();
        }

        Poll::Pending
    }
}

async fn completed_then_dropped_before_repoll(path: PathBuf) {
    let (first_tx, mut first_rx) = unbounded_channel();
    let (second_tx, mut second_rx) = unbounded_channel();

    let handle = tokio::spawn(async move {
        let mut opt = tokio::fs::OpenOptions::new();
        opt.read(true);

        PollOpenOnceThenNeverRepoll {
            inner: Box::pin(opt.open(&path)),
            first_poll_tx: Some(first_tx),
            second_poll_tx: Some(second_tx),
            polled_once: false,
        }
        .await;
    });

    // Wait until the inner open has been polled once and registered with io_uring.
    first_rx.recv().await.unwrap();

    // Wait until Tokio wakes the task because the open completed. At this point
    // the CQE should already be stored as `Lifecycle::Completed(cqe)`.
    timeout(Duration::from_secs(2), second_rx.recv())
        .await
        .expect("timed out waiting for second poll")
        .expect("second poll channel closed unexpectedly");

    // Abort now, before the inner open future gets re-polled and consumes the CQE.
    handle.abort();
    let err = handle.await.unwrap_err();
    assert!(err.is_cancelled(), "task was not cancelled as expected");
}

fn main() {
    let rt = tokio::runtime::Builder::new_multi_thread()
        .worker_threads(1)
        .enable_all()
        .build()
        .unwrap();

    rt.block_on(async {
        let before = fd_count();
        let path = PathBuf::from("/etc/hosts");

        for _ in 0..128 {
            completed_then_dropped_before_repoll(path.clone()).await;
        }

        // Give completions a moment to settle before counting fds.
        tokio::time::sleep(Duration::from_millis(250)).await;

        let after = fd_count();
        let leaked = after.saturating_sub(before);

        println!("before={before}");
        println!("after={after}");
        println!("leaked={leaked}");

        // Vulnerable builds leak roughly one fd per iteration here.
        assert!(leaked >= 64, "expected many leaked fds, saw {leaked}");
    });
}

On this PR branch, this still produces a large positive leak count for me, e.g.:

before=7
after=136
leaked=129

A complete fix should keep after close to before and should not satisfy assert!(leaked >= 64).


So this still looks like a real fd-leak / DoS path.

I think cancel_op() also needs to handle Lifecycle::Completed(cqe) for CancelData::Open(_), closing/adopting the fd before removing the slab entry. The new tests only cover “drop after first poll”, not “completed then dropped before re-poll”, which is the missing regression case.

}
Some(Lifecycle::Cancelled(_)) => {
Some(Lifecycle::Cancelled(cancel_data)) => {
if let CancelData::Open(_) = cancel_data {

@Daksh14 Daksh14 Mar 29, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should not drop the OwnedFd here but we should drop it in the drop of the Op itself.

If any operation that opens an Fd has to drop it this way then it will become a big match here in the future for CancelData of each Op. Let's handle it in cancel_op

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I added the drop for the FD to handle the cases where we cancel the operation and the op it's already in completed status as you and @mufeedvh suggested. But for the other cases what do you have in mind? Probably I'm missing something here. Because for the completed status we are able to drop it, since we have the data from the CQE, but for the other cases we get the data to close the FDs in the dispatch_completions.

@Daksh14

Daksh14 commented Mar 29, 2026

Copy link
Copy Markdown
Contributor

@mattiapitossi Follow what @mufeedvh said.

This cancel_op function is located here: https://github.com/tokio-rs/tokio/blob/master/tokio/src/runtime/io/driver/uring.rs#L259

This function gets called the drop glue of each Op io uring operation here: https://github.com/tokio-rs/tokio/blob/master/tokio/src/runtime/driver/op.rs#L86

So handle this case in the cancel_op

for cqe in cq {
let idx = cqe.user_data() as usize;

match ops.get_mut(idx) {

@Daksh14 Daksh14 Mar 29, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@Darksonn @ADD-SP do you think the problem here might be that we're not calling mem::replace here so the Cancel data is just behind a get_mut right now. Inside poll of the Op mem::replace is called

In my batch completions PR #7761 I actually have this change because it was actually causing weird effects for me too.

@mattiapitossi

Copy link
Copy Markdown
Member Author

@mufeedvh all the cases should now be covered, I added also a new test based on your PoC for the dropped and never re-polled case

@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.

The fix looks okay. As discussed on discord, we can make improvements in a follow-up.

Comment thread tokio/Cargo.toml

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.

Can you take this out? I want to do it in a separate PR, and the changelog also needs to be adjusted to include the udp socket error fix.

@mattiapitossi mattiapitossi Apr 5, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done, I removed also the bumps in the README and reverted the changelog so we can do it in a separate PR

@Darksonn

Darksonn commented Apr 8, 2026

Copy link
Copy Markdown
Member

I'll go ahead and merge this. @Daksh14 my understanding is that the code is correct in the current state where only Open exists, but that it can be improved for when other fd-owning ops are added and that it may be error-prone. Still, to unblock I'd like to merge this now.

@Darksonn
Darksonn dismissed Daksh14’s stale review April 8, 2026 05:36

I want to make a release now even if the code is error-prone for the addition of future io_uring ops to unblock us. We can improve error-proneness in follow-up PR.

@Darksonn Darksonn changed the title rt: (io-uring) ensure fds are closed when invoking cancel op rt: do not leak fd when cancelling io_uring open operation Apr 8, 2026
@Darksonn
Darksonn merged commit c791213 into tokio-rs:master Apr 8, 2026
90 checks passed
ahacop added a commit to ahacop/erwindb that referenced this pull request Sep 28, 2026
[cb skip]

Changes in 1.53.1
-----------------

1.53.1 (July 20th, 2026)
------------------------

Fixed
-----

- signal: restore MSRV by removing `OnceLock::wait` from the Windows handler ([#8300])

Fixed (unstable)
----------------

- time: fix alt timer cancellation and insertion race ([#8252])

Documented
----------

- runtime: remove dead link definition in Runtime::block_on ([#8301])

[#8252]: tokio-rs/tokio#8252
[#8300]: tokio-rs/tokio#8300
[#8301]: tokio-rs/tokio#8301

Changes in 1.53.0
-----------------

1.53.0 (July 17th, 2026)
------------------------

Added
-----

- fs: implement `From<OwnedFd>` and `From<OwnedHandle>` for `File` ([#8266])
- metrics: add task schedule latency metric ([#7986])
- net: add `SocketAddr` methods to Unix sockets ([#8144])

Changed
-------

- io: add `#[inline]` to IO trait impls for in-memory types ([#8242])
- net: implement UCred::pid on FreeBSD ([#8086])
- net: support Nuttx target os ([#8259])
- signal: refactor global variables on Windows ([#8231])
- sync: `mpsc::{Receiver,UnboundedReceiver}` now drops waker on drop, even if there are still senders ([#8095])
- taskdump: support taskdumps on s390x ([#8192])
- time: add `#[track_caller]` to `timeout_at()` ([#8077])
- time: consolidate mutex locks on spurious poll ([#8124])
- time: defer waker clone on spurious poll ([#8107])
- time: move lazy-registration state into `Sleep` ([#8132])
- tracing: remove unnecessary span clone ([#8126])

Fixed
-----

- io: do not treat zero-length reads as EOF in `Chain` ([#8251])
- net: use getpeereid for QNX peer credentials ([#8270])
- runtime: avoid illegal state in `FastRand` ([#8078])
- sync: wake mpsc receiver when a queued `reserve[_many]` returns permits ([#8260])
- taskdump: skip double wake on `Trace::capture`/`Trace::trace_with` ([#8043])
- time: avoid stack overflow in runtime constructor ([#8093])
- time (alt timer): ensure timers stay in the same runtime after `.reset()` ([#8169])

IO uring (unstable)
-------------------

- fs: use io-uring for `fs::try_exists` ([#8080])
- fs: use io-uring for renaming files ([#7800])
- rt: flush io-uring CQE in case of CQE overflow ([#8277])

Documented
----------

- docs: clarify cancel safety wording ([#8181])
- fs: clarify `create_dir_all` succeeds if path exists ([#8149])
- io: add warning about stdout reordering with multiple handles ([#8276])
- net: document pipe `try_read*`/`try_write*` readiness behavior ([#8032])
- runtime: document interaction with fork() ([#8202])
- sync: clarify broadcast lagging semantics ([#8239])
- sync: document memory ordering guarantees for Semaphore ([#8119])
- task: explain why `yield_now` defers its waker ([#8254])
- time: add panic docs to `timeout_at()` ([#8077])
- time: fix reversed poll order in timeout doc ([#8214])

[#7800]: tokio-rs/tokio#7800
[#7986]: tokio-rs/tokio#7986
[#8032]: tokio-rs/tokio#8032
[#8043]: tokio-rs/tokio#8043
[#8077]: tokio-rs/tokio#8077
[#8078]: tokio-rs/tokio#8078
[#8080]: tokio-rs/tokio#8080
[#8086]: tokio-rs/tokio#8086
[#8093]: tokio-rs/tokio#8093
[#8095]: tokio-rs/tokio#8095
[#8107]: tokio-rs/tokio#8107
[#8119]: tokio-rs/tokio#8119
[#8124]: tokio-rs/tokio#8124
[#8126]: tokio-rs/tokio#8126
[#8132]: tokio-rs/tokio#8132
[#8144]: tokio-rs/tokio#8144
[#8149]: tokio-rs/tokio#8149
[#8169]: tokio-rs/tokio#8169
[#8181]: tokio-rs/tokio#8181
[#8192]: tokio-rs/tokio#8192
[#8193]: tokio-rs/tokio#8193
[#8202]: tokio-rs/tokio#8202
[#8214]: tokio-rs/tokio#8214
[#8231]: tokio-rs/tokio#8231
[#8239]: tokio-rs/tokio#8239
[#8242]: tokio-rs/tokio#8242
[#8251]: tokio-rs/tokio#8251
[#8254]: tokio-rs/tokio#8254
[#8259]: tokio-rs/tokio#8259
[#8260]: tokio-rs/tokio#8260
[#8266]: tokio-rs/tokio#8266
[#8270]: tokio-rs/tokio#8270
[#8276]: tokio-rs/tokio#8276
[#8277]: tokio-rs/tokio#8277

Changes in 1.52.4
-----------------

1.52.4 (July 16th, 2026)
------------------------

Fixed
-----

- runtime: don't skip the driver when `before_park` schedules work ([#8222])

Fixed (unstable)
----------------

- taskdump: remove crate disambiguators from output ([#8264])

[#8264]: tokio-rs/tokio#8264
[#8222]: tokio-rs/tokio#8222

Changes in 1.52.3
-----------------

1.52.3 (May 8th, 2026)
----------------------

Fixed
-----

* sync: fix underflow in mpsc channel `len()` ([#8062])
* sync: notify receivers in mpsc `OwnedPermit::release()` method ([#8075])
* sync: require that an `RwLock` has `max_readers != 0` ([#8076])
* sync: return `Empty` from `try_recv()` when mpsc is closed with outstanding permits ([#8074])

[#8062]: tokio-rs/tokio#8062
[#8074]: tokio-rs/tokio#8074
[#8075]: tokio-rs/tokio#8075
[#8076]: tokio-rs/tokio#8076

Changes in 1.52.2
-----------------

1.52.2 (May 4th, 2026)
----------------------

This release reverts the LIFO slot stealing change introduced in 1.51.0 ([#7431]), due to [its performance impact][#8065]. ([#8100])

[#7431]: tokio-rs/tokio#7431
[#8065]: tokio-rs/tokio#8065
[#8100]: tokio-rs/tokio#8100

Changes in 1.52.1
-----------------

1.52.1 (April 16th, 2026)
-------------------------

Fixed
-----

- runtime: revert [#7757] to fix [a regression][#8056] that causes `spawn_blocking` to hang ([#8057])

[#7757]: tokio-rs/tokio#7757
[#8056]: tokio-rs/tokio#8056
[#8057]: tokio-rs/tokio#8057

Changes in 1.52.0
-----------------

1.52.0 (April 14th, 2026)
-------------------------

Added
-----

- io: `AioSource::register_borrowed` for I/O safety support ([#7992])
- net: add `try_io` function to `unix::pipe` sender and receiver types ([#8030])

Added (unstable)
----------------

- runtime: `Builder::enable_eager_driver_handoff` setting enable eager hand off of the I/O and time drivers before polling tasks ([#8010])
- taskdump: add `trace_with()` for customized task dumps ([#8025])
- taskdump: allow `impl FnMut()` in `trace_with` instead of just `fn()` ([#8040])
- fs: support `io_uring` in `AsyncRead` for `File` ([#7907])

Changed
-------

- runtime: improve `spawn_blocking` scalability with sharded queue ([#7757])
- runtime: use `compare_exchange_weak()` in worker queue ([#8028])

Fixed
-----

- runtime: overflow second half of tasks when local queue is filled instead of first half ([#8029])

Documented
----------

- docs: fix typo in `oneshot::Sender::send` docs ([#8026])
- docs: hide #[tokio::main] attribute in the docs of `sync::watch` ([#8035])
- net: add docs on `ConnectionRefused` errors with UDP sockets ([#7870])

[#7757]: tokio-rs/tokio#7757
[#7870]: tokio-rs/tokio#7870
[#7907]: tokio-rs/tokio#7907
[#7992]: tokio-rs/tokio#7992
[#8010]: tokio-rs/tokio#8010
[#8025]: tokio-rs/tokio#8025
[#8026]: tokio-rs/tokio#8026
[#8028]: tokio-rs/tokio#8028
[#8029]: tokio-rs/tokio#8029
[#8030]: tokio-rs/tokio#8030
[#8035]: tokio-rs/tokio#8035
[#8040]: tokio-rs/tokio#8040

Changes in 1.51.4
-----------------

1.51.4 (July 16th, 2026)
------------------------

Fixed
-----

- runtime: don't skip the driver when `before_park` schedules work ([#8222])

[#8222]: tokio-rs/tokio#8222

Changes in 1.51.3
-----------------

1.51.3 (May 8th, 2026)
----------------------

Fixed
-----

* sync: fix underflow in mpsc channel `len()` ([#8062])
* sync: notify receivers in mpsc `OwnedPermit::release()` method ([#8075])
* sync: require that an `RwLock` has `max_readers != 0` ([#8076])
* sync: return `Empty` from `try_recv()` when mpsc is closed with outstanding permits ([#8074])

[#8062]: tokio-rs/tokio#8062
[#8074]: tokio-rs/tokio#8074
[#8075]: tokio-rs/tokio#8075
[#8076]: tokio-rs/tokio#8076

Changes in 1.51.2
-----------------

1.51.2 (May 4th, 2026)
----------------------

This release reverts the LIFO slot stealing change introduced in 1.51.0 ([#7431]), due to [its performance impact][#8065]. ([#8100])

[#7431]: tokio-rs/tokio#7431
[#8065]: tokio-rs/tokio#8065
[#8100]: tokio-rs/tokio#8100

Changes in 1.51.1
-----------------

1.51.1 (April 8th, 2026)
------------------------

Fixed
-----

- sync: fix semaphore reopens after forget ([#8021])
- net: surface errors from `SO_ERROR` on `recv` for UDP sockets on Linux ([#8001])

Fixed (unstable)
----------------

- metrics: fix `worker_local_schedule_count` test ([#8008])
- rt: do not leak fd when cancelling io\_uring open operation ([#7983])

[#7983]: tokio-rs/tokio#7983
[#8001]: tokio-rs/tokio#8001
[#8008]: tokio-rs/tokio#8008
[#8021]: tokio-rs/tokio#8021

Changes in 1.51.0
-----------------

1.51.0 (April 3rd, 2026)
------------------------

Added
-----

- net: implement `get_peer_cred` on Hurd ([#7989])
- runtime: add `tokio::runtime::worker_index()` ([#7921])
- runtime: add runtime name ([#7924])
- runtime: stabilize `LocalRuntime` ([#7557])
- wasm: add wasm32-wasip2 networking support ([#7933])

Changed
-------

- runtime: steal tasks from the LIFO slot ([#7431])

Fixed
-----

- docs: do not show "Available on non-loom only." doc label ([#7977])
- macros: improve overall macro hygiene ([#7997])
- sync: fix `notify_waiters` priority in `Notify` ([#7996])
- sync: fix panic in `Chan::recv_many` when called with non-empty vector on closed channel ([#7991])

[#7431]: tokio-rs/tokio#7431
[#7557]: tokio-rs/tokio#7557
[#7921]: tokio-rs/tokio#7921
[#7924]: tokio-rs/tokio#7924
[#7933]: tokio-rs/tokio#7933
[#7977]: tokio-rs/tokio#7977
[#7989]: tokio-rs/tokio#7989
[#7991]: tokio-rs/tokio#7991
[#7996]: tokio-rs/tokio#7996
[#7997]: tokio-rs/tokio#7997

Changes in 1.50.0
-----------------

1.50.0 (Mar 3rd, 2026)
----------------------

Added
-----

- net: add `TcpStream::set_zero_linger` ([#7837])
- rt: add `is_rt_shutdown_err` ([#7771])

Changed
-------

- io: add optimizer hint that `memchr` returns in-bounds pointer ([#7792])
- io: implement vectored writes for `write_buf` ([#7871])
- runtime: panic when `event_interval` is set to 0 ([#7838])
- runtime: shorten default thread name to fit in Linux limit ([#7880])
- signal: remember the result of `SetConsoleCtrlHandler` ([#7833])
- signal: specialize windows `Registry` ([#7885])

Fixed
-----

- io: always cleanup `AsyncFd` registration list on deregister ([#7773])
- macros: remove (most) local `use` declarations in `tokio::select!` ([#7929])
- net: fix `GET_BUF_SIZE` constant for `target_os = "android"` ([#7889])
- runtime: avoid redundant unpark in current_thread scheduler ([#7834])
- runtime: don't park in `current_thread` if `before_park` defers waker ([#7835])
- io: fix write readiness on ESP32 on short writes ([#7872])
- runtime: wake deferred tasks before entering `block_in_place` ([#7879])
- sync: drop rx waker when oneshot receiver is dropped ([#7886])
- runtime: fix double increment of `num_idle_threads` on shutdown ([#7910], [#7918], [#7922])

Unstable
--------

- fs: check for io-uring opcode support ([#7815])
- runtime: avoid lock acquisition after uring init ([#7850])

Documented
----------

- docs: update outdated unstable features section ([#7839])
- io: clarify the behavior of `AsyncWriteExt::shutdown()` ([#7908])
- io: explain how to flush stdout/stderr ([#7904])
- io: fix incorrect and confusing `AsyncWrite` documentation ([#7875])
- rt: clarify the documentation of `Runtime::spawn` ([#7803])
- rt: fix missing quotation in docs ([#7925])
- runtime: correct the default thread name in docs ([#7896])
- runtime: fix `event_interval` doc ([#7932])
- sync: clarify RwLock fairness documentation ([#7919])
- sync: clarify that `recv` returns `None` once closed and no more messages ([#7920])
- task: clarify when to use `spawn_blocking` vs dedicated threads ([#7923])
- task: doc that task drops before `JoinHandle` completion ([#7825])
- signal: guarantee that listeners never return `None` ([#7869])
- task: fix task module feature flags in docs ([#7891])
- task: fix two typos ([#7913])
- task: improve the docs of `Builder::spawn_local` ([#7828])
- time: add docs about auto-advance and when to use sleep ([#7858])
- util: fix typo in docs ([#7926])

[#7771]: tokio-rs/tokio#7771
[#7773]: tokio-rs/tokio#7773
[#7792]: tokio-rs/tokio#7792
[#7803]: tokio-rs/tokio#7803
[#7815]: tokio-rs/tokio#7815
[#7825]: tokio-rs/tokio#7825
[#7828]: tokio-rs/tokio#7828
[#7833]: tokio-rs/tokio#7833
[#7834]: tokio-rs/tokio#7834
[#7835]: tokio-rs/tokio#7835
[#7837]: tokio-rs/tokio#7837
[#7838]: tokio-rs/tokio#7838
[#7839]: tokio-rs/tokio#7839
[#7850]: tokio-rs/tokio#7850
[#7858]: tokio-rs/tokio#7858
[#7869]: tokio-rs/tokio#7869
[#7871]: tokio-rs/tokio#7871
[#7872]: tokio-rs/tokio#7872
[#7875]: tokio-rs/tokio#7875
[#7879]: tokio-rs/tokio#7879
[#7880]: tokio-rs/tokio#7880
[#7885]: tokio-rs/tokio#7885
[#7886]: tokio-rs/tokio#7886
[#7889]: tokio-rs/tokio#7889
[#7891]: tokio-rs/tokio#7891
[#7896]: tokio-rs/tokio#7896
[#7904]: tokio-rs/tokio#7904
[#7908]: tokio-rs/tokio#7908
[#7910]: tokio-rs/tokio#7910
[#7913]: tokio-rs/tokio#7913
[#7918]: tokio-rs/tokio#7918
[#7919]: tokio-rs/tokio#7919
[#7920]: tokio-rs/tokio#7920
[#7922]: tokio-rs/tokio#7922
[#7923]: tokio-rs/tokio#7923
[#7925]: tokio-rs/tokio#7925
[#7926]: tokio-rs/tokio#7926
[#7929]: tokio-rs/tokio#7929
[#7932]: tokio-rs/tokio#7932

Release notes:
- 1.53.1: https://github.com/tokio-rs/tokio/releases/tag/tokio-1.53.1
- 1.53.0: https://github.com/tokio-rs/tokio/releases/tag/tokio-1.53.0
- 1.52.4: https://github.com/tokio-rs/tokio/releases/tag/tokio-1.52.4
- 1.52.3: https://github.com/tokio-rs/tokio/releases/tag/tokio-1.52.3
- 1.52.2: https://github.com/tokio-rs/tokio/releases/tag/tokio-1.52.2
- 1.52.1: https://github.com/tokio-rs/tokio/releases/tag/tokio-1.52.1
- 1.52.0: https://github.com/tokio-rs/tokio/releases/tag/tokio-1.52.0
- 1.51.4: https://github.com/tokio-rs/tokio/releases/tag/tokio-1.51.4
- 1.51.3: https://github.com/tokio-rs/tokio/releases/tag/tokio-1.51.3
- 1.51.2: https://github.com/tokio-rs/tokio/releases/tag/tokio-1.51.2
- 1.51.1: https://github.com/tokio-rs/tokio/releases/tag/tokio-1.51.1
- 1.51.0: https://github.com/tokio-rs/tokio/releases/tag/tokio-1.51.0
- 1.50.0: https://github.com/tokio-rs/tokio/releases/tag/tokio-1.50.0

---

Transitive Dependencies
-----------------------

- libc (0.2.180 -> 0.2.189)
- mio (1.1.1 -> 1.2.3)
- socket2 (0.6.2 -> 0.6.5)
- syn 3.0.6 (added)
- tokio-macros (2.6.0 -> 2.7.2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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. M-fs Module: tokio/fs T-io-uring Topic: Linux io_uring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cancelled io-uring open futures leak fds

7 participants