-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behaviorD-ComplexQuite challenging from either a design or technical perspective. Ask for help!Quite challenging from either a design or technical perspective. Ask for help!P-UnsoundA bug that results in undefined compiler behaviorA bug that results in undefined compiler behavior
Milestone
Description
Bevy version
What you did
I created this test:
#[test]
#[should_panic]
fn ub_find() {
#[derive(Resource, Default)]
struct SyncCounter(RwLock<()>);
fn assert_non_sync(counter: Res<SyncCounter>) {
// Panic if multiple instances of this system try to access `counter` at once.
let _guard = counter.0.try_write().unwrap();
// Make sure other systems have a chance to conflict with this one before dropping the guard.
std::thread::sleep(std::time::Duration::from_millis(100));
}
let mut world = World::default();
world.init_resource::<SyncCounter>();
let mut stage = SystemStage::parallel()
.with_system(assert_non_sync)
.with_system(assert_non_sync)
.with_system(assert_non_sync);
stage.run(&mut world);
}What were you expecting
The multiple instances of assert_non_sync should conflict with each other and safely cause a panic.
What went wrong
The following miri failure is triggered: https://github.com/JoJoJet/bevy/actions/runs/3457086747/jobs/5770279259
Additional information
I investigated a bit further on this branch. The test seems to randomly not fail sometimes, but eventually this failure was triggered:
https://github.com/JoJoJet/bevy/actions/runs/3457314695/jobs/5770662745
Some theories from @BoxyUwU https://discord.com/channels/691052431525675048/749335865876021248/1041500126880989184.
Metadata
Metadata
Assignees
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behaviorD-ComplexQuite challenging from either a design or technical perspective. Ask for help!Quite challenging from either a design or technical perspective. Ask for help!P-UnsoundA bug that results in undefined compiler behaviorA bug that results in undefined compiler behavior