realm / realm-swift

Realm is a mobile database: a replacement for Core Data & SQLite
https://realm.io
Apache License 2.0
16.31k stars 2.14k forks source link

Apple Watch App crashes on launch in Apple Watch Series 3 #8706

Open majih93 opened 2 hours ago

majih93 commented 2 hours ago

How frequently does the bug occur?

Always

Description

Problem

For many Apple Watch Series 3 users, our watchOS app crashes on launch.

For other devices newer than Apple Watch 3, this does not happen.

Also, the app does not crash when I build it locally on my machine in a Apple Watch 3 Simulator. This issue seems to occur only in build versions in the AppStore/TestFlight.

I am reporting this issue here because in the crash log obtained from the Xcode organizer, the killed thread seems to includes some realm related code execution. (I sorry can't explain more clearly, I am very new to reading these crash logs..)

Any help or clues of what might be causing this error, or where I should starting tracking the reason would be really appreciated. Thank you :)

Things I have tried

I have tried disabling Dead Code Stripping in Build Settings, according to the following issue https://github.com/realm/realm-swift/issues/6682, but it did not work for me.

Stacktrace & log output

Incident Identifier: EF1611D3-4978-4E69-B84D-7B685008F97A
Hardware Model:      Watch3,3
Process:             bfNew_Watch Watch App [347]
Path:                /private/var/containers/Bundle/Application/D4B86983-006A-45C5-8BFA-C5C6A95DA626/bfNew_Watch Watch App.app/bfNew_Watch Watch App
Identifier:          com.bunnit.hajaios.watchkitapp
Version:             1.733 (733)
AppStoreTools:       15F31e
AppVariant:          1:Watch3,3:8
Code Type:           ARM (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           com.bunnit.hajaios.watchkitapp [470]

Date/Time:           2024-08-06 07:38:52.5787 +0900
Launch Time:         2024-08-06 07:38:47.0000 +0900
OS Version:          Watch OS 8.8.1 (19U512)
Release Type:        User
Report Version:      104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Triggered by Thread:  2

Thread 0 name:
Thread 0:
0   libsystem_kernel.dylib          0x00000000468fd22c mach_msg_trap + 20
1   libsystem_kernel.dylib          0x00000000468fd8f3 mach_msg + 43 (mach_msg.c:122)
2   CoreFoundation                  0x0000000040d485a9 __CFRunLoopServiceMachPort + 339 (CFRunLoop.c:2646)
3   CoreFoundation                  0x0000000040d45bf3 __CFRunLoopRun + 979 (CFRunLoop.c:3002)
4   CoreFoundation                  0x0000000040d7f6f7 CFRunLoopRunSpecific + 475 (CFRunLoop.c:0)
5   GraphicsServices                0x0000000061c33b1f GSEventRunModal + 135 (GSEvent.c:2202)
6   UIKitCore                       0x00000000435a7fc7 -[UIApplication _run] + 1063 (UIApplication.m:3517)
7   UIKitCore                       0x000000004354e8df UIApplicationMain + 115 (UIApplication.m:5069)
8   WatchKit                        0x000000005855919b WKApplicationMain + 147 (WKApplicationMain.m:20)
9   WatchKit                        0x00000000585620bd WKApplicationExtensionMain + 369 (main.m:133)
10  SwiftUI                         0x0000000048ea65b9 runApp<A>(_:) + 125 (WatchKitRenderer.swift:13)
11  SwiftUI                         0x0000000048ea1611 static App.main() + 53 (<compiler-generated>:0)
12  bfNew_Watch Watch App           0x00000000002a125f main + 33 (bfNew_WatchApp.swift:0)
13  dyld                            0x0000000000b411d7 start + 439 (dyldMain.cpp:879)

Thread 1 name:
Thread 1:
0   libswiftCore.dylib              0x0000000046177c9d swift_conformsToProtocolMaybeInstantiateSuperclasses(swift::TargetMetadata<swift::InProcess> const*, swift::TargetProtocolDescriptor<swift::InProcess> const*, bool) + 1247 (ProtocolConformance.cpp:965)
1   libswiftCore.dylib              0x0000000046177665 swift_conformsToProtocol + 79 (CompatibilityOverrideRuntime.def:140)
2   AttributeGraph                  0x000000004988362d AG::LayoutDescriptor::Builder::visit_element(AG::swift::metadata const*, AG::swift::metadata::ref_kind, unsigned long) + 83 (ag-value.cc:975)
3   AttributeGraph                  0x000000004988483f AG::swift::metadata_visitor::visit_field(AG::swift::metadata const*, AG::swift::field_record const&, unsigned long) + 51 (ag-swift-metadata.cc:0)
4   AttributeGraph                  0x00000000498843af AG::swift::metadata::visit(AG::swift::metadata_visitor&) const + 163 (ag-swift-metadata.cc:269)
5   AttributeGraph                  0x00000000498836c7 AG::LayoutDescriptor::Builder::visit_element(AG::swift::metadata const*, AG::swift::metadata::ref_kind, unsigned long) + 237 (ag-value.cc:978)
6   AttributeGraph                  0x000000004988483f AG::swift::metadata_visitor::visit_field(AG::swift::metadata const*, AG::swift::field_record const&, unsigned long) + 51 (ag-swift-metadata.cc:0)
7   AttributeGraph                  0x00000000498843af AG::swift::metadata::visit(AG::swift::metadata_visitor&) const + 163 (ag-swift-metadata.cc:269)
8   AttributeGraph                  0x00000000498836c7 AG::LayoutDescriptor::Builder::visit_element(AG::swift::metadata const*, AG::swift::metadata::ref_kind, unsigned long) + 237 (ag-value.cc:978)
9   AttributeGraph                  0x000000004988483f AG::swift::metadata_visitor::visit_field(AG::swift::metadata const*, AG::swift::field_record const&, unsigned long) + 51 (ag-swift-metadata.cc:0)
10  AttributeGraph                  0x00000000498843af AG::swift::metadata::visit(AG::swift::metadata_visitor&) const + 163 (ag-swift-metadata.cc:269)
11  AttributeGraph                  0x00000000498836c7 AG::LayoutDescriptor::Builder::visit_element(AG::swift::metadata const*, AG::swift::metadata::ref_kind, unsigned long) + 237 (ag-value.cc:978)
12  AttributeGraph                  0x000000004988483f AG::swift::metadata_visitor::visit_field(AG::swift::metadata const*, AG::swift::field_record const&, unsigned long) + 51 (ag-swift-metadata.cc:0)
13  AttributeGraph                  0x00000000498843af AG::swift::metadata::visit(AG::swift::metadata_visitor&) const + 163 (ag-swift-metadata.cc:269)
14  AttributeGraph                  0x00000000498836c7 AG::LayoutDescriptor::Builder::visit_element(AG::swift::metadata const*, AG::swift::metadata::ref_kind, unsigned long) + 237 (ag-value.cc:978)
15  AttributeGraph                  0x000000004988483f AG::swift::metadata_visitor::visit_field(AG::swift::metadata const*, AG::swift::field_record const&, unsigned long) + 51 (ag-swift-metadata.cc:0)
16  AttributeGraph                  0x00000000498843af AG::swift::metadata::visit(AG::swift::metadata_visitor&) const + 163 (ag-swift-metadata.cc:269)
17  AttributeGraph                  0x00000000498836c7 AG::LayoutDescriptor::Builder::visit_element(AG::swift::metadata const*, AG::swift::metadata::ref_kind, unsigned long) + 237 (ag-value.cc:978)
18  AttributeGraph                  0x000000004988483f AG::swift::metadata_visitor::visit_field(AG::swift::metadata const*, AG::swift::field_record const&, unsigned long) + 51 (ag-swift-metadata.cc:0)
19  AttributeGraph                  0x00000000498843af AG::swift::metadata::visit(AG::swift::metadata_visitor&) const + 163 (ag-swift-metadata.cc:269)
20  AttributeGraph                  0x000000004988520d AG::LayoutDescriptor::make_layout(AG::swift::metadata const*, AGComparisonMode, AG::LayoutDescriptor::HeapMode) + 363 (ag-value.cc:1312)
21  AttributeGraph                  0x0000000049885577 AG::(anonymous namespace)::LayoutCache::drain_queue(void*) + 97 (ag-value.cc:0)
22  libdispatch.dylib               0x0000000045704377 _dispatch_client_callout + 7 (object.m:565)
23  libdispatch.dylib               0x000000004571178f _dispatch_root_queue_drain + 565 (queue.c:6870)
24  libdispatch.dylib               0x0000000045711ce3 _dispatch_worker_thread2 + 139 (queue.c:6937)
25  libsystem_pthread.dylib         0x0000000057a3020d _pthread_wqthread + 193 (pthread.c:2616)
26  libsystem_pthread.dylib         0x0000000057a302d4 start_wqthread + 20

Thread 2 name:
Thread 2 Crashed:
0   libsystem_kernel.dylib          0x0000000046919ff4 __pthread_kill + 8
1   libsystem_pthread.dylib         0x0000000057a352e7 pthread_kill + 171 (pthread.c:1670)
2   libsystem_c.dylib               0x0000000040cdeaff abort + 91 (abort.c:120)
3   libc++abi.dylib                 0x000000004cee6dcd __cxxabiv1::__aligned_malloc_with_fallback(unsigned long) + 1 (fallback_malloc.cpp:206)
4   libc++abi.dylib                 0x000000004cedc39f demangling_terminate_handler() + 187 (cxa_default_handlers.cpp:76)
5   libobjc.A.dylib                 0x0000000047ac5c1d _objc_terminate() + 119 (objc-exception.mm:0)
6   libc++abi.dylib                 0x000000004cee6659 std::__terminate(void (*)()) + 7 (cxa_handlers.cpp:61)
7   libc++abi.dylib                 0x000000004cee8449 __cxa_rethrow + 95 (cxa_exception.cpp:0)
8   bfNew_Watch Watch App           0x00000000005c921b realm::_impl::ExternalCommitHelper::ExternalCommitHelper(realm::_impl::RealmCoordinator&, realm::RealmConfig const&)::$_0::operator()() const + 101 (external_commit_helper.cpp:183)
9   bfNew_Watch Watch App           0x00000000005c921b decltype(std::declval<realm::_impl::ExternalCommitHelper::ExternalCommitHelper(realm::_impl::RealmCoordinator&, realm::RealmConfig const&)::$_0>()()) std::__1::__invoke[abi:ue170006]<realm::_impl::... + 101 (invoke.h:340)
10  bfNew_Watch Watch App           0x00000000005c921b void std::__1::__thread_execute[abi:ue170006]<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, realm::_impl::ExternalCommitHelper::ExternalCommi... + 101 (thread.h:227)
11  bfNew_Watch Watch App           0x00000000005c921b void* std::__1::__thread_proxy[abi:ue170006]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, realm::_impl::ExternalCommitHelper... + 155 (thread.h:238)
12  libsystem_pthread.dylib         0x0000000057a30d69 _pthread_start + 123 (pthread.c:891)
13  libsystem_pthread.dylib         0x0000000057a302ec thread_start + 20

Thread 3:
0   libsystem_pthread.dylib         0x0000000057a302c0 start_wqthread + 0

Thread 4:
0   libsystem_pthread.dylib         0x0000000057a302c0 start_wqthread + 0

Thread 5:
0   libsystem_pthread.dylib         0x0000000057a302c0 start_wqthread + 0

Thread 6:
0   libsystem_pthread.dylib         0x0000000057a302c0 start_wqthread + 0

Thread 7:
0   libsystem_pthread.dylib         0x0000000057a302c0 start_wqthread + 0

Thread 8 name:
Thread 8:
0   libsystem_kernel.dylib          0x00000000468fd22c mach_msg_trap + 20
1   libsystem_kernel.dylib          0x00000000468fd8f3 mach_msg + 43 (mach_msg.c:122)
2   CoreFoundation                  0x0000000040d485a9 __CFRunLoopServiceMachPort + 339 (CFRunLoop.c:2646)
3   CoreFoundation                  0x0000000040d45bf3 __CFRunLoopRun + 979 (CFRunLoop.c:3002)
4   CoreFoundation                  0x0000000040d7f6f7 CFRunLoopRunSpecific + 475 (CFRunLoop.c:0)
5   Foundation                      0x0000000042b83cd3 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 183 (NSRunLoop.m:374)
6   Foundation                      0x0000000042c183f5 -[NSRunLoop(NSRunLoop) runUntilDate:] + 77 (NSRunLoop.m:420)
7   UIKitCore                       0x00000000435362ab -[UIEventFetcher threadMain] + 365 (UIEventFetcher.m:1167)
8   Foundation                      0x0000000042bd4855 __NSThread__start__ + 667 (NSThread.m:974)
9   libsystem_pthread.dylib         0x0000000057a30d69 _pthread_start + 123 (pthread.c:891)
10  libsystem_pthread.dylib         0x0000000057a302ec thread_start + 20

Thread 9:
0   libsystem_pthread.dylib         0x0000000057a302c0 start_wqthread + 0

Thread 2 crashed with ARM Thread State (32-bit):
   ip: 0x0000000000000148     sp0x000000003f0a3ac0  lr: 0x0000000057a352e7
   pc: 0x0000000046919ff4 cpsr: 0x0000000040000010

Binary Images:
           0x23c000 -            0x887fff bfNew_Watch Watch App armv7k  <00f61c8d36f038c1b40e18ec37b50750> /private/var/containers/Bundle/Application/D4B86983-006A-45C5-8BFA-C5C6A95DA626/bfNew_Watch Watch App.app/bfNew_Watch Watch App
           0xb40000 -            0xb83fff dyld armv7k  <180dbd0df3e03e4e966f746c37b500e9> /usr/lib/dyld
         0x40c87000 -          0x40ce6fff libsystem_c.dylib armv7k  <8402e7c9b4013b3a8c0c8490e876af1d> /usr/lib/system/libsystem_c.dylib
         0x40d43000 -          0x410cefff CoreFoundation armv7k  <4a0048a79b173f21b0bdce64c6df1199> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
         0x42b82000 -          0x42dd4fff Foundation armv7k  <629e4c02e3da38f5a6fb77299576865a> /System/Library/Frameworks/Foundation.framework/Foundation
         0x43425000 -          0x4444afff UIKitCore armv7k  <dd35b0d9ff763f049bc3fb8e4221324f> /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore
         0x456ff000 -          0x4573efff libdispatch.dylib armv7k  <e0ffc61c2a54346f98977178fffa069d> /usr/lib/system/libdispatch.dylib
         0x45ef4000 -          0x4629bfff libswiftCore.dylib armv7k  <f376ce81b875373087741d9e334d50e4> /usr/lib/swift/libswiftCore.dylib
         0x468f9000 -          0x46924fff libsystem_kernel.dylib armv7k  <020bee9457d63190824727aba0faeffc> /usr/lib/system/libsystem_kernel.dylib
         0x47aaf000 -          0x47adefff libobjc.A.dylib armv7k  <299ee00e45503e07a0790082c1c330c8> /usr/lib/libobjc.A.dylib
         0x48dce000 -          0x4987ffff SwiftUI armv7k  <83ce903b0fa830758451c8f28847a019> /System/Library/Frameworks/SwiftUI.framework/SwiftUI
         0x49880000 -          0x498abfff AttributeGraph armv7k  <957e43268b6138f4965d02a66f19d04b> /System/Library/PrivateFrameworks/AttributeGraph.framework/AttributeGraph
         0x4ced8000 -          0x4ceebfff libc++abi.dylib armv7k  <20da0bb485ec32b4b078f7efdfdd01f6> /usr/lib/libc++abi.dylib
         0x57a2e000 -          0x57a39fff libsystem_pthread.dylib armv7k  <28cafa25486435b5a058829b0148621d> /usr/lib/system/libsystem_pthread.dylib
         0x58493000 -          0x58598fff WatchKit armv7k  <8e2c35ee9a1837a88fcbb771b0bb0b56> /System/Library/Frameworks/WatchKit.framework/WatchKit
         0x61c32000 -          0x61c39fff GraphicsServices armv7k  <ab20cfb1c82231168861059bcff80641> /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices

EOF

Can you reproduce the bug?

No

Reproduction Steps

No response

Version

10.49.2

What Atlas Services are you using?

Local Database only

Are you using encryption?

No

Platform OS and version(s)

watchOS 8.8.1

Build environment

Xcode version: 15.3 Dependency manager and version: Swift Package Manager

sync-by-unito[bot] commented 2 hours ago

➤ PM Bot commented:

Jira ticket: RCOCOA-2450