Executive Summary & Direct Answer

RUSTSEC-2026-0384 describes a race in Tokio v1.54.0 between Interval::poll_tick and the multi-threaded runtime’s time driver. It can cause a data race and use-after-free; a test that merely observes tick timing cannot prove the race is absent. The production fix is to use Tokio 1.54.1 or later (or a release before 1.54.0) and verify the resolved dependency. Use paused-time tests to check interval semantics deterministically, and treat stress testing as supplemental—not as a substitute for upgrading.

The advisory affects Interval, including .tick().await, on the multi-threaded runtime. It does not affect Sleep or Timeout. Tokio v1.54.0 was yanked; do not attempt to validate the fix by running a vulnerable build in production or under ordinary tests. Instead, test deterministic behavior against the patched dependency and use dependency checks to confirm the version in the shipped artifact.

Environment and baseline

Examples below target Rust 1.82+ (Edition 2021) and Tokio 1.54.1 or later. The same approach applies to later compatible Tokio 1.x releases. The test-util feature enables paused time and advance; rt-multi-thread enables the runtime configuration relevant to the advisory.

[dependencies]
tokio = { version = "1.54.1", features = [
    "macros",
    "rt",
    "rt-multi-thread",
    "time",
] }

[dev-dependencies]
tokio = { version = "1.54.1", features = [
    "macros",
    "rt",
    "rt-multi-thread",
    "time",
    "test-util",
] }

Tokio features are additive across dependency declarations, but keep the feature set explicit so tests and production builds are understandable. A version requirement in Cargo.toml is not enough to establish what ships: Cargo.lock and the resolved dependency graph determine the concrete version. Check both before release.

What the race is—and why a timing test is not a reproducer

The advisory’s specific mechanism is a race between Interval::poll_tick and the runtime time driver in Tokio v1.54.0 on the multi-threaded runtime. The affected path can drop an internal timer entry without synchronizing with the driver thread that is firing it. As described in RUSTSEC-2026-0384, the resulting data race can produce a use-after-free involving the timer’s waker and task state. Possible consequences include assertion panics, task reference-count corruption, and heap memory corruption.

This is not an ordinary “missed tick” bug, and no application-level ordering of calls to .tick().await repairs it. The change that introduced the issue was Tokio PR #8458; Tokio fixed it in PR #8692. Tokio 1.54.0 is affected and yanked; Tokio >=1.54.1 is patched; versions <1.54.0 are listed as unaffected by this advisory. Sleep and Timeout are not affected according to the advisory.

A test that repeatedly starts tasks, polls intervals, and looks for a panic is not a reliable detector of this race. The problematic interleaving depends on runtime scheduling and driver activity; a test can pass many times without exercising it. Worse, running intentionally vulnerable code can cause undefined behavior, so absence of a crash is not evidence of safety. The right regression strategy is to ensure the patched Tokio version is resolved, then separately test application-level tick semantics.

Naive pattern: “stress it until it breaks”

This is tempting but insufficient:

// Not a proof of safety, and not a safe way to validate a vulnerable Tokio.
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
async fn interval_seems_ok_under_load() {
    let mut interval = tokio::time::interval(std::time::Duration::from_micros(1));

    for _ in 0..1_000_000 {
        interval.tick().await;
        tokio::task::yield_now().await;
    }
}

The test doesn’t control the time driver’s thread interleavings, and a successful run establishes only that this execution did not visibly fail. It may also be an unnecessarily expensive test that flakes under CI load. Increasing the iteration count does not turn a probabilistic stress test into a deterministic regression test.

Use stress tests, if appropriate, only as supplementary coverage against the fixed version. Do not make them the security gate for RUSTSEC-2026-0384. For a broader strategy around test organization and failure diagnosis, see Advanced Unit Testing and Debugging in Rust.

Production fix: upgrade and verify the resolved crate

Use Tokio 1.54.1 or later and update the lockfile. For example:

cargo update -p tokio
cargo tree -i tokio
cargo audit

Inspect the output of cargo tree -i tokio to find which packages depend on Tokio and confirm that the resolved Tokio version is at least 1.54.1. If a transitive dependency or a committed lockfile keeps the vulnerable version selected, update the dependency constraints or lockfile rather than assuming a top-level requirement changed the graph.

For reproducible CI, run the checks against the committed lockfile:

cargo check --locked
cargo test --locked
cargo tree --locked -i tokio
cargo audit

--locked fails if Cargo would need to modify the lockfile, helping catch an out-of-date or missing lockfile in the release workflow. cargo audit checks the resolved dependency graph against RustSec advisories; retain it as a useful additional gate, not as a substitute for inspecting the actual version.

Deterministically test interval behavior with paused time

Paused-time tests answer a narrower, useful question: does application code handle interval scheduling as intended? They avoid wall-clock sleeps and make tick deadlines controllable. The following test checks that a tick scheduled at 10 ms becomes ready after advancing Tokio time by that amount:

