realm / realm-core

Core database component for the Realm Mobile Database SDKs
https://realm.io
Apache License 2.0
1.01k stars 157 forks source link

iOS app crashed when reading from Realm database in widget extension #7832

Open emilymittleman opened 2 months ago

emilymittleman commented 2 months ago

SDK and version

SDK : Cocoa Version: 10.45.3

Observations

Crash log / stacktrace

Incident Identifier: ABEE0C67-E110-48DD-9B22-75FE98ED5867
Distributor ID:      com.apple.AppStore
Hardware Model:      iPhone13,3
Process:            [redacted] [30341]
Path:                /private/var/containers/Bundle/Application/609A3D90-35F9-407C-B12F-ACB2A92FBED7/[redacted]/PlugIns/[redacted]Intent.appex/[redacted]Intent
Identifier:          com.[redacted].[redacted].[redacted]Intent
Version:             4.33.5 (2673)
AppVariant:          1:iPhone13,3:15
Code Type:           ARM-64 (Native)
Role:                Unspecified
Parent Process:      launchd [1]
Coalition:           com.[redacted].[redacted].[redacted]Intent [4601]

Date/Time:           2024-06-06 04:19:03.2151 -1000
Launch Time:         2024-06-06 04:19:03.1735 -1000
OS Version:          iPhone OS 17.5.1 (21F90)
Release Type:        User
Baseband Version:    4.50.06
Report Version:      104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: SIGNAL 6 Abort trap: 6
Terminating Process: [redacted]Intent [30341]

Triggered by Thread:  3

Thread 0 name:
Thread 0:
0   libsystem_kernel.dylib          0x00000001e75c0808 mach_msg2_trap + 8 (:-1)
1   libsystem_kernel.dylib          0x00000001e75c4008 mach_msg2_internal + 80 (mach_msg.c:201)
2   libsystem_kernel.dylib          0x00000001e75c3f20 mach_msg_overwrite + 436 (mach_msg.c:0)
3   libsystem_kernel.dylib          0x00000001e75c3d60 mach_msg + 24 (mach_msg.c:323)
4   CoreFoundation                  0x000000019e4e0f5c __CFRunLoopServiceMachPort + 160 (CFRunLoop.c:2624)
5   CoreFoundation                  0x000000019e4e0600 __CFRunLoopRun + 1208 (CFRunLoop.c:3007)
6   CoreFoundation                  0x000000019e4dfcd8 CFRunLoopRunSpecific + 608 (CFRunLoop.c:3420)
7   Foundation                      0x000000019d400e4c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212 (NSRunLoop.m:373)
8   Foundation                      0x000000019d400d20 -[NSRunLoop(NSRunLoop) run] + 64 (NSRunLoop.m:398)
9   libxpc.dylib                    0x00000001fb3c31a4 _xpc_objc_main + 336 (main.m:267)
10  libxpc.dylib                    0x00000001fb3c571c _xpc_main + 64 (init.c:1294)
11  libxpc.dylib                    0x00000001fb3c58fc xpc_main + 64 (init.c:1377)
12  Foundation                      0x000000019d4ba40c -[NSXPCListener resume] + 312 (NSXPCListener.m:471)
13  PlugInKit                       0x00000001ca80de68 -[PKService runUsingServiceListener:] + 364 (PKService.m:219)
14  PlugInKit                       0x00000001ca80dcf4 -[PKService run] + 20 (PKService.m:185)
15  PlugInKit                       0x00000001ca80d9b0 +[PKService main] + 524 (PKService.m:126)
16  PlugInKit                       0x00000001ca80e1c4 +[PKService _defaultRun:arguments:] + 16 (PKService.m:265)
17  ExtensionFoundation             0x00000001ad541bf0 EXExtensionMain + 288 (EXExtensionMain.m:0)
18  Foundation                      0x000000019d54680c NSExtensionMain + 204 (NSExtensionMain.m:21)
19  dyld                            0x00000001c1b91e4c start + 2240 (dyldMain.cpp:1298)

Thread 1 name:
Thread 1:
0   libsystem_kernel.dylib          0x00000001e75c6d0c __ulock_wait + 8 (:-1)
1   libdispatch.dylib               0x00000001a63b67c4 _dlock_wait + 56 (lock.c:326)
2   libdispatch.dylib               0x00000001a63b6b90 _dispatch_group_wait_slow + 56 (semaphore.c:214)
3   [redacted]Intent            0x00000001016bd3d0 -[DDLog lt_log:] + 360 (DDLog.m:839)
4   [redacted]Intent            0x00000001016bbe54 __40-[DDLog queueLogMessage:asynchronously:]_block_invoke + 48 (DDLog.m:357)
5   libdispatch.dylib               0x00000001a63b413c _dispatch_call_block_and_release + 32 (init.c:1530)
6   libdispatch.dylib               0x00000001a63b5dd4 _dispatch_client_callout + 20 (object.m:576)
7   libdispatch.dylib               0x00000001a63bd400 _dispatch_lane_serial_drain + 748 (queue.c:3900)
8   libdispatch.dylib               0x00000001a63bdf30 _dispatch_lane_invoke + 380 (queue.c:3991)
9   libdispatch.dylib               0x00000001a63c8cb4 _dispatch_root_queue_drain_deferred_wlh + 288 (queue.c:6998)
10  libdispatch.dylib               0x00000001a63c8528 _dispatch_workloop_worker_thread + 404 (queue.c:6592)
11  libsystem_pthread.dylib         0x00000001fb367934 _pthread_wqthread + 288 (pthread.c:2696)
12  libsystem_pthread.dylib         0x00000001fb3640cc start_wqthread + 8 (:-1)

Thread 2:
0   libsystem_pthread.dylib         0x00000001fb3640c4 start_wqthread + 0 (:-1)

