Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

despawn_recursive causing Tracy error #15299

Open
ConnorKnack opened this issue Sep 19, 2024 · 0 comments
Open

despawn_recursive causing Tracy error #15299

ConnorKnack opened this issue Sep 19, 2024 · 0 comments
Labels
A-Diagnostics Logging, crash handling, error reporting and performance analysis A-ECS Entities, components, systems, and events C-Bug An unexpected or incorrect behavior S-Needs-Design This issue requires design work to think about how it would best be accomplished

Comments

@ConnorKnack
Copy link

Bevy version

0.14.2

What you did

I have a project that involves spawning and despawning many entities. I am having trouble running Tracy with the project because of a Tracy error caused by despawn_recursive.

What went wrong

Tracy errors out because it runs over the limit of systems that can be tracked (32,000).

Additional information

The reason there are over 32,000 systems running is that DespawnRecursive uses the entity that was despawned to create the trace name, creating a unique system to be tracked in Tracy. This can be seen in the Statistics window in Tracy.

I was able to workaround the problem by limiting despawn_recursives, but this only delays the problem, as my project still eventually hits the 32k limit. Changing despawn_recursive to despawn, fixes the issue, but I need despawn_recursive in some places.

Tracy Error

tracy_error

Tracy Statistics, filled with 32,000 unique DespawnRecursive commands

tracy_statistics

Code causing the problem in bevy_hierarchy/src/hierarchy.rs

https://github.com/bevyengine/bevy/blob/1bb8007dceb03f41b20317bb44fcdfec1d70513c/crates/bevy_hierarchy/src/hierarchy.rs#L57C1-L81C2

impl Command for DespawnRecursive {
    fn apply(self, world: &mut World) {
        #[cfg(feature = "trace")]
        let _span = bevy_utils::tracing::info_span!(
            "command",
            name = "DespawnRecursive",
            entity = bevy_utils::tracing::field::debug(self.entity)
        )
        .entered();
        despawn_with_children_recursive(world, self.entity);
    }
}

impl Command for DespawnChildrenRecursive {
    fn apply(self, world: &mut World) {
        #[cfg(feature = "trace")]
        let _span = bevy_utils::tracing::info_span!(
            "command",
            name = "DespawnChildrenRecursive",
            entity = bevy_utils::tracing::field::debug(self.entity)
        )
        .entered();
        despawn_children_recursive(world, self.entity);
    }
}
@ConnorKnack ConnorKnack added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Sep 19, 2024
@alice-i-cecile alice-i-cecile added A-ECS Entities, components, systems, and events A-Diagnostics Logging, crash handling, error reporting and performance analysis S-Needs-Design This issue requires design work to think about how it would best be accomplished and removed S-Needs-Triage This issue needs to be labelled labels Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Diagnostics Logging, crash handling, error reporting and performance analysis A-ECS Entities, components, systems, and events C-Bug An unexpected or incorrect behavior S-Needs-Design This issue requires design work to think about how it would best be accomplished
Projects
None yet
Development

No branches or pull requests

2 participants