use std::time::Duration;
use tokio::time::{advance, interval_at, Instant};

#[tokio::test(start_paused = true)]
async fn interval_tick_is_ready_after_its_deadline() {
    let start = Instant::now() + Duration::from_millis(10);
    let mut ticks = interval_at(start, Duration::from_millis(20));

    // The first tick is scheduled 10 ms in the future.
    advance(Duration::from_millis(9)).await;
    assert!(!ticks.tick().now_or_never().is_some());

    advance(Duration::from_millis(1)).await;
    assert_eq!(ticks.tick().await, start);
}

That example needs FutureExt from futures-util for now_or_never, so prefer a simple timeout-free arrangement that doesn’t need an extra dependency:

use std::time::Duration;
use tokio::time::{advance, interval_at, Instant};

#[tokio::test(start_paused = true)]
async fn interval_yields_the_expected_scheduled_tick() {
    let start = Instant::now() + Duration::from_millis(10);
    let mut ticks = interval_at(start, Duration::from_millis(20));

    advance(Duration::from_millis(10)).await;
    assert_eq!(ticks.tick().await, start);

    advance(Duration::from_millis(20)).await;
    assert_eq!(ticks.tick().await, start + Duration::from_millis(20));
}

This verifies the interval’s observable schedule under controlled time. It does not exercise or rule out the race between a worker thread polling Interval and the multi-threaded runtime’s time driver: start_paused = true is intended for deterministic time testing, not for reproducing that cross-thread memory-safety failure.

Choose and test a MissedTickBehavior explicitly if application behavior depends on delayed work. Burst, Delay, and Skip have different catch-up semantics; a test should assert the behavior your service requires rather than assume that all overdue ticks are handled identically. For tests that need to exercise an actual service boundary, keep the runtime configuration and integration setup intentional; Effective Integration Testing in Rust covers that distinction.

Trade-offs and verification limits

ApproachTiming controlWhat it establishesImportant limitation
Paused-time #[tokio::test]Deterministic virtual timeApplication-visible tick deadlines and scheduling expectationsDoes not reproduce the multi-threaded driver race
Multi-threaded stress test on patched TokioReal scheduler and driverCan expose some regressions or application racesA pass does not prove absence of a race
Dependency and advisory checksExact resolved crate versionWhether the build uses the patched Tokio releaseDoes not test application-level interval semantics
Test against Tokio 1.54.0Uncontrolled, potentially unsafeNothing needed for a safe release gateVulnerable version is yanked; memory corruption is possible

The practical cost difference matters: a paused-time test advances virtual time without waiting for those durations in real time, whereas a stress test consumes scheduler and CPU time and remains probabilistic. Version verification is cheap and directly checks the primary mitigation. None of these test methods can independently prove the absence of all possible unsafe behavior in a dependency.

Production pitfalls and verification workflow

  1. Check the full graph. A direct dependency declaration does not guarantee every build configuration resolves the expected Tokio version. Inspect the committed lockfile and run cargo tree -i tokio in CI.
  2. Test every relevant feature configuration. Feature unification can make the local graph differ from a minimal build. Verify the same workspace members, targets, and lockfile used by release builds.
  3. Do not treat “unaffected” as “patched.” The advisory lists <1.54.0 as unaffected, but upgrading to >=1.54.1 is the direct fix when updating from 1.54.0.
  4. Keep semantic tests and version checks separate. Paused-time tests catch incorrect application assumptions; dependency checks catch selecting the affected Tokio release.
  5. Use Miri for what it can check. cargo miri test can help detect certain undefined behavior in supported code paths, but it is not a deterministic detector for this runtime-thread race and does not replace the upgrade.

A useful release check is:

cargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace --locked
cargo tree --locked -i tokio
cargo audit

Review the cargo tree output as part of the release gate and confirm no resolved Tokio version is 1.54.0. Keep deterministic interval behavior tests in the normal suite; avoid tests that depend on wall-clock sleeps or claim to reproduce a particular thread interleaving.

Frequently Asked Questions (FAQ)

Is Tokio v1.54.0 affected by RUSTSEC-2026-0384?

Yes. The advisory identifies a race between Interval::poll_tick and the multi-threaded runtime’s time driver in Tokio v1.54.0, and the release was yanked. Upgrade to Tokio 1.54.1 or later; the advisory lists versions before 1.54.0 as unaffected.

Can a paused-time Tokio test reproduce CVE-2026-115567?

No. Paused-time tests provide deterministic control over timer deadlines, but they do not reproduce the specific race between interval polling and the multi-threaded runtime’s time driver. Use them to verify application tick semantics, and verify the patched Tokio version independently.

Does RUSTSEC-2026-0384 affect Tokio Sleep or Timeout?

No. The advisory says the issue affects Interval only, including .tick().await; Sleep and Timeout are not affected. The reported aliases are CVE-2026-115567 and GHSA-5wjr-9356-4wc8.

Learn more with useful resources