Skip to content

Tests occasionally fail (Apple M2 Max) #54

@SergioBenitez

Description

@SergioBenitez

On an M2 Max MacBook Pro, I am experiencing unexpected causality issues tied to using ThreadLocal. I ran the library's tests to see if I could exhibit similar behavior, given that the iter() test in particular looks like a decent model of my real-world situation, and indeed I get occasional test failures within seconds of repeatedly running the test suite. Here are a few:

running 6 tests
test thread_id::test_thread ... ok
test tests::same_thread ... ok
test tests::is_sync ... ok
test tests::different_thread ... ok
test tests::test_drop ... FAILED
test tests::iter ... ok

failures:

---- tests::test_drop stdout ----
thread 'tests::test_drop' panicked at 'assertion failed: `(left == right)`
  left: `0`,
 right: `1`', src/lib.rs:641:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
running 6 tests
test tests::test_drop ... ok
test thread_id::test_thread ... ok
test tests::is_sync ... ok
test tests::same_thread ... ok
test tests::different_thread ... ok
test tests::iter ... FAILED

failures:

---- tests::iter stdout ----
thread 'tests::iter' panicked at 'assertion failed: `(left == right)`
  left: `[1, 2, 3]`,
 right: `[1]`', src/lib.rs:616:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
running 6 tests
test tests::is_sync ... ok
test thread_id::test_thread ... ok
test tests::test_drop ... ok
test tests::same_thread ... ok
test tests::different_thread ... ok
test tests::iter ... FAILED

failures:

---- tests::iter stdout ----
thread 'tests::iter' panicked at 'assertion failed: `(left == right)`
  left: `[1, 2, 3]`,
 right: `[1, 3]`', src/lib.rs:616:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
running 6 tests
test tests::is_sync ... ok
test thread_id::test_thread ... ok
test tests::test_drop ... ok
test tests::same_thread ... ok
test tests::different_thread ... ok
test tests::iter ... FAILED

failures:

---- tests::iter stdout ----
thread 'tests::iter' panicked at 'assertion failed: `(left == right)`
  left: `[1, 2, 3]`,
 right: `[2, 3]`', src/lib.rs:616:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Note that exhibiting failures is much harder if you don't run the complete test suite, so I suspect the issue has something to do with threads being reused.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions