Skip to content

Panics while loading assets kill IoThreads preventing assets to be further loaded #2302

@lassade

Description

@lassade

Bevy version

main branch c4b8210

Operating system & version

Fedora 33

What you did

Write any AssetLoader that panics, like so:

#[derive(Default)]
pub struct EvilLoader;

impl AssetLoader for EvilLoader {
    fn load<'a>(
        &'a self,
        bytes: &'a [u8],
        load_context: &'a mut LoadContext,
    ) -> BoxedFuture<'a, Result<()>> {
        Box::pin(async move { panic!("malevolence") })
    }

    fn extensions(&self) -> &[&str] {
        &["evil"]
    }
}

Any attempt to load the evil asset will kill the IO Thread, in a 4 thread cpu like mine this means that if I got 1 panic not asset can be loaded after

What you expected to happen

A panic should closes bevy or at least restart the IO Thread so the app doesn't hangs

What actually happened

Bevy just hangs and nothing else loads

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-AssetsLoad files from disk to use for things like images, models, and soundsC-BugAn unexpected or incorrect behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions