bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
36.35k stars 3.59k forks source link

Bevy app never actually exits #10976

Open OleStrohm opened 11 months ago

OleStrohm commented 11 months ago

Bevy version

0.12.1

Relevant system information

I am running this on awesome v4.3, and Arch linux 6.6.5-arch1-1

What you did

The most basic app:

use bevy::prelude::*;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .run();
}

What went wrong

When exiting the window the program keeps running. The actual app stops (checked by printing something out in a system in Update), but control is never given back to the terminal. Looking in htop, almost all original threads seem to still be running.

Additional information

Looking at the backtrace in gdb it seems it's stuck in extracting data in the RenderApp:

#0  0x00007ffff7c9973d in syscall () from /usr/lib/libc.so.6
#1  0x00005555591bf691 in std::sys::unix::futex::futex_wait () at library/std/src/sys/unix/futex.rs:62
#2  std::sys::unix::locks::futex_condvar::Condvar::wait_optional_timeout () at library/std/src/sys/unix/locks/futex_condvar.rs:49
#3  std::sys::unix::locks::futex_condvar::Condvar::wait () at library/std/src/sys/unix/locks/futex_condvar.rs:33
#4  0x0000555558febd30 in std::sync::condvar::Condvar::wait<()> (self=0x55555a343640, guard=...)
    at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sync/condvar.rs:189
#5  0x0000555558fee9ff in parking::Inner::park (self=0x55555a343630, timeout=...) at src/lib.rs:366
#6  0x0000555558fee747 in parking::Parker::park (self=0x7ffff7b7a960) at src/lib.rs:121
#7  0x0000555558f2c04d in futures_lite::future::block_on::{closure#0}<alloc::vec::Vec<(), alloc::alloc::Global>, bevy_tasks::task_pool::{impl#2}::scope_with_executor_inner::{async_block_env#0}<bevy_ecs::schedule::executor::multi_threaded::{impl#2}::run::{closure_env#1}, ()>> (
    cache=0x7ffff7b7a958) at /home/ole/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-lite-1.13.0/src/future.rs:91
#8  0x0000555558f02774 in std::thread::local::LocalKey<core::cell::RefCell<(parking::Parker, core::task::wake::Waker)>>::try_with<core::cell::RefCell<(parking::Parker, core::task::wake::Waker)>, futures_lite::future::block_on::{closure_env#0}<alloc::vec::Vec<(), alloc::alloc::Global>, bevy_tasks::task_pool::{impl#2}::scope_with_executor_inner::{async_block_env#0}<bevy_ecs::schedule::executor::multi_threaded::{impl#2}::run::{closure_env#1}, ()>>, alloc::vec::Vec<(), alloc::alloc::Global>> (self=0x55555a18a1d0, f=...)
    at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/thread/local.rs:270
#9  0x0000555558f02332 in std::thread::local::LocalKey<core::cell::RefCell<(parking::Parker, core::task::wake::Waker)>>::with<core::cell::RefCell<(parking::Parker, core::task::wake::Waker)>, futures_lite::future::block_on::{closure_env#0}<alloc::vec::Vec<(), alloc::alloc::Global>, bevy_tasks::task_pool::{impl#2}::scope_with_executor_inner::{async_block_env#0}<bevy_ecs::schedule::executor::multi_threaded::{impl#2}::run::{closure_env#1}, ()>>, alloc::vec::Vec<(), alloc::alloc::Global>> (self=0x55555a18a1d0, f=...)
    at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/thread/local.rs:246
#10 0x0000555558f2bd37 in futures_lite::future::block_on<alloc::vec::Vec<(), alloc::alloc::Global>, bevy_tasks::task_pool::{impl#2}::scope_with_executor_inner::{async_block_env#0}<bevy_ecs::schedule::executor::multi_threaded::{impl#2}::run::{closure_env#1}, ()>> (future=...)
    at /home/ole/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-lite-1.13.0/src/future.rs:79
#11 0x0000555558ef9e43 in bevy_tasks::task_pool::TaskPool::scope_with_executor_inner<bevy_ecs::schedule::executor::multi_threaded::{impl#2}::run::{closure_env#1}, ()> (self=0x55555a299e98 <bevy_tasks::usages::COMPUTE_TASK_POOL::h7410a532c6ce189f>, tick_task_pool_executor=false,
    external_executor=0x55555a330ed0, scope_executor=0x55555a330ed0, f=...)
    at /home/ole/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_tasks-0.12.1/src/task_pool.rs:383
#12 0x0000555558ef8ade in bevy_tasks::task_pool::{impl#2}::scope_with_executor::{closure#0}<bevy_ecs::schedule::executor::multi_threaded::{impl#2}::run::{closure_env#1}, ()> (scope_executor=0x7ffff7b7a8f8)
    at /home/ole/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_tasks-0.12.1/src/task_pool.rs:320
#13 0x0000555558f025ff in std::thread::local::LocalKey<alloc::sync::Arc<bevy_tasks::thread_executor::ThreadExecutor, alloc::alloc::Global>>::try_with<alloc::sync::Arc<bevy_tasks::thread_executor::ThreadExecutor, alloc::alloc::Global>, bevy_tasks::task_pool::{impl#2}::scope_with_executor::{closure_env#0}<bevy_ecs::schedule::executor::multi_threaded::{impl#2}::run::{closure_env#1}, ()>, alloc::vec::Vec<(), alloc::alloc::Global>> (self=0x55555a188578, f=...) at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/thread/local.rs:270
#14 0x0000555558f0229e in std::thread::local::LocalKey<alloc::sync::Arc<bevy_tasks::thread_executor::ThreadExecutor, alloc::alloc::Global>>::with<alloc::sync::Arc<bevy_tasks::thread_executor::ThreadExecutor, alloc::alloc::Global>, bevy_tasks::task_pool::{impl#2}::scope_with_executor::{closure_env#0}<bevy_ecs::schedule::executor::multi_threaded::{impl#2}::run::{closure_env#1}, ()>, alloc::vec::Vec<(), alloc::alloc::Global>> (self=0x55555a188578, f=<error reading variable: Cannot access memory at address 0x1ddd>)
    at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/thread/local.rs:246
#15 0x0000555558ef898f in bevy_tasks::task_pool::TaskPool::scope_with_executor<bevy_ecs::schedule::executor::multi_threaded::{impl#2}::run::{closure_env#1}, ()> (self=0x55555a299e98 <bevy_tasks::usages::COMPUTE_TASK_POOL::h7410a532c6ce189f>, tick_task_pool_executor=false,
    external_executor=..., f=...) at /home/ole/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_tasks-0.12.1/src/task_pool.rs:316
#16 0x0000555558f22420 in bevy_ecs::schedule::executor::multi_threaded::{impl#2}::run (self=0x55555ad1ba80, schedule=0x7fffffff0b50,
    world=0x7fffffff4378) at src/schedule/executor/multi_threaded.rs:198
#17 0x0000555558f5eb51 in bevy_ecs::schedule::schedule::Schedule::run (self=0x7fffffff0b30, world=0x7fffffff4378)
    at src/schedule/schedule.rs:291
#18 0x00005555577db661 in bevy_ecs::world::{impl#3}::run_schedule::{closure#0}<bevy_render::ExtractSchedule> (world=0x7fffffff4378,
    sched=0x7fffffff0b30) at /home/ole/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.12.1/src/world/mod.rs:2088
#19 0x00005555577e17d8 in bevy_ecs::world::World::try_schedule_scope<(), bevy_render::ExtractSchedule, bevy_ecs::world::{impl#3}::run_schedule::{closure_env#0}<bevy_render::ExtractSchedule>> (self=0x7fffffff4378, label=..., f=...)
    at /home/ole/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.12.1/src/world/mod.rs:2007
#20 0x00005555577debff in bevy_ecs::world::World::schedule_scope<(), bevy_render::ExtractSchedule, bevy_ecs::world::{impl#3}::run_schedule::{closure_env#0}<bevy_render::ExtractSchedule>> (self=0x7fffffff4378, label=..., f=...)
    at /home/ole/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.12.1/src/world/mod.rs:2059
#21 0x00005555577db62f in bevy_ecs::world::World::run_schedule<bevy_render::ExtractSchedule> (self=0x7fffffff4378, label=...)
    at /home/ole/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.12.1/src/world/mod.rs:2088
#22 0x0000555557658af1 in bevy_render::extract (main_world=0x7fffffffc050, render_app=0x7fffffff4378) at src/lib.rs:396
hymm commented 11 months ago

https://github.com/bevyengine/bevy/issues/9543 might be related.