moka-rs / moka

A high performance concurrent caching library for Rust
Apache License 2.0
1.61k stars 73 forks source link

With Rust 1.73.0, some unit tests started to fail for `mips-unknown-linux-musl` target #333

Open tatsuya6502 opened 1 year ago

tatsuya6502 commented 1 year ago

Rust 1.73.0 has been released and some unit tests started to fail for 32-bit mips-unknown-linux-musl target.

Note that the CI is using QEMU's user space emulator, so emulation may not be accurate. However, as long as I can remember, these tests never failed with older versions of Rust.

https://github.com/moka-rs/moka/actions/runs/6436542687/job/17587394644

failures:

---- common::timer_wheel::tests::test_advance stdout ----
thread 'common::timer_wheel::tests::test_advance' panicked at src/common/timer_wheel.rs:667:22:
Expected an expired entry. Got Rescheduled(EntryInfo { key_hash: KeyHash { key: 1, hash: 1 }, is_admitted: false, is_dirty: true, last_accessed: AtomicInstant { instant: RwLock { data: Some(Instant(Instant { tv_sec: 434, tv_nsec: 814957001 })) } }, last_modified: AtomicInstant { instant: RwLock { data: Some(Instant(Instant { tv_sec: 434, tv_nsec: 814957001 })) } }, expiration_time: AtomicInstant { instant: RwLock { data: Some(Instant(Instant { tv_sec: 439, tv_nsec: 814957001 })) } }, policy_weight: 0 })
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- common::timer_wheel::tests::test_bucket_indices stdout ----
thread 'common::timer_wheel::tests::test_bucket_indices' panicked at src/common/timer_wheel.rs:586:9:
assertion `left == right` failed
  left: (0, 3)
 right: (0, 63)

---- sync::cache::tests::time_to_idle_by_expiry_type stdout ----
thread 'sync::cache::tests::time_to_idle_by_expiry_type' panicked at src/sync/cache.rs:2625:9:
assertion `left == right` failed
  left: 2
 right: 1

failures:
    common::timer_wheel::tests::test_advance
    common::timer_wheel::tests::test_bucket_indices
    sync::cache::tests::time_to_idle_by_expiry_type

test result: FAILED. 83 passed; 3 failed; 3 ignored; 0 measured; 0 filtered out; finished in 30.27s
tatsuya6502 commented 1 year ago
tatsuya6502 commented 1 year ago

Update the Linux cross compiler tests:

main branch (for v0.12.x):

v0.11.x branch:

v0.10.x branch:

v0.9.x branch:

tatsuya6502 commented 1 year ago

rust-lang >> t-compiler/help >> mipsel-unknown-linux-musl appears sad between 1.72.1/1.73.0 (near/396569490)

Both MIPS and MIPS64 are affected by a shift bug https://github.com/rust-lang/rust/issues/116177 that happens when the size of the integer is twice as large as a register, and the two are getting swapped for some reason

tatsuya6502 commented 11 months ago

Updated the Linux cross compiler tests:

main branch (for v0.12.x):

tatsuya6502 commented 11 months ago

Summary:

tatsuya6502 commented 11 months ago

The above issues have been resolved for Rust 1.76.0: https://github.com/rust-lang/rust/pull/117907.

1.76.0 is currently Nightly and will be stable on February 8, 2024.

tatsuya6502 commented 10 months ago

After upgrading Rust toolchain in my local environment to 1.75.0, I noticed rustup cannot install prebuilt std for the MIPS targets. This is because the MIPS targets have been demoted from tier 2 to tier 3. So the binary releases for these targets are no longer provided by the Rust project.

Our CI is currently using Rust 1.72.1 for the MIPS targets, so it will continue running.

The above issues have been resolved for Rust 1.76.0: https://github.com/rust-lang/rust/pull/117907.

1.76.0 is currently Nightly and will be stable on February 8, 2024.

When 1.76.0 is released, we will update our CI to use the latest stable for the MIPS targets again, by enabling build-std = true in the cross.toml.