Commit Graph
4469 Commits
Author SHA1 Message Date
Alice Ryhl 16bc4e2e28 time: add #[track_caller] and panic docs to timeout_at() (#8077) 2026-04-20 20:22:36 +02:00
BarryandMattia Pitossi 1afb391350 net: document pipe try_read*/try_write* readiness behavior (#8032)
Add a Notes section to all five try_* methods on pipe::Sender and
pipe::Receiver explaining that the runtime's I/O driver only delivers
readiness events after control is yielded back to it, so calling
try_read/try_write before any .await returns WouldBlock even when the
operation could otherwise succeed.

This is the same readiness model used by every other Tokio I/O type;
the pipe docs simply did not previously call it out. Refs #7625.

---------

Co-authored-by: Mattia Pitossi <[email protected]>
2026-04-19 19:52:41 +02:00
Mattia Pitossi b010b5ddaf test taskdump docs (#8064) 2026-04-17 23:32:22 +03:00
Eliza Weisman 905c146aed chore: prepare to release v1.52.1 (#8059)
# 1.52.1 (April 16th, 2026)

## Fixed

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

[#7757]: https://github.com/tokio-rs/tokio/pull/7757
[#8056]: https://github.com/tokio-rs/tokio/pull/8056
[#8057]: https://github.com/tokio-rs/tokio/pull/8057
tokio-1.52.1
2026-04-16 21:28:05 +00:00
Eliza Weisman 56aaa43e91 rt: revert #7757 to fix regression in spawn_blocking (#8057)
This reverts commit 1604bc3351.

Unfortunately, this commit introduced a regression that causes programs
using `spawn_blocking` to hang (see #8056). To fix the regression, we
need to undo this change and publish a v1.52.1 release as soon as
possible.

In the future, we may wish to bring back a sharded queue for
`spawn_blocking` tasks, either based on the implementation added in
#7757 or a new one. However, since this is a substantial change to the
runtime internals, I think such a change should probably be done as an
unstable, opt-in `tokio::runtime::Builder` setting initially, so that we
don't regress existing users. I had hoped we could do this now, but
unfortunately, the sharded queue implementation from #7757 is kind of
tightly coupled with the rest of the `spawn_blocking` machinery and
cannot be easily swapped out --- and the hang still occurs with
`NUM_SHARDS` set to 1, so there isn't an easy way to turn it on and off.
Therefore, in the interest of getting a fix out ASAP, this is just a
simple revert.

Fixes #8056
2026-04-16 20:57:22 +00:00
Eliza Weisman 57ff47ab58 ci: update trybuild to expect output from rustc 1.95.0 (#8058) 2026-04-16 20:32:53 +00:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 812de3e134 ci: bump taiki-e/cache-cargo-install-action from 1 to 3 (#8053)
Bumps [taiki-e/cache-cargo-install-action](https://github.com/taiki-e/cache-cargo-install-action) from 1 to 3.
- [Release notes](https://github.com/taiki-e/cache-cargo-install-action/releases)
- [Changelog](https://github.com/taiki-e/cache-cargo-install-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/taiki-e/cache-cargo-install-action/compare/v1...v3)

---
updated-dependencies:
- dependency-name: taiki-e/cache-cargo-install-action
  dependency-version: '3'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-16 09:30:55 +02:00
Martin Grigorov ba82e73c7b ci: use Dependabot to keep github actions up to date (#8052) 2026-04-16 08:51:22 +02:00
Mattia Pitossi 2e85f9ddf8 ci: replace cirrus-ci with freebsd-vm (#8041) 2026-04-16 08:40:04 +02:00
Alice Ryhl a7e1cd8ff8 ci: update GitHub Actions workflows to use latest tool versions (#8047) 2026-04-15 16:57:43 +00:00
Eliza Weisman 5f7be0ac42 chore: perpare 1.52.0 (#8045)
# 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]: https://github.com/tokio-rs/tokio/pull/7757
[#7870]: https://github.com/tokio-rs/tokio/pull/7870
[#7907]: https://github.com/tokio-rs/tokio/pull/7907
[#7992]: https://github.com/tokio-rs/tokio/pull/7992
[#8010]: https://github.com/tokio-rs/tokio/pull/8010
[#8025]: https://github.com/tokio-rs/tokio/pull/8025
[#8026]: https://github.com/tokio-rs/tokio/pull/8026
[#8028]: https://github.com/tokio-rs/tokio/pull/8028
[#8029]: https://github.com/tokio-rs/tokio/pull/8029
[#8030]: https://github.com/tokio-rs/tokio/pull/8030
[#8035]: https://github.com/tokio-rs/tokio/pull/8035
[#8040]: https://github.com/tokio-rs/tokio/pull/8040
tokio-1.52.0
2026-04-14 11:56:01 -07:00
Alice Ryhl 36d12d2686 taskdump: allow impl FnMut() in taskdumps instead of just fn() (#8040) 2026-04-14 19:18:56 +02:00
Carter Green f943312865 fs: support io-uring in AsyncRead for File (#7907) 2026-04-13 20:36:23 +02:00
Timo 5db10f538b net: add 'try_io' function to 'unix::pipe' sender and receiver types (#8030) 2026-04-12 15:06:06 +02:00
Russell Cohen bbdba7101d taskdump: add trace_with for customized task dumps (#8025)
provided trace function.
2026-04-12 11:13:24 +02:00
xtqqczze 7cfce54386 ci: update FreeBSD image to 14.4 (#8038) 2026-04-11 22:20:55 +02:00
Alice Ryhl 81370e6202 net: add docs on ConnectionRefused errors with udp sockets (#7870) 2026-04-11 20:06:08 +00:00
Alice Ryhl 203af02126 runtime: overflow second half of tasks when local queue is filled instead of first half (#8029) 2026-04-11 12:14:26 +02:00
Joel Dice de230926dc net: temporarily disable tcp_stream try_read_buf test on WASI (#8036)
This test is flaky on WASI until
https://github.com/bytecodealliance/wasmtime/issues/13040 has been addressed.

See https://github.com/tokio-rs/tokio/issues/8034 for additional details.
2026-04-11 12:06:46 +02:00
Abhinav 432ec3f2b2 sync: hide #[tokio::main] attribute in the docs of sync::watch (#8035) 2026-04-10 13:15:37 -07:00
Alex Gaynor 1604bc3351 rt: improve spawn_blocking scalability with sharded queue (#7757) 2026-04-10 16:06:19 +02:00
Alice Ryhl 4c7d8b2a14 runtime: use compare_exchange_weak() in worker queue (#8028) 2026-04-10 09:05:18 +02:00
Alan Somers d7db722bb4 io: AioSource now employs IO Safety (#7992) 2026-04-08 22:59:32 +02:00
Eliza Weisman fccc28f1d0 runtime: optional eager I/O driver/timer handoff when polling tasks (#8010) 2026-04-08 22:46:27 +02:00
winningMove 927df0e9d9 sync: fix typo in oneshot send doc (#8026) 2026-04-08 19:31:22 +02:00
Alice Ryhl 98df02d7a4 chore: prepare Tokio v1.51.1 (#8023) tokio-1.51.1 2026-04-08 12:37:44 +02:00
dentiny 3ea11e2a5f sync: fix semaphore reopens after forget (#8021) 2026-04-08 07:59:54 +00:00
Mattia Pitossi c79121391d rt: do not leak fd when cancelling io_uring open operation (#7983) 2026-04-08 07:37:19 +02:00
Marvin Vogt ad8c59add6 net: surface errors from SO_ERROR on recv for UDP sockets on Linux (#8001) 2026-04-04 21:46:10 +02:00
Alice Ryhl 654d38b132 metrics: fix worker_local_schedule_count test (#8008) 2026-04-04 09:20:01 +02:00
Mattia Pitossi 857ba80933 docs: improve contributing docs on how to specify crates dependency versions (#8009) 2026-04-04 09:03:49 +02:00
Alice Ryhl 95b9342da7 chore: remove path deps for tokio-macros 2.7.0 (#8007) 2026-04-03 11:10:55 +02:00
Alice Ryhl 0af06b7bab chore: prepare Tokio v1.51.0 (#8005) tokio-1.51.0 2026-04-03 10:42:05 +02:00
Alice Ryhl 01a7f1dfab chore: prepare tokio-macros v2.7.0 (#8004) tokio-macros-2.7.0 2026-04-03 09:37:58 +02:00
Eliza Weisman eeb55c733b runtime: steal tasks from the LIFO slot (#7431) 2026-04-03 09:11:58 +02:00
Daksh 1fc450aefb runtime: stabilize LocalRuntime (#7557) 2026-04-02 13:13:24 +00:00
Alice Ryhl 324218f9bb Merge tag 'tokio-1.47.4' (#8003) 2026-04-02 14:16:40 +02:00
Alice Ryhl aa65d0d0b8 chore: prepare Tokio v1.47.4 (#8002) tokio-1.47.4 2026-04-02 14:12:06 +02:00
LeoniePhiline bf18ed452d sync: fix panic in Chan::recv_many when called with non-empty vector on closed channel (#7991)
`Chan::recv_many` intends to assert that no slots
have been consumed when exiting with `Ready` via
the `rx_closed` code path.

Instead of asserting no items were added to the
buffer, it asserted buffer emptiness, incorrectly
making assumptions about the provided buffer.

When `recv_many` was called on an empty channel
with idle semaphore after the receiver was closed,
the method would panic.

The branch coverage had been previously missing.

This changeset corrects the assertion
and adds tests covering the code path.

Fixes #7990.
2026-04-02 13:16:03 +02:00
Joel Dice 43134f1e57 wasm: add wasm32-wasip2 networking support (#7933)
Motivation

This adds networking support for the `wasm32-wasip2` target platform, which
includes more extensive support for sockets than `wasm32-wasip1`.

Solution

The bulk of the changes are in https://github.com/tokio-rs/mio/pull/1931.  This
patch mainly tweaks a few `cfg` directives to indicate `wasm32-wasip2`'s
additional capabilities.

Note that this is a draft PR until until
https://github.com/tokio-rs/mio/pull/1931 and
https://github.com/rust-lang/socket2/pull/639 have been include in stable
releases of their respective projects.

Also note that I've added a `wasm32-wasip2` target to CI and triaged each test
which was previously disabled for WASI into one of three categories:

- Disabled on both WASIp1 and p2 due to not-yet-supported features such as multithreading
- Disabled on p1 but enabled on p2
- Disabled on p1 and _temporarily_ disabled on p2 due to `wasi-libc` bugfixes which have been merged but not yet included in a Rust release.  I'll open an issue to re-enable them when the fixes land in Rust.

Future Work

In the future, we could consider adding support for `tokio::net::lookup_host`.
WASIp2 natively supports asynchronous DNS lookups and is single threaded,
whereas Tokio currently assumes DNS lookups are blocking and require
multithreading to emulate async lookups.  A WASIp2-specific implementation could
do the lookup directly without multithreading.

WASIp2 also supports single-threaded, asynchronous file I/O, timers, etc.  We
could either support those directly or wait for WASIp3's multithreading support,
in which case most of `tokio::fs` (as well as `tokio::net::lookup_host`, etc.)
_should_ work unchanged via `wasi-libc` and worker threads.

Currently, building for WASIp2 requires RUSTFLAGS="--cfg tokio_unstable"`.  Once
we have a solid maintenance plan, we can remove that requirement.
2026-04-02 11:53:17 +02:00
Adam Martinez b4c3246d33 macros: improve overall macro hygiene (#7997)
Multiple macro expansions were previously assumming the existence of
some standard library symbols to both be in-scope and referring to the
right symbol, and not only having the same identifier.

This has now been refactored into using reexports from the `support`
module under the `macros` module. Some other macro invocations were also
using absolute standard library paths instead of calling into the afore
mentioned module through the special `$crate` macro. This has been
changed, thus also reexporting some other items in `support`.
2026-04-02 11:46:57 +02:00
Mattia Pitossi 7947fa4bd7 rt: add runtime name (#7924) 2026-04-01 09:46:27 +00:00
Hegui Dai 9f132172db sync: fix notify_waiters priority in Notify (#7996)
Previously, if a `notify_waiters()` was followed by a `notify_one()`,
an unpolled `Notified` future created before the `notify_waiters()`
call would consume the `NOTIFIED` permit created by the
`notify_one()` call.

This commit fixes this by verifying the `notify_waiters_calls` count
before optimistically attempting to acquire the `NOTIFIED` permit. If
the count indicates a `notify_waiters()` call has already happened, the
future transitions directly to `State::Done` and leaves the permit
intact for other waiters.

Fixes: #7965
2026-03-31 13:52:02 +02:00
Sim-hu 6752f50154 examples: add graceful shutdown example (#7962) 2026-03-30 11:05:53 +02:00
xtqqczze 6c72168a93 ci: remove Rust 1.94.0 workarounds (#7987) 2026-03-30 10:44:47 +02:00
Pino Toscano ee4de81806 net: use null get_peer_cred on Hurd (#7989) 2026-03-27 09:38:54 +01:00
Jess Izen a8435c0fc8 examples: add FD table pre-warming example (#7978) 2026-03-26 08:17:27 -07:00
Charlie Tonneslan 467d614267 bench: use is_multiple_of instead of manual modulo check (#7984)
Addresses clippy::manual_is_multiple_of warning on latest stable.
2026-03-22 14:00:12 +01:00
Martin Grigorov 66c786540e chore: Do not show "Available on non-loom only." doc label (#7977)
* chore: Do not show "Available on non-loom only." doc label

Closes #7976

Uses the unstable #[doc(cfg()]. https://github.com/rust-lang/rust/issues/43781

* Use build.rs to detect nightly builds

* Use `docsrs` instead of `nightly`. Drop build.rs

* Use doc(auto_cfg(hide(config_name)))

* Use same nightly on CirrusCI (FreeBSD) as on Github Actions CI
2026-03-18 15:14:02 +02:00
figsoda dd1196d369 ci: patch workspace members to disambiguate --package (#7967) 2026-03-18 07:27:46 +01:00