[bug] Segfault on MacOS after window open
Opened this issue · 0 comments
lars-berger commented
Describe the bug
Segfault occurs shortly after a window is opened (MacOS-only) while the Tauri backend is otherwise idle.
Interestingly it never occurs when a window is first opened, but is consistently reproducible by repeatedly opening and closing windows.
Reproduction
- Clone https://github.com/glzr-io/zebar and checkout
tauri-segfault-repro
pnpm i && pnpm dev
- Select
Open settings
from the app's systray icon - In the settings window, select
vanilla.zebar.json
in the sidebar - Spam click any of the form inputs (e.g.
Resizable
). This causes the window to relaunch with the new settings, and will consistently segfault after 1-50 clicks of the form input.
Expected behavior
No response
Full tauri info
output
[✔] Environment
- OS: Mac OS 14.5.0 arm64 (X64)
✔ Xcode Command Line Tools: installed
✔ rustc: 1.80.0-nightly (debd22da6 2024-05-29)
✔ cargo: 1.80.0-nightly (431db31d0 2024-05-28)
✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
✔ Rust toolchain: nightly-aarch64-apple-darwin (overridden by '/Users/larsberger/projects/zebar-segfault/rust-toolchain.toml')
- node: 20.15.0
- pnpm: 9.4.0
- npm: 10.7.0
[-] Packages
- tauri 🦀: 2.0.4
- tauri-build 🦀: 2.0.1
- wry 🦀: 0.46.2
- tao 🦀: 0.30.3
- @tauri-apps/api : not installed!
- @tauri-apps/cli : 2.0.3
[-] Plugins
- tauri-plugin-single-instance 🦀: 2.0.1
- @tauri-apps/plugin-single-instance : not installed!
- tauri-plugin-dialog 🦀: 2.0.1
- @tauri-apps/plugin-dialog : not installed!
- tauri-plugin-fs 🦀: 2.0.1
- @tauri-apps/plugin-fs : not installed!
- tauri-plugin-http 🦀: 2.0.1
- @tauri-apps/plugin-http : not installed!
- tauri-plugin-shell 🦀: 2.0.1
- @tauri-apps/plugin-shell : not installed!
[-] App
- build-type: bundle
- CSP: connect-src 'self' ipc: http://ipc.localhost ws://localhost:6123; font-src 'self' *; img-src 'self' asset: http://asset.localhost blob: data: *; default-src 'self'; style-src 'self' 'unsafe-inline' *; script-src 'self' 'unsafe-eval' asset: http://asset.localhost
- frontendDist: ../settings-ui/dist
- devUrl: http://localhost:4200/
Stack trace
No response
Additional context
Totally unfamiliar with segfault debugging and core dumps, so listing the steps I followed to retrieve the core dump below:
# Allow core dumps.
sudo chmod 1777 /cores
ulimit -S -c unlimited
# Codesign the debug build with dummy entitlements.
/usr/libexec/PlistBuddy -c "Add :com.apple.security.get-task-allow bool true" tmp.entitlements
codesign -s - -f --entitlements tmp.entitlements ./target/debug/zebar
# Launch debug build and follow reproduction steps till segfault.
./target/debug/zebar
# Create and open the core dump file.
ls /cores # Outputs e.g. core.28863
lldb -c /cores/<CORE_FILE> ./target/debug/zebar # Substitute with correct path to core dump file
thread select 1
thread backtrace
Core dump:
* thread #1, stop reason = ESR_EC_DABORT_EL0 (fault address: 0x10)
* frame #0: 0x00000001834a9c20 libobjc.A.dylib`objc_msgSend + 32
frame #1: 0x0000000103babe54 zebar`_$LT$$LP$A$C$$RP$$u20$as$u20$objc..message..MessageArguments$GT$::invoke::hf08f49b8635292e0(imp=(libobjc.A.dylib`objc_msgSend), obj=0x0000000118f3b330, sel=Sel @ 0x000000016d7e5c80, (null)=(cocoa_foundation::foundation::macos::NSSize) @ 0x000000016d7e5ca8) at mod.rs:128:17
frame #2: 0x0000000103ba9994 zebar`objc::message::platform::send_unverified::h2de68543a6dede83(obj=0x0000000118f3b330, sel=Sel @ 0x000000016d7e5d50, args=(cocoa_foundation::foundation::macos::NSSize) @ 0x000000016d7e5d70) at mod.rs:27:9
frame #3: 0x0000000103ba269c zebar`_$LT$$BP$mut$u20$objc..runtime..Object$u20$as$u20$cocoa..appkit..NSWindow$GT$::setContentSize_::hd2979b57bb12fdd1 [inlined] objc::message::send_message::hefa2a452a00a0273(obj=0x0000000118f3b330, sel=Sel @ 0x000000016d7e5e70, args=(cocoa_foundation::foundation::macos::NSSize) @ 0x000000016d7e5e88) at mod.rs:178:5
frame #4: 0x0000000103ba2680 zebar`_$LT$$BP$mut$u20$objc..runtime..Object$u20$as$u20$cocoa..appkit..NSWindow$GT$::setContentSize_::hd2979b57bb12fdd1(self=0x0000000118f3b330, contentSize=(width = 1470, height = 40)) at appkit.rs:1701:9
frame #5: 0x0000000103b9dc98 zebar`tao::platform_impl::platform::util::async::set_content_size_async::_$u7b$$u7b$closure$u7d$$u7d$::h892d131deff1a61f at async.rs:89:5
frame #6: 0x0000000103b8c688 zebar`dispatch::context_and_function::work_execute_closure::hb40f60a1f4b80522(context=0x000000011d637e00) at lib.rs:94:9
frame #7: 0x00000001836ce3e8 libdispatch.dylib`_dispatch_client_callout + 20
frame #8: 0x00000001836dcbb8 libdispatch.dylib`_dispatch_main_queue_drain + 988
frame #9: 0x00000001836dc7cc libdispatch.dylib`_dispatch_main_queue_callback_4CF + 44
frame #10: 0x000000018399fad4 CoreFoundation`__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
frame #11: 0x000000018395d258 CoreFoundation`__CFRunLoopRun + 1996
frame #12: 0x000000018395c434 CoreFoundation`CFRunLoopRunSpecific + 608
frame #13: 0x000000018e10019c HIToolbox`RunCurrentEventLoopInMode + 292
frame #14: 0x000000018e0fffd8 HIToolbox`ReceiveNextEventCommon + 648
frame #15: 0x000000018e0ffd30 HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 76
frame #16: 0x00000001871bbd68 AppKit`_DPSNextEvent + 660
frame #17: 0x00000001879b1808 AppKit`-[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 700
frame #18: 0x00000001871af09c AppKit`-[NSApplication run] + 476
frame #19: 0x000000010383893c zebar`_$LT$$LP$$RP$$u20$as$u20$objc..message..MessageArguments$GT$::invoke::h10e4b9efb35ed797(imp=(libobjc.A.dylib`objc_msgSend), obj=0x000000011f0a47e0, sel=Sel @ 0x000000016d7e7490, (null)=<unavailable>) at mod.rs:128:17
frame #20: 0x0000000103838728 zebar`objc::message::platform::send_unverified::h4d152243f0997ffd(obj=0x000000011f0a47e0, sel=Sel @ 0x000000016d7e74f8, args=<unavailable>) at mod.rs:27:9
frame #21: 0x0000000102a9d21c zebar`tao::platform_impl::platform::event_loop::EventLoop$LT$T$GT$::run_return::h1671b5fd34c9c2fb [inlined] objc::message::send_message::h0d61d3bca8d7112e(obj=0x000000011f0a47e0, sel=Sel @ 0x000000016d7e79e8, args=<unavailable>) at mod.rs:178:5
frame #22: 0x0000000102a9d200 zebar`tao::platform_impl::platform::event_loop::EventLoop$LT$T$GT$::run_return::h1671b5fd34c9c2fb(self=0x000000016d7e7aa8, callback=<unavailable>) at event_loop.rs:225:16
frame #23: 0x0000000102a9de74 zebar`tao::platform_impl::platform::event_loop::EventLoop$LT$T$GT$::run::h9755136ec8d9fa6d(self=<unavailable>, callback=<unavailable>) at event_loop.rs:192:21
frame #24: 0x0000000102a9be30 zebar`tao::event_loop::EventLoop$LT$T$GT$::run::hbd5cea2a03a3370f(self=<unavailable>, event_handler={closure_env#0}<tauri::EventLoopMessage, tauri::app::{impl#16}::run::{closure_env#0}<tauri_runtime_wry::Wry<tauri::EventLoopMessage>, zebar::main::{async_block#0}::{closure_env#1}>> @ 0x000000016d7e7b80) at event_loop.rs:215:5
frame #25: 0x0000000103020c10 zebar`_$LT$tauri_runtime_wry..Wry$LT$T$GT$$u20$as$u20$tauri_runtime..Runtime$LT$T$GT$$GT$::run::h710880aafcd48e13(self=Wry<tauri::EventLoopMessage> @ 0x000000016d7e7e88, callback={closure_env#0}<tauri_runtime_wry::Wry<tauri::EventLoopMessage>, zebar::main::{async_block#0}::{closure_env#1}> @ 0x000000016d7e7fd8) at lib.rs:2726:5
frame #26: 0x0000000103044aa4 zebar`tauri::app::App$LT$R$GT$::run::h2dc9714d4d498b8a(self=App<tauri_runtime_wry::Wry<tauri::EventLoopMessage>> @ 0x000000016d7ea7e8, callback={closure_env#1} @ 0x000000016d7e81bf) at app.rs:1129:5
frame #27: 0x0000000102669de4 zebar`zebar::main::_$u7b$$u7b$closure$u7d$$u7d$::h82077487fcc0818f((null)=(__pointer = 0x000000016d7eaa97)) at main.rs:87:3
frame #28: 0x0000000102b47708 zebar`tokio::runtime::park::CachedParkThread::block_on::_$u7b$$u7b$closure$u7d$$u7d$::hd09bfdd1c46f781b at park.rs:281:63
frame #29: 0x0000000102b443fc zebar`tokio::runtime::park::CachedParkThread::block_on::h8bd4c04cf4b4d3ad at coop.rs:107:5
frame #30: 0x0000000102b44380 zebar`tokio::runtime::park::CachedParkThread::block_on::h8bd4c04cf4b4d3ad [inlined] tokio::runtime::coop::budget::h365d9c72ec300159(f={closure_env#0}<zebar::main::{async_block_env#0}> @ 0x000000016d7eaaf8) at coop.rs:73:5
frame #31: 0x0000000102b44324 zebar`tokio::runtime::park::CachedParkThread::block_on::h8bd4c04cf4b4d3ad(self=0x000000016d7eab7d, f={async_block_env#0} @ 0x000000016d7eaa3e) at park.rs:281:31
frame #32: 0x0000000102795150 zebar`tokio::runtime::context::blocking::BlockingRegionGuard::block_on::h8e1bffcef7cc8c0a(self=0x000000016d7eac50, f={async_block_env#0} @ 0x000000016d7eab7b) at blocking.rs:66:9
frame #33: 0x0000000102ef1e20 zebar`tokio::runtime::scheduler::multi_thread::MultiThread::block_on::_$u7b$$u7b$closure$u7d$$u7d$::h80938cda97832998(blocking=0x000000016d7eac50) at mod.rs:87:13
frame #34: 0x000000010279acc8 zebar`tokio::runtime::context::runtime::enter_runtime::h3ed252a74a355fe7(handle=0x000000016d7eae88, allow_block_in_place=true, f=(future = zebar::main::{async_block_env#0} @ 0x000000016d7eac0e)) at runtime.rs:65:16
frame #35: 0x0000000102ef1b94 zebar`tokio::runtime::scheduler::multi_thread::MultiThread::block_on::h540db91bfd0d32fc(self=0x000000016d7eae60, handle=0x000000016d7eae88, future={async_block_env#0} @ 0x000000016d7eacc5) at mod.rs:86:9
frame #36: 0x0000000102da76cc zebar`tokio::runtime::runtime::Runtime::block_on_inner::hbf2443700130c674(self=0x000000016d7eae58, future={async_block_env#0} @ 0x000000016d7ead1e) at runtime.rs:363:45
frame #37: 0x0000000102da7ba8 zebar`tokio::runtime::runtime::Runtime::block_on::haf9efc118fc4ab48(self=0x000000016d7eae58, future={async_block_env#0} @ 0x000000016d7eadce) at runtime.rs:335:13
frame #38: 0x0000000102afdc0c zebar`zebar::main::h672da972f2a23989 at main.rs:96:3
frame #39: 0x0000000102f1abf0 zebar`core::ops::function::FnOnce::call_once::h5ea35fb2b20ba38d((null)=(zebar`zebar::main::h672da972f2a23989 at main.rs:38), (null)=<unavailable>) at function.rs:250:5
frame #40: 0x00000001030d64d0 zebar`std::sys_common::backtrace::__rust_begin_short_backtrace::h4273634153d9d089(f=(zebar`zebar::main::h672da972f2a23989 at main.rs:38)) at backtrace.rs:155:18
frame #41: 0x0000000102c0c4bc zebar`std::rt::lang_start::_$u7b$$u7b$closure$u7d$$u7d$::h73bf01131ce8a311 at rt.rs:159:18
frame #42: 0x00000001041f9674 zebar`std::rt::lang_start_internal::h53a33f07dfc5ec3c [inlined] core::ops::function::impls::_$LT$impl$u20$core..ops..function..FnOnce$LT$A$GT$$u20$for$u20$$RF$F$GT$::call_once::h15342bf524497bb6 at function.rs:284:13 [opt]
frame #43: 0x00000001041f966c zebar`std::rt::lang_start_internal::h53a33f07dfc5ec3c [inlined] std::panicking::try::do_call::h816e9d7eafbe96d5 at panicking.rs:559:40 [opt]
frame #44: 0x00000001041f966c zebar`std::rt::lang_start_internal::h53a33f07dfc5ec3c [inlined] std::panicking::try::he4034598ffb399ab at panicking.rs:523:19 [opt]
frame #45: 0x00000001041f966c zebar`std::rt::lang_start_internal::h53a33f07dfc5ec3c [inlined] std::panic::catch_unwind::hb0f852366e4ee9d8 at panic.rs:149:14 [opt]
frame #46: 0x00000001041f966c zebar`std::rt::lang_start_internal::h53a33f07dfc5ec3c [inlined] std::rt::lang_start_internal::_$u7b$$u7b$closure$u7d$$u7d$::hcbe8b19d4b6f7f13 at rt.rs:141:48 [opt]
frame #47: 0x00000001041f966c zebar`std::rt::lang_start_internal::h53a33f07dfc5ec3c [inlined] std::panicking::try::do_call::h0ff9630736d9b7f8 at panicking.rs:559:40 [opt]
frame #48: 0x00000001041f9668 zebar`std::rt::lang_start_internal::h53a33f07dfc5ec3c [inlined] std::panicking::try::h245d37a65ae1af4e at panicking.rs:523:19 [opt]
frame #49: 0x00000001041f9668 zebar`std::rt::lang_start_internal::h53a33f07dfc5ec3c [inlined] std::panic::catch_unwind::h26ddaa60696e0e16 at panic.rs:149:14 [opt]
frame #50: 0x00000001041f9668 zebar`std::rt::lang_start_internal::h53a33f07dfc5ec3c at rt.rs:141:20 [opt]
frame #51: 0x0000000102c0c488 zebar`std::rt::lang_start::hc039a6dd87c13b53(main=(zebar`zebar::main::h672da972f2a23989 at main.rs:38), argc=1, argv=0x000000016d7eb400, sigpipe='\0') at rt.rs:158:17
frame #52: 0x0000000102afdca4 zebar`main + 36
frame #53: 0x00000001834f60e0 dyld`start + 2360