Skip to content

iOS app panics on will_terminate #16637

@extrawurst

Description

@extrawurst

Bevy version

bevy 0.15

[Optional] Relevant system information

MacOs 15.1.1 (24B91)
XCode 16.1 (16B40)

AdapterInfo { name: "Apple iOS simulator GPU", vendor: 0, device: 0, device_type: DiscreteGpu, driver: "", driver_info: "", backend: Metal }

What you did

Run the bevy_mobile_example in the XCode simulator and hard quit the app like in the video:

Image

What went wrong

The debugger will trip over a panic we cause:

thread '<unnamed>' panicked at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-core-23.0.1/src/device/resource.rs:185:14:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread '<unnamed>' panicked at core/src/panicking.rs:221:5:
panic in a function that cannot unwind
stack backtrace:
   0:        0x1181e9464 - std::backtrace_rs::backtrace::libunwind::trace::h2504f6a7a9083436
                               at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:        0x1181e9464 - std::backtrace_rs::backtrace::trace_unsynchronized::h6d30c5a7e5c0e95b
                               at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:        0x1181e9464 - std::sys::backtrace::_print_fmt::h4d241177db3ad3db
                               at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/sys/backtrace.rs:66:9
   3:        0x1181e9464 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h7a0e784acb8aeff7
                               at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/sys/backtrace.rs:39:26
   4:        0x118229a64 - core::fmt::rt::Argument::fmt::hdcf4364f643ba5f0
                               at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/core/src/fmt/rt.rs:177:76
   5:        0x118229a64 - core::fmt::write::hc7ae0c33f591ced7
                               at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/core/src/fmt/mod.rs:1186:21
   6:        0x1181de7b4 - std::io::Write::write_fmt::h73a91b3d4edc8b40
                               at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/io/mod.rs:1839:15
   7:        0x1181e9318 - std::sys::backtrace::BacktraceLock::print::ha96d44dc3d9057c0
                               at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/sys/backtrace.rs:42:9
   8:        0x1181eb680 - std::panicking::default_hook::{{closure}}::h6410df3ad7c0548b
                               at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/panicking.rs:268:22
   9:        0x1181eb4c8 - std::panicking::default_hook::h04f2d093d7cf1671
                               at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/panicking.rs:295:9
  10:        0x1181ebed0 - std::panicking::rust_panic_with_hook::h5564521c80b92207
                               at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/panicking.rs:801:13
  11:        0x1181ebb58 - std::panicking::begin_panic_handler::{{closure}}::h24bfefb8a0ebe306
                               at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/panicking.rs:667:13
  12:        0x1181e9928 - std::sys::backtrace::__rust_end_short_backtrace::hc1a47cedc59d63b1
                               at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/sys/backtrace.rs:170:18
  13:        0x1181eb838 - rust_begin_unwind
                               at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/std/src/panicking.rs:665:5
  14:        0x1183b7c8c - core::panicking::panic_nounwind_fmt::runtime::h43645cfdb777a72f
                               at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/core/src/panicking.rs:112:18
  15:        0x1183b7c8c - core::panicking::panic_nounwind_fmt::hddc48505d5cccc9b
                               at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/core/src/panicking.rs:122:5
  16:        0x1183b7d04 - core::panicking::panic_nounwind::h56860050a0c8ebdc
                               at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/core/src/panicking.rs:221:5
  17:        0x1183b7e7c - core::panicking::panic_cannot_unwind::h2956a5941768ddb3
                               at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf/library/core/src/panicking.rs:310:5
  18:        0x1136bdb08 - winit::platform_impl::ios::app_delegate::AppDelegate::will_terminate::h661a91142ff42459
                               at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/objc2-0.5.2/src/macros/declare_class.rs:981:25
  19:        0x185aabf20 - -[UIApplication _terminateWithStatus:]
  20:        0x1850be5c0 - -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]
  21:        0x1850be2b0 - -[_UISceneLifecycleMultiplexer forceExitWithTransitionContext:scene:]
  22:        0x185aa40b4 - -[UIApplication workspaceShouldExit:withTransitionContext:]
  23:        0x1879c1a20 - ___63-[FBSWorkspaceScenesClient willTerminateWithTransitionContext:]_block_invoke_2
  24:        0x1879a1618 - -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:]
  25:        0x1879c19c4 - ___63-[FBSWorkspaceScenesClient willTerminateWithTransitionContext:]_block_invoke
  26:        0x102c267b8 - __dispatch_client_callout
  27:        0x102c2a3bc - __dispatch_block_invoke_direct
  28:        0x1879e4b58 - ___FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__
  29:        0x1879e4a34 - -[FBSMainRunLoopSerialQueue _targetQueue_performNextIfPossible]
  30:        0x1879e4b8c - -[FBSMainRunLoopSerialQueue _performNextFromRunLoopSource]
  31:        0x18041b324 - ___CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
  32:        0x18041b26c - ___CFRunLoopDoSource0
  33:        0x18041a9d0 - ___CFRunLoopDoSources0
  34:        0x1804150b0 - ___CFRunLoopRun
  35:        0x180414960 - _CFRunLoopRunSpecific
  36:        0x190183b10 - _GSEventRunModal
  37:        0x185aa2b40 - -[UIApplication _run]
  38:        0x185aa6d38 - _UIApplicationMain
  39:        0x1135cc988 - winit::platform_impl::ios::event_loop::EventLoop<T>::run::hfa7364d038636774
                               at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.30.5/src/platform_impl/ios/event_loop.rs:205:13
  40:        0x11358a788 - winit::event_loop::EventLoop<T>::run_app::he42ba14a079ab1c7
                               at /Users/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.30.5/src/event_loop.rs:265:9
  41:        0x1135dcfe0 - bevy_winit::state::winit_runner::h5d5e3cc23a8cce33
                               at /Users/stephan/code/bevy/crates/bevy_winit/src/state.rs:862:23
  42:        0x1135c05bc - core::ops::function::FnOnce::call_once::hb835a59dade9cf38
                               at /Users/stephan/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
  43:        0x1135c0384 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h5633b0124507a73d
                               at /Users/stephan/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
  44:        0x117cff790 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h03e06b6b1483f27a
                               at /Users/stephan/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/boxed.rs:2454:9
  45:        0x117d26e80 - bevy_app::app::App::run::h639b4f1c8d6ff08d
                               at /Users/stephan/code/bevy/crates/bevy_app/src/app.rs:170:9
  46:        0x11355a62c - bevy_mobile_example::main::hacdf6324ea22c01b
                               at /Users/stephan/code/bevy/examples/mobile/src/lib.rs:16:5
  47:        0x11355a244 - main_rs
                               at /Users/stephan/code/bevy/examples/mobile/src/lib.rs:13:1
  48:        0x113557898 - main
                               at /Users/stephan/code/bevy/examples/mobile/ios-src/main.m:4:5

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-WindowingPlatform-agnostic interface layer to run your app inC-BugAn unexpected or incorrect behaviorO-iOSSpecific to the iOS mobile operating systemP-CrashA sudden unexpected crashS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions