[Merged by Bors] - CI runs cargo miri test -p bevy_ecs - #4310
Conversation
cargo miri test -p bevy_ecs
| [dependencies] | ||
| futures-lite = "1.4.0" | ||
| event-listener = "2.4.0" | ||
| event-listener = "2.5.2" |
There was a problem hiding this comment.
dependabot should have warned us of this one... 🤔
|
This adds 7 minutes to CI but is probably worth it |
@mockersf down the line, can we change this to only run on PRs that modify bevy_ecs? Also as someone |
|
It should be added to Bors in https://github.com/bevyengine/bevy/blob/main/.github/bors.toml
Yes, but I'm not sure how Bors handles a job that only run on some of the PR... |
Co-authored-by: François <mockersf@gmail.com>
Co-authored-by: François <mockersf@gmail.com>
|
Can you push something that introduces UB so we can prove this will fail CI if we "regress"? |
|
(or if you've already tested this case on CI, can you send me a link?) |
|
https://github.com/bevyengine/bevy/runs/5684860671?check_suite_focus=true UB found by miri example |
|
bors r+ |
# Objective Fixes #1529 Run bevy_ecs in miri ## Solution - Don't set thread names when running in miri rust-lang/miri/issues/1717 - Update `event-listener` to `2.5.2` as previous versions have UB that is detected by miri: [event-listener commit](smol-rs/event-listener@1fa31c5) - Ignore memory leaks when running in miri as they are impossible to track down rust-lang/miri/issues/1481 - Make `table_add_remove_many` test less "many" because miri is really quite slow :) - Make CI run `RUSTFLAGS="-Zrandomize-layout" MIRIFLAGS="-Zmiri-ignore-leaks -Zmiri-tag-raw-pointers -Zmiri-disable-isolation" cargo +nightly miri test -p bevy_ecs`
cargo miri test -p bevy_ecscargo miri test -p bevy_ecs
| ~/.cargo/registry/index/ | ||
| ~/.cargo/registry/cache/ | ||
| ~/.cargo/git/db/ | ||
| target/ |
There was a problem hiding this comment.
This seems to not cache ~/.cargo/{.crates2.json,.crates.toml} so I assume it will still rebuild xargo each time? I am not sure how caching works for GHA though.
There was a problem hiding this comment.
the list of paths to cache is from https://github.com/actions/cache/blob/main/examples.md#rust---cargo... maybe it's not complete?
# Objective Fixes bevyengine#1529 Run bevy_ecs in miri ## Solution - Don't set thread names when running in miri rust-lang/miri/issues/1717 - Update `event-listener` to `2.5.2` as previous versions have UB that is detected by miri: [event-listener commit](smol-rs/event-listener@1fa31c5) - Ignore memory leaks when running in miri as they are impossible to track down rust-lang/miri/issues/1481 - Make `table_add_remove_many` test less "many" because miri is really quite slow :) - Make CI run `RUSTFLAGS="-Zrandomize-layout" MIRIFLAGS="-Zmiri-ignore-leaks -Zmiri-tag-raw-pointers -Zmiri-disable-isolation" cargo +nightly miri test -p bevy_ecs`
# Objective Fixes bevyengine#1529 Run bevy_ecs in miri ## Solution - Don't set thread names when running in miri rust-lang/miri/issues/1717 - Update `event-listener` to `2.5.2` as previous versions have UB that is detected by miri: [event-listener commit](smol-rs/event-listener@1fa31c5) - Ignore memory leaks when running in miri as they are impossible to track down rust-lang/miri/issues/1481 - Make `table_add_remove_many` test less "many" because miri is really quite slow :) - Make CI run `RUSTFLAGS="-Zrandomize-layout" MIRIFLAGS="-Zmiri-ignore-leaks -Zmiri-tag-raw-pointers -Zmiri-disable-isolation" cargo +nightly miri test -p bevy_ecs`
# Objective Fixes bevyengine#1529 Run bevy_ecs in miri ## Solution - Don't set thread names when running in miri rust-lang/miri/issues/1717 - Update `event-listener` to `2.5.2` as previous versions have UB that is detected by miri: [event-listener commit](smol-rs/event-listener@1fa31c5) - Ignore memory leaks when running in miri as they are impossible to track down rust-lang/miri/issues/1481 - Make `table_add_remove_many` test less "many" because miri is really quite slow :) - Make CI run `RUSTFLAGS="-Zrandomize-layout" MIRIFLAGS="-Zmiri-ignore-leaks -Zmiri-tag-raw-pointers -Zmiri-disable-isolation" cargo +nightly miri test -p bevy_ecs`
# Objective Make it possible to run miri with memory leak detection enabled. It is enabled by default, so it reports errors whenever I run it locally. And running it in CI should help prevent any new leaks from being introduced. See bevyengine#4310 and bevyengine#4959 for previous attempts to enable this. Note that miri has added backtraces to leaked allocations since then (rust-lang/rust#109061), so leaks are much easier to diagnose. ## Solution The first leak: When trying to drop non-send data on the wrong thread, the allocation for the value was being leaked. We can't drop the value from the wrong thread, but we could still deallocate its storage. Rework the thread check in `NonSendData::drop` so that it still deallocates, setting `present = false` to ensure the value's `drop` is not called. Change the `panic!` to a `warn!` so that we can have the check work the same way during unwinding. The second leak: The tests for `Interned` intentionally leak data! So we can't exactly "fix" them, but I'd like miri to stop failing on them. Then I realized that miri does not report leaks for our use of `Interned` for things like `ScheduleLabel`. That's because those values are stored in a `static`, so are still reachable. So, add a `static` to each of the tests with intentional leaks and store the leaked values there. miri will consider those values reachable, and not report any leaks. --------- Co-authored-by: Daniel Skates <zeophlite@gmail.com>
Objective
Fixes #1529
Run bevy_ecs in miri
Solution
event-listenerto2.5.2as previous versions have UB that is detected by miri: event-listener committable_add_remove_manytest less "many" because miri is really quite slow :)RUSTFLAGS="-Zrandomize-layout" MIRIFLAGS="-Zmiri-ignore-leaks -Zmiri-tag-raw-pointers -Zmiri-disable-isolation" cargo +nightly miri test -p bevy_ecs