async-rs / async-rs/futures-timer
Running `cargo miri test` fails due to thread outliving main thread
- Dominant language
- Rust
- Stars
- 219
- Forks
- 42
- PR merge metrics
- No merged PRs in 30d
Description
With the minimal example:
```
#[cfg(test)]
pub mod tests {
#[test]
fn mf_test_delay() {
block_on(Delay::new(Duration::from_millis(500)));
}
}
```
running the command:
```
MIRIFLAGS="-Zmiri-disable-isolation" cargo miri test mf_
```
will cause the tests to pass, but the overall command will fail with the following output:
```
❯ MIRIFLAGS="-Zmiri-disable-isolation" cargo miri test mf_
Finished `test` profile [unoptimized + debuginfo] target(s) in 0.16s
Running unittests src/lib.rs ()
running 1 tests
test stream::futures_unordered::mapped_futures::tests::mf_test_delay ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.68s
error: the main thread terminated without waiting for all remaining threads
note: set `MIRIFLAGS=-Zmiri-ignore-leaks` to disable this check
error: aborting due to 1 previous error
error: test failed, to rerun pass `--lib`
```
Rust version:
❯ rustc --version
rustc 1.85.0-nightly (0aeaa5eb2 2024-12-14)
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the issue with `MIRIFLAGS="-Zmiri-disable-isolation" cargo miri test mf_` and inspect `stream::futures_unordered::mapped_futures::tests::mf_test_delay`, using the minimal `Delay::new` example as the starting point. Trace which remaining thread causes Miri's leak check after the test passes; done means the command completes without the thread-outliving-main error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100