realm / realm-swift

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

Apple Watch App 3 crashes when calling `realm.create()` #8707

Open majih93 opened 3 weeks ago

majih93 commented 3 weeks ago

How frequently does the bug occur?

Sometimes

Description

Problem

Some of our users using our watchOS app on Apple Watch Series 3 are experiencing crashes in a certain scenario.

When calling a function called createDayExerciseInformation that creates a Realm object with realm.create(), the app seems to crash.

I have failed to reproduce this on a Simulator. On the simulator the app works just fine, but in production users experience this issue.

I have attached the Stack trace recoreded in Xcode's organizer.

I would appreciate any clues. I am very new to reading these crash logs.. :(

Stacktrace & log output

Incident Identifier: 324157B6-EB16-4490-9175-B3E882464AB7
Hardware Model:      Watch3,3
Process:             bfNew_Watch Watch App [309]
Path:                /private/var/containers/Bundle/Application/B3739A04-5C0B-4CB9-BE17-543200A4DEC8/bfNew_Watch Watch App.app/bfNew_Watch Watch App
Identifier:          com.bunnit.hajaios.watchkitapp
Version:             1.749 (749)
AppStoreTools:       16A242b
AppVariant:          1:Watch3,3:8
Code Type:           ARM (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           com.bunnit.hajaios.watchkitapp [369]

Date/Time:           2024-10-26 22:03:58.2819 +0900
Launch Time:         2024-10-26 22:03:56.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:  0

Thread 0 name:
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x0000000046605ff4 __pthread_kill + 8
1   libsystem_pthread.dylib         0x00000000577212e7 pthread_kill + 171 (pthread.c:1670)
2   libsystem_c.dylib               0x00000000409caaff abort + 91 (abort.c:120)
3   bfNew_Watch Watch App           0x00000000006da7c1 realm::util::terminate(char const*, char const*, long, std::initializer_list<realm::util::Printable>&&) + 1 (terminate.cpp:148)
4   bfNew_Watch Watch App           0x00000000006da981 realm::util::terminate_internal(std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char>>&) + 215 (terminate.cpp:143)
5   bfNew_Watch Watch App           0x00000000006da891 realm::util::terminate_with_info(char const*, char const*, long, char const*, std::initializer_list<realm::util::Printable>&&) + 195 (terminate.cpp:156)
6   bfNew_Watch Watch App           0x00000000006da7cf realm::util::terminate_with_info(char const*, char const*, long, char const*, std::initializer_list<realm::util::Printable>&&) + 1 (terminate.cpp:155)
7   bfNew_Watch Watch App           0x0000000000516b33 realm::GlobalKey::GlobalKey(realm::Mixed) + 1 (global_key.cpp:108)
8   bfNew_Watch Watch App           0x00000000004eb57d long long realm::Mixed::get<long long>() const + 7 (mixed.hpp:593)
9   bfNew_Watch Watch App           0x00000000004eb57d void realm::Cluster::do_insert_row<realm::ArrayIntNull>(unsigned long, realm::ColKey, realm::Mixed, bool) + 103 (cluster.cpp:278)
10  bfNew_Watch Watch App           0x00000000004e5b4f realm::Cluster::insert_row(unsigned long, realm::ObjKey, realm::FieldValues const&)::$_3::operator()(realm::ColKey) const + 253 (cluster.cpp:0)
11  bfNew_Watch Watch App           0x00000000004e5b4f bool realm::Table::for_each_and_every_column<realm::Cluster::insert_row(unsigned long, realm::ObjKey, realm::FieldValues const&)::$_3>(realm::Cluster::insert_row(unsigned long, realm::ObjKey, realm... + 271 (table.hpp:517)
12  bfNew_Watch Watch App           0x00000000004e5b4f realm::Cluster::insert_row(unsigned long, realm::ObjKey, realm::FieldValues const&) + 555 (cluster.cpp:439)
13  bfNew_Watch Watch App           0x00000000004e748f realm::Node::get_mem() const + 1 (node.hpp:163)
14  bfNew_Watch Watch App           0x00000000004e748f realm::Cluster::insert(realm::ObjKey, realm::FieldValues const&, realm::ClusterNode::State&) + 191 (cluster.cpp:704)
15  bfNew_Watch Watch App           0x00000000004f1037 realm::ClusterTree::insert_fast(realm::ObjKey, realm::FieldValues const&, realm::ClusterNode::State&) + 29 (cluster_tree.cpp:921)
16  bfNew_Watch Watch App           0x00000000004f1107 realm::ClusterTree::insert(realm::ObjKey, realm::FieldValues const&) + 47 (cluster_tree.cpp:939)
17  bfNew_Watch Watch App           0x00000000006a901d std::__1::vector<realm::FieldValue, std::__1::allocator<realm::FieldValue>>::__destroy_vector::operator()[abi:ue170006]() + 1 (vector:488)
18  bfNew_Watch Watch App           0x00000000006a901d std::__1::vector<realm::FieldValue, std::__1::allocator<realm::FieldValue>>::~vector[abi:ue170006]() + 1 (vector:500)
19  bfNew_Watch Watch App           0x00000000006a901d std::__1::vector<realm::FieldValue, std::__1::allocator<realm::FieldValue>>::~vector[abi:ue170006]() + 1 (vector:500)
20  bfNew_Watch Watch App           0x00000000006a901d realm::FieldValues::~FieldValues() + 1 (cluster.hpp:52)
21  bfNew_Watch Watch App           0x00000000006a901d realm::FieldValues::~FieldValues() + 1 (cluster.hpp:52)
22  bfNew_Watch Watch App           0x00000000006a901d realm::Table::create_linked_object() + 93 (table.cpp:2251)
23  bfNew_Watch Watch App           0x000000000053d7ab realm::LnkLst::create_and_insert_linked_object(unsigned long) + 77 (list.cpp:0)
24  bfNew_Watch Watch App           0x0000000000323363 void realm::List::add<objc_object* __strong&, RLMAccessorContext>(RLMAccessorContext&, objc_object* __strong&, realm::CreatePolicy) + 75 (list.hpp:189)
25  bfNew_Watch Watch App           0x000000000040fbb5 auto void realm::List::assign<objc_object* __strong&, RLMAccessorContext>(RLMAccessorContext&, objc_object* __strong&, realm::CreatePolicy)::'lambda'(objc_object* __strong&)::operator()<objc_object... + 41 (list.hpp:271)
26  bfNew_Watch Watch App           0x000000000040fbb5 void RLMStatelessAccessorContext::enumerate_collection<void realm::List::assign<objc_object* __strong&, RLMAccessorContext>(RLMAccessorContext&, objc_object* __strong&, realm::CreatePolicy)::'lambd... + 209 (RLMAccessor.hpp:75)
27  bfNew_Watch Watch App           0x000000000040fa6f void realm::List::assign<objc_object* __strong&, RLMAccessorContext>(RLMAccessorContext&, objc_object* __strong&, realm::CreatePolicy) + 111 (list.hpp:278)
28  bfNew_Watch Watch App           0x000000000040f113 void realm::Object::set_property_value_impl<objc_object* __strong, RLMAccessorContext>(RLMAccessorContext&, realm::Property const&, objc_object* __strong, realm::CreatePolicy, bool) + 387 (object_accessor.hpp:150)
29  bfNew_Watch Watch App           0x00000000003210b9 realm::Object realm::Object::create<objc_object* __strong, RLMAccessorContext>(RLMAccessorContext&, std::__1::shared_ptr<realm::Realm> const&, realm::ObjectSchema const&, objc_object* __strong, rea... + 1081 (object_accessor.hpp:360)
30  bfNew_Watch Watch App           0x000000000032086b RLMAccessorContext::createObject(objc_object*, realm::CreatePolicy, bool, realm::ObjKey) + 683 (RLMAccessor.mm:0)
31  bfNew_Watch Watch App           0x0000000000362837 RLMCreateObjectInRealmWithValue + 147 (RLMObjectStore.mm:132)
32  bfNew_Watch Watch App           0x000000000047ab03 Realm.create<A>(_:value:update:) + 139 (Realm.swift:618)
33  bfNew_Watch Watch App           0x00000000001f54ed closure #1 in RealmManager.createDayExerciseInformation() + 621 (Realm+ApplicationContext.swift:51)
34  bfNew_Watch Watch App           0x00000000001f8089 partial apply for closure #1 in RealmManager.createDayExerciseInformation() + 125 (<compiler-generated>:0)
35  bfNew_Watch Watch App           0x0000000000479f7f Realm.write<A>(withoutNotifying:_:) + 65 (Realm.swift:265)
36  bfNew_Watch Watch App           0x00000000001f5073 RealmManager.createDayExerciseInformation() + 1395 (Realm+ApplicationContext.swift:50)
37  bfNew_Watch Watch App           0x0000000000244207 specialized Dictionary.subscript.getter + 1 (<compiler-generated>:0)
38  bfNew_Watch Watch App           0x0000000000244207 closure #1 in ConnectivityProvider.processPlannedDayExercise(applicationContext:) + 1535 (ConnectivityProvider.swift:147)
39  bfNew_Watch Watch App           0x00000000003110b5 thunk for @escaping @callee_guaranteed () -> () + 21 (<compiler-generated>:0)
40  libdispatch.dylib               0x00000000453eed07 _dispatch_call_block_and_release + 11 (init.c:1518)
41  libdispatch.dylib               0x00000000453f0377 _dispatch_client_callout + 7 (object.m:565)
42  libdispatch.dylib               0x00000000453fae7d _dispatch_main_queue_drain + 713 (queue.c:7610)
43  libdispatch.dylib               0x00000000453fabaf _dispatch_main_queue_callback_4CF + 31 (queue.c:0)
44  CoreFoundation                  0x0000000040a57d59 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 11 (CFRunLoop.c:1797)
45  CoreFoundation                  0x0000000040a3209b __CFRunLoopRun + 2171 (CFRunLoop.c:3145)
46  CoreFoundation                  0x0000000040a6b6f7 CFRunLoopRunSpecific + 475 (CFRunLoop.c:0)
47  GraphicsServices                0x000000006191fb1f GSEventRunModal + 135 (GSEvent.c:2202)
48  UIKitCore                       0x0000000043293fc7 -[UIApplication _run] + 1063 (UIApplication.m:3517)
49  UIKitCore                       0x000000004323a8df UIApplicationMain + 115 (UIApplication.m:5069)
50  WatchKit                        0x000000005824519b WKApplicationMain + 147 (WKApplicationMain.m:20)
51  WatchKit                        0x000000005824e0bd WKApplicationExtensionMain + 369 (main.m:133)
52  SwiftUI                         0x0000000048b925b9 runApp<A>(_:) + 125 (WatchKitRenderer.swift:13)
53  SwiftUI                         0x0000000048b8d611 static App.main() + 53 (<compiler-generated>:0)
54  bfNew_Watch Watch App           0x000000000024107f main + 33 (bfNew_WatchApp.swift:0)
55  dyld                            0x0000000000b1d1d7 start + 439 (dyldMain.cpp:879)

Thread 1:
0   libsystem_pthread.dylib         0x000000005771c2c0 start_wqthread + 0

Thread 2 name:
Thread 2:
0   libsystem_kernel.dylib          0x00000000465ebfe8 kevent + 24
1   bfNew_Watch Watch App           0x0000000000568feb realm::_impl::ExternalCommitHelper::listen() + 119 (external_commit_helper.cpp:220)
2   bfNew_Watch Watch App           0x0000000000569095 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... + 37 (external_commit_helper.cpp:0)
3   libsystem_pthread.dylib         0x000000005771cd69 _pthread_start + 123 (pthread.c:891)
4   libsystem_pthread.dylib         0x000000005771c2ec thread_start + 20

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

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

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

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

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

Thread 8 name:
Thread 8:
0   libsystem_kernel.dylib          0x00000000465e922c mach_msg_trap + 20
1   libsystem_kernel.dylib          0x00000000465e98f3 mach_msg + 43 (mach_msg.c:122)
2   CoreFoundation                  0x0000000040a345a9 __CFRunLoopServiceMachPort + 339 (CFRunLoop.c:2646)
3   CoreFoundation                  0x0000000040a31bf3 __CFRunLoopRun + 979 (CFRunLoop.c:3002)
4   CoreFoundation                  0x0000000040a6b6f7 CFRunLoopRunSpecific + 475 (CFRunLoop.c:0)
5   Foundation                      0x000000004286fcd3 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 183 (NSRunLoop.m:374)
6   Foundation                      0x00000000429043f5 -[NSRunLoop(NSRunLoop) runUntilDate:] + 77 (NSRunLoop.m:420)
7   UIKitCore                       0x00000000432222ab -[UIEventFetcher threadMain] + 365 (UIEventFetcher.m:1167)
8   Foundation                      0x00000000428c0855 __NSThread__start__ + 667 (NSThread.m:974)
9   libsystem_pthread.dylib         0x000000005771cd69 _pthread_start + 123 (pthread.c:891)
10  libsystem_pthread.dylib         0x000000005771c2ec thread_start + 20

Thread 0 crashed with ARM Thread State (32-bit):
   ip: 0x0000000000000148     sp0x0000000027c258c0  lr: 0x00000000577212e7
   pc: 0x0000000046605ff4 cpsr: 0x0000000040000010

Binary Images:
           0x1dc000 -            0x827fff bfNew_Watch Watch App armv7k  <5182d0247e2234d09ea3ba369f590cf2> /private/var/containers/Bundle/Application/B3739A04-5C0B-4CB9-BE17-543200A4DEC8/bfNew_Watch Watch App.app/bfNew_Watch Watch App
           0xb1c000 -            0xb5ffff dyld armv7k  <180dbd0df3e03e4e966f746c37b500e9> /usr/lib/dyld
         0x40973000 -          0x409d2fff libsystem_c.dylib armv7k  <8402e7c9b4013b3a8c0c8490e876af1d> /usr/lib/system/libsystem_c.dylib
         0x40a2f000 -          0x40dbafff CoreFoundation armv7k  <4a0048a79b173f21b0bdce64c6df1199> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
         0x4286e000 -          0x42ac0fff Foundation armv7k  <629e4c02e3da38f5a6fb77299576865a> /System/Library/Frameworks/Foundation.framework/Foundation
         0x43111000 -          0x44136fff UIKitCore armv7k  <dd35b0d9ff763f049bc3fb8e4221324f> /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore
         0x453eb000 -          0x4542afff libdispatch.dylib armv7k  <e0ffc61c2a54346f98977178fffa069d> /usr/lib/system/libdispatch.dylib
         0x465e5000 -          0x46610fff libsystem_kernel.dylib armv7k  <020bee9457d63190824727aba0faeffc> /usr/lib/system/libsystem_kernel.dylib
         0x48aba000 -          0x4956bfff SwiftUI armv7k  <83ce903b0fa830758451c8f28847a019> /System/Library/Frameworks/SwiftUI.framework/SwiftUI
         0x5771a000 -          0x57725fff libsystem_pthread.dylib armv7k  <28cafa25486435b5a058829b0148621d> /usr/lib/system/libsystem_pthread.dylib
         0x5817f000 -          0x58284fff WatchKit armv7k  <8e2c35ee9a1837a88fcbb771b0bb0b56> /System/Library/Frameworks/WatchKit.framework/WatchKit
         0x6191e000 -          0x61925fff 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 3 weeks ago

➤ PM Bot commented:

Jira ticket: RCOCOA-2451