Thread 3 name:
Thread 3 Crashed:
0   libsystem_kernel.dylib          0x00000001e75cb42c __pthread_kill + 8 (:-1)
1   libsystem_pthread.dylib         0x00000001fb36ac0c pthread_kill + 268 (pthread.c:1721)
2   libsystem_c.dylib               0x00000001a646eba0 abort + 180 (abort.c:118)
3   [redacted]Intent            0x00000001019a2ed8 please_report_this_issue_in_github_realm_realm_core_v_13_25_1 + 12
4   [redacted]Intent            0x00000001019a320c realm::util::terminate_internal(std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char>>&) + 244
5   [redacted]Intent            0x00000001019a307c realm::util::terminate_with_info(char const*, char const*, long, char const*, std::initializer_list<realm::util::Printable>&&) + 400
6   [redacted]Intent            0x00000001019a2eec realm::util::terminate(char const*, char const*, long, std::initializer_list<realm::util::Printable>&&) + 20
7   [redacted]Intent            0x0000000101872bb4 realm::Group::validate_top_array(realm::Array const&, realm::SlabAlloc const&, std::__1::optional<unsigned long>, std::__1::optional<unsigned long long>) + 868
8   [redacted]Intent            0x00000001018576fc realm::DB::open(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, bool, realm::DBOptions const&) + 2376
9   [redacted]Intent            0x000000010185f9ec realm::DB::create(std::__1::unique_ptr<realm::Replication, std::__1::default_delete<realm::Replication>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&... + 164
10  [redacted]Intent            0x0000000101a80db8 realm::_impl::RealmCoordinator::open_db() + 1256
11  [redacted]Intent            0x0000000101a81ae0 realm::_impl::RealmCoordinator::do_get_realm(realm::RealmConfig&&, std::__1::shared_ptr<realm::Realm>&, std::__1::optional<realm::VersionID>, realm::util::CheckedUniqueLock&, bool) + 76
12  [redacted]Intent            0x0000000101a819c8 realm::_impl::RealmCoordinator::get_realm(realm::RealmConfig, std::__1::optional<realm::VersionID>) + 484
13  [redacted]Intent            0x0000000101aca568 realm::Realm::get_shared_realm(realm::RealmConfig) + 120
14  [redacted]Intent            0x00000001017e3148 +[RLMRealm realmWithConfiguration:confinedTo:error:] + 1000 (RLMRealm.mm:430)
15  [redacted]Intent            0x00000001017e2c0c +[RLMRealm realmWithConfiguration:error:] + 80 (RLMRealm.mm:387)
16  [redacted]Intent            0x000000010181643c +[RealmAccessHelper realmInstance] + 96 (RealmAccessHelper.m:57)
17  [redacted]Intent            0x0000000101817c64 -[RealmAccessHelper valueForIdentifier:] + 172 (RealmAccessHelper.m:258)
18  [redacted]Intent            0x0000000100ccf264 specialized static RealmAccessHelper.getPersistedData(key:) + 168 (RealmHelper.swift:103)
19  [redacted]Intent            0x0000000100cb1628 static RealmAccessHelper.getPersistedData(key:) + 32 (<compiler-generated>:0)
20  [redacted]Intent            0x0000000100cb1628 IntentHandler.getRedacted() + 84 (IntentHandler.swift:69)
21  [redacted]Intent            0x0000000100cb525c specialized IntentHandler.provideRedactedOptionsCollection(for:with:) + 40 (IntentHandler.swift:40)
22  [redacted]Intent            0x0000000100cb2610 @objc IntentHandler.provideRedactedOptionsCollection(for:with:) + 84
23  Intents                         0x00000001a83608e4 __92-[INIntentDeliverer getParameterOptionsForParameterNamed:intent:searchTerm:completionBlock:]_block_invoke + 280 (INIntentDeliverer.m:364)
24  Intents                         0x00000001a835fb84 __140-[INIntentDeliverer _invokeIntentHandlerMethodForIntent:intentHandler:parameterNamed:keyForSelectors:executionHandler:unimplementedHandler:]_block_invoke_2 + 84 (INIntentDeliverer.m:487)
25  CoreFoundation                  0x000000019e4b1b14 __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__ + 24 (NSArrayHelpers.m:10)
26  CoreFoundation                  0x000000019e550f9c -[__NSArrayI enumerateObjectsWithOptions:usingBlock:] + 268 (NSArrayI.m:98)
27  Intents                         0x00000001a835fa90 __140-[INIntentDeliverer _invokeIntentHandlerMethodForIntent:intentHandler:parameterNamed:keyForSelectors:executionHandler:unimplementedHandler:]_block_invoke + 380 (INIntentDeliverer.m:484)
28  Intents                         0x00000001a8224f80 -[_INExtensionContext intentDeliverer:deliverIntent:withBlock:] + 136 (_INExtensionContext.m:143)
29  Intents                         0x00000001a835d96c __46-[INIntentDeliverer _deliverIntent:withBlock:]_block_invoke + 52 (INIntentDeliverer.m:790)
30  libdispatch.dylib               0x00000001a63b413c _dispatch_call_block_and_release + 32 (init.c:1530)
31  libdispatch.dylib               0x00000001a63b5dd4 _dispatch_client_callout + 20 (object.m:576)
32  libdispatch.dylib               0x00000001a63bd400 _dispatch_lane_serial_drain + 748 (queue.c:3900)
33  libdispatch.dylib               0x00000001a63bdf30 _dispatch_lane_invoke + 380 (queue.c:3991)
34  libdispatch.dylib               0x00000001a63c8cb4 _dispatch_root_queue_drain_deferred_wlh + 288 (queue.c:6998)
35  libdispatch.dylib               0x00000001a63c8528 _dispatch_workloop_worker_thread + 404 (queue.c:6592)
36  libsystem_pthread.dylib         0x00000001fb367934 _pthread_wqthread + 288 (pthread.c:2696)
37  libsystem_pthread.dylib         0x00000001fb3640cc start_wqthread + 8 (:-1)

Thread 4 name:
Thread 4:
0   libsystem_malloc.dylib          0x00000001ae6a9b18 reallocf + 76 (malloc.c:2941)
1   libicucore.A.dylib              0x00000001a7d443c4 icu::CharString::ensureCapacity(int, int, UErrorCode&) + 108 (charstr.cpp:229)
2   libicucore.A.dylib              0x00000001a7d446f4 icu::CharString::append(char const*, int, UErrorCode&) + 240 (charstr.cpp:138)
3   libicucore.A.dylib              0x00000001a7edc0cc (anonymous namespace)::doGetPattern(UResourceBundle*, char const*, char const*, UErrorCode&, UErrorCode&) + 240 (number_utils.cpp:43)
4   libicucore.A.dylib              0x00000001a7edbf14 icu::number::impl::utils::getPatternForStyle(icu::Locale const&, char const*, icu::number::impl::CldrPatternStyle, UErrorCode&) + 320 (number_utils.cpp:101)
5   libicucore.A.dylib              0x00000001a7ec2838 icu::number::impl::NumberFormatterImpl::macrosToMicroGenerator(icu::number::impl::MacroProps const&, bool, UErrorCode&) + 1180 (number_formatimpl.cpp:264)
6   libicucore.A.dylib              0x00000001a7ec1fb4 icu::number::impl::NumberFormatterImpl::getPrefixSuffixStatic(icu::number::impl::MacroProps const&, icu::number::impl::Signum, icu::StandardPlural::Form, icu::FormattedStringBuilder&, UErrorCode&) + 136 (number_formatimpl.cpp:49)
7   libicucore.A.dylib              0x00000001a7ec1324 icu::number::LocalizedNumberFormatter::getAffixImpl(bool, bool, icu::UnicodeString&, UErrorCode&) const + 176 (number_fluent.cpp:692)
8   libicucore.A.dylib              0x00000001a7e66a6c icu::DecimalFormat::getPositiveSuffix(icu::UnicodeString&) const + 60 (decimfmt.cpp:935)
9   libicucore.A.dylib              0x00000001a7f35a98 icu::SimpleDateFormat::checkIntSuffix(icu::UnicodeString const&, int, int, signed char) const + 288 (smpdtfmt.cpp:4847)
10  libicucore.A.dylib              0x00000001a7f32d54 icu::SimpleDateFormat::subParse(icu::UnicodeString const&, int&, char16_t, int, signed char, signed char, signed char*, int&, icu::Calendar&, int, icu::MessageFormat*, UTimeZoneFormatTimeType*, int... + 1304 (smpdtfmt.cpp:3673)
11  libicucore.A.dylib              0x00000001a7f31f78 icu::SimpleDateFormat::parse(icu::UnicodeString const&, icu::Calendar&, icu::ParsePosition&) const + 1228 (smpdtfmt.cpp:2785)
12  libicucore.A.dylib              0x00000001a7f659a8 udat_parseCalendar + 228 (udat.cpp:420)
13  CoreFoundation                  0x000000019e5948cc CFDateFormatterGetAbsoluteTimeFromString + 528 (CFDateFormatter.c:1829)
14  CoreFoundation                  0x000000019e594668 CFDateFormatterCreateDateFromString + 136 (CFDateFormatter.c:1779)
15  Foundation                      0x000000019d3a9808 getObjectValue + 248 (NSDateFormatter.m:589)
16  Foundation                      0x000000019d43d330 -[NSDateFormatter getObjectValue:forString:errorDescription:] + 196 (NSDateFormatter.m:567)
17  Foundation                      0x000000019d43d1bc -[NSDateFormatter dateFromString:] + 56 (NSDateFormatter.m:625)
18  [redacted]Intent            0x00000001016b7638 __45-[DDLogFileManagerDefault sortedLogFileInfos]_block_invoke + 488 (DDFileLogger.m:419)
19  CoreFoundation                  0x000000019e4ed138 __CFSimpleMergeSort + 380 (CFSortFunctions.c:154)
20  CoreFoundation                  0x000000019e4ed0b4 __CFSimpleMergeSort + 248 (CFSortFunctions.c:152)
21  CoreFoundation                  0x000000019e4ed0d0 __CFSimpleMergeSort + 276 (CFSortFunctions.c:153)
22  CoreFoundation                  0x000000019e4ed0b4 __CFSimpleMergeSort + 248 (CFSortFunctions.c:152)
23  CoreFoundation                  0x000000019e4ece64 CFSortIndexes + 260 (CFSortFunctions.c:320)
24  CoreFoundation                  0x000000019e51f5b0 -[NSArray sortedArrayFromRange:options:usingComparator:] + 732 (NSArray.m:632)
25  CoreFoundation                  0x000000019e51f1a8 -[NSMutableArray sortedArrayFromRange:options:usingComparator:] + 60 (NSMutableArray.m:602)
26  [redacted]Intent            0x00000001016b7428 -[DDLogFileManagerDefault sortedLogFileInfos] + 92 (DDFileLogger.m:395)
27  [redacted]Intent            0x00000001016b9224 -[DDFileLogger lt_currentLogFileInfo] + 76 (DDFileLogger.m:1040)
28  [redacted]Intent            0x00000001016b9640 -[DDFileLogger lt_currentLogFileHandle] + 44 (DDFileLogger.m:1145)
29  [redacted]Intent            0x00000001016b9c94 -[DDFileLogger(Internal) lt_logData:] + 164 (DDFileLogger.m:1297)
30  [redacted]Intent            0x00000001016b96fc -[DDFileLogger logMessage:] + 52 (DDFileLogger.m:1172)
31  [redacted]Intent            0x00000001016bd540 __16-[DDLog lt_log:]_block_invoke + 36 (DDLog.m:835)
32  libdispatch.dylib               0x00000001a63b413c _dispatch_call_block_and_release + 32 (init.c:1530)
33  libdispatch.dylib               0x00000001a63b5dd4 _dispatch_client_callout + 20 (object.m:576)
34  libdispatch.dylib               0x00000001a63bd4d0 _dispatch_lane_serial_drain + 956 (queue.c:3900)
35  libdispatch.dylib               0x00000001a63bdf30 _dispatch_lane_invoke + 380 (queue.c:3991)
36  libdispatch.dylib               0x00000001a63c8cb4 _dispatch_root_queue_drain_deferred_wlh + 288 (queue.c:6998)
37  libdispatch.dylib               0x00000001a63c8528 _dispatch_workloop_worker_thread + 404 (queue.c:6592)
38  libsystem_pthread.dylib         0x00000001fb367934 _pthread_wqthread + 288 (pthread.c:2696)
39  libsystem_pthread.dylib         0x00000001fb3640cc start_wqthread + 8 (:-1)

Thread 5:
0   libsystem_pthread.dylib         0x00000001fb3640c4 start_wqthread + 0 (:-1)

Thread 3 crashed with ARM Thread State (64-bit):
    x0: 0x0000000000000000   x1: 0x0000000000000000   x2: 0x0000000000000000   x3: 0x0000000000000000
    x4: 0x0000000000000000   x5: 0x0000000000000000   x6: 0x0000000000000000   x7: 0x0000000000000000
    x8: 0x2bce52d42aaa8ea0   x9: 0x2bce52d545853ea0  x10: 0x0000000000000073  x11: 0x0000000001ffffff
   x12: 0x0000000000000000  x13: 0x0000000000000000  x14: 0x0000000000000083  x15: 0x0000000000000083
   x16: 0x0000000000000148  x17: 0x000000016f2fb000  x18: 0x0000000000000000  x19: 0x0000000000000006
   x20: 0x0000000000003503  x21: 0x000000016f2fb0e0  x22: 0x0000000000000000  x23: 0x000000016f2f90f8
   x24: 0x0000000101bad11d  x25: 0x000000016f2f90f8  x26: 0x0000000101babf77  x27: 0x0000000101ea3c68
   x28: 0x0000000101e9e240   fp: 0x000000016f2f9030   lr: 0x00000001fb36ac0c
    sp: 0x000000016f2f9010   pc: 0x00000001e75cb42c cpsr: 0x40001000
   esr: 0x56000080  Address size fault

Binary Images:
        0x100ca4000 -         0x101e07fff [redacted]Intent arm64  <c0aaa1d3247836aaa44c2ba28520129d> /private/var/containers/Bundle/Application/609A3D90-35F9-407C-B12F-ACB2A92FBED7/[redacted].app/PlugIns/[redacted]Intent.appex/[redacted]Intent
        0x1024a4000 -         0x1024affff libobjc-trampolines.dylib arm64e  <2e2c05f8377a30899ad91926d284dd03> /private/preboot/Cryptexes/OS/usr/lib/libobjc-trampolines.dylib
        0x19d339000 -         0x19deaefff Foundation arm64e  <3d3a12e3f5e9361fb00a4a5e8861aa55> /System/Library/Frameworks/Foundation.framework/Foundation
        0x19e48d000 -         0x19e9bafff CoreFoundation arm64e  <00e76a98210c3cb5930bf236807ff24c> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
        0x1a63b2000 -         0x1a63f8fff libdispatch.dylib arm64e  <81d355df266a3010bab8113b76a206c1> /usr/lib/system/libdispatch.dylib
        0x1a63f9000 -         0x1a6476ff3 libsystem_c.dylib arm64e  <b122f07fa15637f3a22d64627c0c4b24> /usr/lib/system/libsystem_c.dylib
        0x1a7d3b000 -         0x1a7ffbffb libicucore.A.dylib arm64e  <0272a43c26a13016b69fe9c76349f9a5> /usr/lib/libicucore.A.dylib
        0x1a8085000 -         0x1a862dfff Intents arm64e  <b1c39d522541369a946b61d23d70ac00> /System/Library/Frameworks/Intents.framework/Intents
        0x1ad537000 -         0x1ad5f5fff ExtensionFoundation arm64e  <930d774071bf33eaaa0ea20b793720d3> /System/Library/Frameworks/ExtensionFoundation.framework/ExtensionFoundation
        0x1ae6a3000 -         0x1ae6d8fff libsystem_malloc.dylib arm64e  <770b91e3056b3e7eb731234fe649d088> /usr/lib/system/libsystem_malloc.dylib
        0x1c1b55000 -         0x1c1be1ef7 dyld arm64e  <71846eacee653697bf7d790b6a07dcdb> /usr/lib/dyld
        0x1ca7f4000 -         0x1ca82dfff PlugInKit arm64e  <8132a6a776ae3801ba7b7c76b30d33dd> /System/Library/PrivateFrameworks/PlugInKit.framework/PlugInKit
        0x1e75bf000 -         0x1e75f8fef libsystem_kernel.dylib arm64e  <13b5134e819c3baab3004856112114cb> /usr/lib/system/libsystem_kernel.dylib
        0x1fb363000 -         0x1fb36fff3 libsystem_pthread.dylib arm64e  <1196b6c3333d3450818ff3663484b8eb> /usr/lib/system/libsystem_pthread.dylib
        0x1fb3a7000 -         0x1fb3effff libxpc.dylib arm64e  <3614a74feda238438092cedb505020f0> /usr/lib/system/libxpc.dylib

EOF

Steps & Code to Reproduce

We share the same Realm database between our main app target and a widget extension.

This crash occurs sporadically when trying to read from Realm in the widget extension after closing the app.

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

➤ PM Bot commented:

Jira ticket: RCORE-2177