Skip to content

introduce a regression test for #8056 - #8068

Merged
Darksonn merged 3 commits into
tokio-rs:masterfrom
alex:regression-test
Apr 28, 2026
Merged

Darksonn merged 3 commits into
tokio-rs:masterfrom
alex:regression-test

Conversation

@alex

@alex alex commented Apr 18, 2026

Copy link
Copy Markdown
Contributor

refs #8067

@alex alex mentioned this pull request Apr 18, 2026
3 of 4 tasks
@alex
alex force-pushed the regression-test branch from 0126abe to 4d47482 Compare April 18, 2026 16:34
@mattiapitossi mattiapitossi added A-tokio Area: The main tokio crate M-blocking Module: tokio/task/blocking labels Apr 18, 2026
@alex

alex commented Apr 18, 2026

Copy link
Copy Markdown
Contributor Author

(Failures on integration tests look to be a GH failure, if someone can retry them.)

Comment thread tokio/tests/rt_spawn_blocking.rs Resolved
@mattiapitossi

Copy link
Copy Markdown
Member

(Failures on integration tests look to be a GH failure, if someone can retry them.)

Lately gh jobs are pretty unstable, I will re-run them

@alex

alex commented Apr 18, 2026

Copy link
Copy Markdown
Contributor Author

Thank you!

Comment thread tokio/tests/rt_spawn_blocking.rs Resolved
Comment thread tokio/tests/rt_spawn_blocking.rs Resolved
Comment thread tokio/tests/rt_spawn_blocking.rs Resolved
Comment on lines +43 to +44
// Run multiple times to make hitting the race condition very likely.
for _ in 0..512 {

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.

Since this is a race condition that we have to run multiple iterations in order to catch, I wonder if this might make sense to try and reproduce using loom (perhaps in addition to a normal test). It would be nice if we could use the model checker to deterministically simulate the interleaving that reproduces the bug, rather than just trying to run some code a whole bunch of times and hope one of them hits the race. It's hard to say for sure without a better understanding of the bug, but I wonder if loom's deadlock detection could catch this...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I originally thought loom would be a good fit, but this ended up being a quicker path for me to get a reproducer. Is there an existing loom test you think would be a good model for this type of test?

Comment thread tokio/tests/rt_spawn_blocking.rs Resolved
@alex

alex commented Apr 26, 2026

Copy link
Copy Markdown
Contributor Author

Ok, took me a while, but there's now a description of the bug + how this test attempts to replicate it. Let me know if they make sense.

@Darksonn

Copy link
Copy Markdown
Member

Since this is a racy test that's not guaranteed to catch the issue every time, can you please try pushing the queue sharding code to see if the error triggers in CI as well. This will verify that the perf characteristics of the github instances do not adjust timings so that it does not occur.

@github-actions github-actions Bot added the R-loom-blocking Run loom `runtime::spawn_blocking` tests on this PR label Apr 27, 2026
@alex

alex commented Apr 27, 2026

Copy link
Copy Markdown
Contributor Author

Ok, cherry-picked the sharded queue on this. Assuming the failures look good, I can then rebase it back off.

@Darksonn

Copy link
Copy Markdown
Member

Looks good, thanks!

@alex
alex force-pushed the regression-test branch from f694043 to 109929f Compare April 28, 2026 02:31
@github-actions github-actions Bot removed the R-loom-blocking Run loom `runtime::spawn_blocking` tests on this PR label Apr 28, 2026
@alex

alex commented Apr 28, 2026

Copy link
Copy Markdown
Contributor Author

Ok, rebased that commit out

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

@Darksonn
Darksonn merged commit dc0f728 into tokio-rs:master Apr 28, 2026
175 checks passed
@alex
alex deleted the regression-test branch April 28, 2026 11:12
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants