bevy icon indicating copy to clipboard operation
bevy copied to clipboard

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

Open Carbonhell opened this issue 2 years ago • 0 comments

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| {
    })
}

Carbonhell avatar Nov 15 '22 21:11 Carbonhell