Skip to content

Conflicting Queries Panic - Systems in Different Stages #1316

@aevyrie

Description

@aevyrie

Bevy version

0.4

Operating system & version

Windows 10

What you did

Creating a demo that shows the Interaction component being used in 3d space with mod_picking alongside the UI:

https://github.com/aevyrie/bevy_mod_picking/blob/63cf2dcaedfa8dd5817ba3a2e317b64b8b256109/examples/3d_scene.rs#L4-L24

The panic happens iff lines 21 and 14 are both uncommented. You can uncomment one, but not both. My hunch is that something is going sideways with my use of the Interaction component.

What you expected to happen

The demo should run with a button overlaying a 3d scene, with both the button and meshes interactable.

What actually happened

The following panic occurs:

thread 'main' panicked at 'System &bevy_mod_picking::focus::mesh_focus has conflicting queries. &bevy_ui::focus::Interaction conflicts with 
the component access [bevy_ui::focus::Interaction] in this prior query: (&mut bevy_ui::focus::Interaction, core::option::Option<&bevy_ui::focus::FocusPolicy>, bevy_ecs::core::entities::Entity).', [path-redacted]\bevy_ecs-0.4.0\src\system\into_system.rs:73:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: process didn't exit successfully: `target\debug\examples\3d_scene.exe` (exit code: 101)

This line in the panic:

in this prior query: (&mut bevy_ui::focus::Interaction, core::option::Option<&bevy_ui::focus::FocusPolicy>, bevy_ecs::core::entities::Entity).

appears to be referencing the following query in mesh_focus():

https://github.com/aevyrie/bevy_mod_picking/blob/63cf2dcaedfa8dd5817ba3a2e317b64b8b256109/src/focus.rs#L8

The message:

&bevy_ui::focus::Interaction conflicts with 
the component access [bevy_ui::focus::Interaction]

Implies to me that the UI system is attempting to access Interaction while it is mutably borrowed in the mesh_focus() system.

The system in question does have another query with an immutable borrow of Interaction, but it works fine when the ui stage in my example is commented out.

Additional information

@alice-i-cecile mentioned the following:

I'm concerned that it's a particularly nasty soundness bug, hence the unusual level of concern
You managed to hit a check that @Ratysz was saying he's never seen triggered and was considering removing

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions