Skip to content

par_for_each and par_for_each_mut app freeze with 100% CPU usage if an invalid batch_size is passed #6640

@Carbonhell

Description

@Carbonhell

Bevy version

0.9.0

What you did

While running a parallel query, I accidentally passed an invalid value of 0 as batch_size.

What went wrong

This caused my application to freeze forever and apparently consume a lot of resources (I even got a blue screen of death, but I'm not sure if it was just a coincidence since it happened only once. While my application was frozen, the application was reported as using 100% CPU on the task manager.
I was expecting a panic on a clearly wrong batch_size passed as input.

Additional information

You can easily reproduce this with this application:

use bevy::prelude::{App, Transform};

fn main() {
    let mut app = App::new();

    app.world.spawn(Transform::default());
    app.update();

    let mut query = app.world.query::<(&Transform,)>();

    query.par_for_each(&app.world, 0, |t| {
    })
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-BugAn unexpected or incorrect behavior

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions