Unnamed thread panicking when exiting
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
## Bevy version
The release number or commit hash of the version you're using.
```9ac0d9b50```
## \[Optional\] Relevant system information
If you cannot get Bevy to build or run on your machine, please include:
- the Rust version you're using (you can get this by running `cargo --version`)
- Bevy relies on the "latest stable release" of Rust
```cargo 1.74.0 (ecb9851af 2023-10-18)```
``` cargo 1.76.0-nightly (26333c732 2023-11-28)```
- nightly should generally work, but there are sometimes regressions: please let us know!
- the operating system or browser used, including its version
- e.g. Windows 10, Ubuntu 18.04, iOS 14
```
SystemInfo { os: "Linux Arch Linux", kernel: "6.6.3-zen1-1-zen", cpu: "Intel(R) Xeon(R) CPU E5-1620 0 @ 3.60GHz", core_count: "4", memory: "62.7 GiB" }
```
This issue did not happen on a Windows computer
If your bug is rendering-related, copy the adapter info that appears when you run Bevy.
```
AdapterInfo { name: "NVIDIA GeForce GTX 1080 Ti", vendor: 4318, device: 6918, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "545.29.06", backend: Vulkan }
```
You should also consider testing the examples of our upstream dependencies to help isolate any setup-specific issue:
- [`wgpu`](https://github.com/gfx-rs/wgpu) for rendering problems
- [`winit`](https://github.com/rust-windowing/winit) for input and window management
- The `winit` `multithreaded` example fails by panicking, but it does not look like this
- [`gilrs`](https://docs.rs/gilrs/latest/gilrs/) for gamepad inputs
## What you did
Describe how you arrived at the problem. If you can, consider providing a code snippet or link.
I ran any example that I have tested except for `hello_world`, then close any windows that are open.
```cargo run --example compute_shader_game_of_life```
```cargo run --example cargo run --example=breakout```
```cargo run --example 2d_shapes```
```cargo run --example 3d_shapes```
```cargo run --example audio```
```cargo run --example without_winit```
```cargo run --example multiple_windows```
## What went wrong
If it's not clear, break this out into:
- what were you expecting?
I expect the program to exit without any threads panicking
- what actually happened?
An unnamed thread panics after closing the window (or immediately for `without_winit`)
```
2023-11-30T07:03:25.484944Z INFO bevy_winit::system: Creating new window "App" (0v0)
2023-11-30T07:03:25.485215Z INFO log: Guessed window scale factor: 1
2023-11-30T07:03:25.546673Z INFO bevy_render::renderer: AdapterInfo { name: "NVIDIA GeForce GTX 1080 Ti", vendor: 4318, device: 6918, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "545.29.06", backend: Vulkan }
2023-11-30T07:03:26.235176Z INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux Arch Linux", kernel: "6.6.3-zen1-1-zen", cpu: "Intel(R) Xeon(R) CPU E5-1620 0 @ 3.60GHz", core_count: "4", memory: "62.7 GiB" }
2023-11-30T07:03:34.458575Z INFO bevy_window::system: No windows are open, exiting
2023-11-30T07:03:34.460920Z INFO bevy_winit::system: Closing window 0v0
thread '' panicked at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/thread/local.rs:246:26:
cannot access a Thread Local Storage value during or after destruction: AccessError
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```
## Additional information
Other information that can be used to further reproduce or isolate the problem.
This commonly includes:
With backtrace:
```
2023-12-01T18:17:55.357450Z INFO bevy_winit::system: Creating new window "App" (0v0)
2023-12-01T18:17:55.357756Z INFO log: Guessed window scale factor: 1
2023-12-01T18:17:55.448226Z INFO bevy_render::renderer: AdapterInfo { name: "NVIDIA GeForce GTX 1080 Ti", vendor: 4318, device: 6918, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "545.29.06", backend: Vulkan }
2023-12-01T18:17:56.213205Z INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux Arch Linux", kernel: "6.6.3-zen1-1-zen", cpu: "Intel(R) Xeon(R) CPU E5-1620 0 @ 3.60GHz", core_count: "4", memory: "62.7 GiB" }
2023-12-01T18:17:58.010182Z INFO bevy_window::system: No windows are open, exiting
2023-12-01T18:17:58.012347Z INFO bevy_winit::system: Closing window 0v0
thread '' panicked at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/thread/local.rs:246:26:
cannot access a Thread Local Storage value during or after destruction: AccessError
stack backtrace:
0: 0x563509d9aedc - std::backtrace_rs::backtrace::libunwind::trace::h67a838aed1f4d6ec
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
1: 0x563509d9aedc - std::backtrace_rs::backtrace::trace_unsynchronized::h1d1786bb1962baf8
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x563509d9aedc - std::sys_common::backtrace::_print_fmt::h5a0b1f807a002d23
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sys_common/backtrace.rs:67:5
3: 0x563509d9aedc - ::fmt::hf84ab6ad0b91784c
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sys_common/backtrace.rs:44:22
4: 0x563509dc755c - core::fmt::rt::Argument::fmt::h28f463bd1fdabed5
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/fmt/rt.rs:138:9
5: 0x563509dc755c - core::fmt::write::ha37c23b175e921b3
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/fmt/mod.rs:1114:21
6: 0x563509d9738e - std::io::Write::write_fmt::haa1b000741bcbbe1
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/io/mod.rs:1763:15
7: 0x563509d9acc4 - std::sys_common::backtrace::_print::h1ff1030b04dfb157
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sys_common/backtrace.rs:47:5
8: 0x563509d9acc4 - std::sys_common::backtrace::print::hb982056c6f29541c
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sys_common/backtrace.rs:34:9
9: 0x563509d9c573 - std::panicking::default_hook::{{closure}}::h11f92f82c62fbd68
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:272:22
10: 0x563509d9c294 - std::panicking::default_hook::hb8810fe276772c66
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:292:9
11: 0x563509d9cb65 - std::panicking::rust_panic_with_hook::hd2f0efd2fec86cb0
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:731:13
12: 0x563509d9ca61 - std::panicking::begin_panic_handler::{{closure}}::h3651b7fc4f61d784
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:609:13
13: 0x563509d9b406 - std::sys_common::backtrace::__rust_end_short_backtrace::hbc468e4b98c7ae04
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sys_common/backtrace.rs:170:18
14: 0x563509d9c7b2 - rust_begin_unwind
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:597:5
15: 0x563509dc48e5 - core::panicking::panic_fmt::h979245e2fdb2fabd
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/panicking.rs:72:14
16: 0x563509dc4eb3 - core::result::unwrap_failed::h8c4b86241881fbbb
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/result.rs:1652:5
17: 0x563509b66c7e - core::result::Result::expect::hb9a1f0196e63ce67
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/result.rs:1034:23
18: 0x5635095dc0ed - std::thread::local::LocalKey::with::he6bc2fb2c80dbd1d
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/thread/local.rs:246:9
19: 0x5635095df6f8 - as tracing_subscriber::layer::Layer>::on_event::h42e39bdc770ce9a4
at /home/abclop99/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tracing-subscriber-0.3.18/src/fmt/fmt_layer.rs:949:9
20: 0x5635095e5014 - as tracing_core::subscriber::Subscriber>::event::hc12a13866049b084
at /home/abclop99/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tracing-subscriber-0.3.18/src/layer/layered.rs:153:9
21: 0x5635099d1aa5 - tracing_core::dispatcher::Dispatch::event::hb33f590388f238e0
at /home/abclop99/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tracing-core-0.1.32/src/dispatcher.rs:615:13
22: 0x5635099d4399 - tracing_log::dispatch_record::{{closure}}::hd9d7da39ffc1049f
at /home/abclop99/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tracing-log-0.1.4/src/lib.rs:211:9
23: 0x5635099d15c7 - tracing_core::dispatcher::get_default::he630bacbf2214b60
at /home/abclop99/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tracing-core-0.1.32/src/dispatcher.rs:391:16
24: 0x5635099d3f2e - tracing_log::dispatch_record::h8b2d55175fd2a7df
at /home/abclop99/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tracing-log-0.1.4/src/lib.rs:195:5
25: 0x5635099d2ee9 - ::log::h00d578b98ae322ba
at /home/abclop99/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tracing-log-0.1.4/src/log_tracer.rs:199:13
26: 0x5635099d7c63 - log::__private_api::log::h3d104628759a6dc1
at /home/abclop99/.cargo/registry/src/index.crates.io-6f17d22bba15001f/log-0.4.20/src/__private_api.rs:22:5
27: 0x563508c36352 - wgpu_hal::gles::egl::egl_debug_proc::h280201abe243d3ed
at /home/abclop99/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-hal-0.17.2/src/gles/egl.rs:108:5
28: 0x7fd22c0b47d3 -
29: 0x7fd22c04df9e -
30: 0x7fd22c04e050 -
31: 0x7fd22c0a24d1 -
32: 0x7fd22c034aa1 -
33: 0x7fd22c04942b -
34: 0x7fd22c543633 -
35: 0x7fd22c54636f -
36: 0x7fd22c0ad4e0 -
37: 0x7fd22c0a32a0 -
38: 0x7fd22ddc0cc6 -
39: 0x7fd22ddc0e10 - exit
40: 0x563509d9f827 - std::sys::unix::os::exit::h80a00550cb6c8b3c
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sys/unix/os.rs:710:14
41: 0x563509d9999f - std::process::exit::hbb71e4406eef1bc7
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/process.rs:2201:5
42: 0x563506872347 - winit::platform_impl::platform::x11::EventLoop::run::h813fe0853e65b5b9
at /home/abclop99/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.28.7/src/platform_impl/linux/x11/mod.rs:499:9
43: 0x56350684e7bb - winit::platform_impl::platform::EventLoop::run::h565602b5f7f5c155
at /home/abclop99/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.28.7/src/platform_impl/linux/mod.rs:792:56
44: 0x5635068bd9fb - winit::event_loop::EventLoop::run::h63ada91debdf0f0a
at /home/abclop99/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.28.7/src/event_loop.rs:305:9
45: 0x5635068a853a - bevy_winit::run::h0126654684ac7460
at /home/abclop99/Documents/projects/github/bevy/crates/bevy_winit/src/lib.rs:235:5
46: 0x56350685b4bc - bevy_winit::winit_runner::h7b1ab6ad36403b2a
at /home/abclop99/Documents/projects/github/bevy/crates/bevy_winit/src/lib.rs:920:9
47: 0x5635068491e0 - core::ops::function::FnOnce::call_once::h72099b2acf31f117
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/ops/function.rs:250:5
48: 0x563506848d02 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hda2ae7f1ea426324
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/ops/function.rs:250:5
49: 0x563509a2989b - as core::ops::function::FnOnce>::call_once::h5fade207bf7a6529
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/alloc/src/boxed.rs:2007:9
50: 0x563509a25958 - bevy_app::app::App::run::h50583394a39979ed
at /home/abclop99/Documents/projects/github/bevy/crates/bevy_app/src/app.rs:314:9
51: 0x56350672bb75 - _2d_shapes::main::h0a194544c7dcabc8
at /home/abclop99/Documents/projects/github/bevy/examples/2d/2d_shapes.rs:6:5
52: 0x56350672a80b - core::ops::function::FnOnce::call_once::h0e7fcfc1c6575568
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/ops/function.rs:250:5
53: 0x56350672d2fe - std::sys_common::backtrace::__rust_begin_short_backtrace::h9afca02e1b5b3a5b
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sys_common/backtrace.rs:154:18
54: 0x563506731601 - std::rt::lang_start::{{closure}}::hd2a276051f53acd8
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/rt.rs:166:18
55: 0x563509d90f8b - core::ops::function::impls:: for &F>::call_once::hf9057cfaeeb252e2
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/ops/function.rs:284:13
56: 0x563509d90f8b - std::panicking::try::do_call::h629e203a624883e4
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:504:40
57: 0x563509d90f8b - std::panicking::try::h7b61614724d6a4f1
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:468:19
58: 0x563509d90f8b - std::panic::catch_unwind::h354ac1c0268491d8
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panic.rs:142:14
59: 0x563509d90f8b - std::rt::lang_start_internal::{{closure}}::h919fee3c5ba8f617
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/rt.rs:148:48
60: 0x563509d90f8b - std::panicking::try::do_call::h54583f67455bff32
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:504:40
61: 0x563509d90f8b - std::panicking::try::hb0e12c4e01d39dc2
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:468:19
62: 0x563509d90f8b - std::panic::catch_unwind::h367b6339e3ca9a3b
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panic.rs:142:14
63: 0x563509d90f8b - std::rt::lang_start_internal::ha5ce8533eaa0fda8
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/rt.rs:148:20
64: 0x5635067315da - std::rt::lang_start::h432d00215142fa1d
at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/rt.rs:165:17
65: 0x56350672c7ae - main
66: 0x7fd22dda7cd0 -
67: 0x7fd22dda7d8a - __libc_start_main
68: 0x563506728c95 - _start
69: 0x0 -
```
- screenshots
- logs
- theories about what might be going wrong
- workarounds that you used
- The programs still works, it just doesn't exit cleanly, so I just ignore the problem.
- links to related bugs, PRs or discussions
Contributor guide
Assessment
This issue has not been assessed yet.