eclipse-iceoryx / iceoryx2

Eclipse iceoryx2™ - true zero-copy inter-process-communication in pure Rust
https://iceoryx.io
Apache License 2.0
449 stars 22 forks source link

Data race due to operation reordering in 'spmc::UnrestrictedAtomic::load' #125

Closed elBoberido closed 4 months ago

elBoberido commented 4 months ago

Required information

Operating system: all

Rust version: all

Cargo version: all

iceoryx2 version: main branch

Observed result or behaviour:

Reading from data in load can lead to a data race due to a reordering with the check to determine whether the write position changed.

Expected result or behaviour:

No reordering happens.

Conditions where it occurred / Performed steps:

Data race in the CI. Hard to reproduce.

CI failure on aarch64

test spmc_unrestricted_atomic_load_store_works_concurrently ... FAILED
failures:
---- spmc_unrestricted_atomic_load_store_works_concurrently stdout ----
thread '<unnamed>' panicked at iceoryx2-bb/lock-free/tests/spmc_unrestricted_atomic_tests.rs:102:21:
assertion failed: expr: verify_no_data_race(&sut.load()) == true;  value: false == true
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread 'spmc_unrestricted_atomic_load_store_works_concurrently' panicked at iceoryx2-bb/lock-free/tests/spmc_unrestricted_atomic_tests.rs:96:5:
a scoped thread panicked
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
failures:
    spmc_unrestricted_atomic_load_store_works_concurrently