Thanks to visit codestin.com
Credit goes to github.com

Skip to content

rt: revert #7757 to fix regression in spawn_blocking#8057

Merged
hawkw merged 3 commits into
masterfrom
eliza/unclaude-blocking-queue
Apr 16, 2026
Merged

rt: revert #7757 to fix regression in spawn_blocking#8057
hawkw merged 3 commits into
masterfrom
eliza/unclaude-blocking-queue

Conversation

@hawkw
Copy link
Copy Markdown
Member

@hawkw hawkw commented Apr 16, 2026

This reverts commit 1604bc3.

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

This reverts commit 1604bc3.

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.
@hawkw hawkw requested a review from Darksonn April 16, 2026 19:55
@github-actions github-actions Bot added the R-loom-blocking Run loom `runtime::spawn_blocking` tests on this PR label Apr 16, 2026
@hawkw
Copy link
Copy Markdown
Member Author

hawkw commented Apr 16, 2026

The remaining CI failures are due to CI picking up rustc 1.95, which changes some error messages and breaks some of the trybuild tests. I've opened a separate PR (#8058) to fix that.

@Darksonn Darksonn added A-tokio Area: The main tokio crate M-runtime Module: tokio/runtime M-blocking Module: tokio/task/blocking labels Apr 16, 2026
Copy link
Copy Markdown
Member

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

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

Unfortunate, but thanks.

cc @alex

@hawkw hawkw enabled auto-merge (squash) April 16, 2026 20:33
@hawkw hawkw merged commit 56aaa43 into master Apr 16, 2026
90 checks passed
@hawkw hawkw deleted the eliza/unclaude-blocking-queue branch April 16, 2026 20:57
hawkw added a commit that referenced this pull request Apr 16, 2026
# 1.52.1 (April 16th, 2026)

## Fixed

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

[#7757]: #7757
[#8056]: #8056
[#8057]: #8057
hawkw added a commit that referenced this pull request Apr 16, 2026
# 1.52.1 (April 16th, 2026)

## Fixed

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

[#7757]: #7757
[#8056]: #8056
[#8057]: #8057
hawkw added a commit to oxidecomputer/omicron that referenced this pull request Apr 16, 2026
Commit #10272 updated our dependency on `oxide-tokio-rt` to v0.1.4 and
our `tokio` dependency to v1.52.0. This allowed us to pick up two of my
fixes for Tokio issues that have been a thorn in our side for a long
time, tokio-rs/tokio#7431 and tokio-rs/tokio#8010, which fix #8334 and
#9619, respectively. The nature of these fixes is described in greater
detail in #10272.

Unfortunately, #10272 had to be reverted (in #10279), since @iliana
discovered an unrelated regression in Tokio v1.52.0, tokio-rs/tokio#8056
(our issue #10277). This regression caused `spawn_blocking` to
occasionally hang, and was introduced in
tokio-rs/tokio@1604bc3 (PR
tokio-rs/tokio#7757).

I've since reverted this change upstream (tokio-rs/tokio#8057), and
published a patch release ([v1.52.1]), which fixes the regression.
Therefore, it is now once again safe to update our Tokio dependency to
pick up the other fixes. This commit does that. I've also confirmed that
the issue described in #10277 is no longer present in Tokio v1.52.1, as
demonstrated by the fact `cargo nextest run -p omicron-sled-agent
--stress-count 100 -- --exact artifact_store::test::issue_7796` now
succeeds without hanging once again.

Fixes #10272
eleboucher pushed a commit to eleboucher/towonel that referenced this pull request Apr 18, 2026
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [tokio](https://tokio.rs) ([source](https://github.com/tokio-rs/tokio)) | workspace.dependencies | minor | `1.51.1` → `1.52.1` |

---

### Release Notes

<details>
<summary>tokio-rs/tokio (tokio)</summary>

### [`v1.52.1`](https://github.com/tokio-rs/tokio/releases/tag/tokio-1.52.1): Tokio v1.52.1

[Compare Source](tokio-rs/tokio@tokio-1.52.0...tokio-1.52.1)

### 1.52.1 (April 16th, 2026)

#### Fixed

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

[#&#8203;7757]: tokio-rs/tokio#7757

[#&#8203;8056]: tokio-rs/tokio#8056

[#&#8203;8057]: tokio-rs/tokio#8057

### [`v1.52.0`](https://github.com/tokio-rs/tokio/releases/tag/tokio-1.52.0): Tokio v1.52.0

[Compare Source](tokio-rs/tokio@tokio-1.51.1...tokio-1.52.0)

### 1.52.0 (April 14th, 2026)

#### Added

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

#### Added (unstable)

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

#### Changed

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

#### Fixed

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

#### Documented

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

[#&#8203;7757]: tokio-rs/tokio#7757

[#&#8203;7870]: tokio-rs/tokio#7870

[#&#8203;7907]: tokio-rs/tokio#7907

[#&#8203;7992]: tokio-rs/tokio#7992

[#&#8203;8010]: tokio-rs/tokio#8010

[#&#8203;8025]: tokio-rs/tokio#8025

[#&#8203;8026]: tokio-rs/tokio#8026

[#&#8203;8028]: tokio-rs/tokio#8028

[#&#8203;8029]: tokio-rs/tokio#8029

[#&#8203;8030]: tokio-rs/tokio#8030

[#&#8203;8035]: tokio-rs/tokio#8035

[#&#8203;8040]: tokio-rs/tokio#8040

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMDEuMSIsInVwZGF0ZWRJblZlciI6IjQzLjEwMS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJ0eXBlL21pbm9yIl19-->

Reviewed-on: https://git.erwanleboucher.dev/eleboucher/towonel/pulls/11
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 M-blocking Module: tokio/task/blocking M-runtime Module: tokio/runtime R-loom-blocking Run loom `runtime::spawn_blocking` tests on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

regression in spawn_blocking caused by #7757 causes tests to hang

2 participants