OneSignal / OneSignal-iOS-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your native iOS app with OneSignal. https://onesignal.com
Other
496 stars 263 forks source link

[Bug]: OneSignalCore NSKeyedArchiver Crash #1366

Open danhalliday opened 9 months ago

danhalliday commented 9 months ago

What happened?

iOS app crashed in production with a stack trace showing OneSignal frames.

Steps to reproduce?

No idea. This is a remote crash report from Crashlytics.

What did you expect to happen?

The library should not cause a crash, regardless of what I may be doing wrong in using it.

OneSignal iOS SDK version

5.1.0

iOS version

11 or below

Specific iOS version

* 17.2.1

Relevant log output

Fatal Exception: NSMallocException
0  CoreFoundation                 0xec69c __exceptionPreprocess
1  libobjc.A.dylib                0x2bc80 objc_exception_throw
2  CoreFoundation                 0x1b7b48 -[NSInvocation _initWithMethodSignature:frame:buffer:size:].cold.1
3  CoreFoundation                 0x1b2928 __CFReallocationFailed
4  CoreFoundation                 0x638fc __CFSafelyReallocate
5  Foundation                     0x7741c _NSMutableDataGrowBytes
6  Foundation                     0x77174 -[NSConcreteMutableData appendBytes:length:]
7  CoreFoundation                 0x80888 writeBytes
8  CoreFoundation                 0x134a0 bufferWrite
9  CoreFoundation                 0x11484 _appendObject
10 CoreFoundation                 0x10918 __CFBinaryPlistWriteOrPresize
11 Foundation                     0x3c658 -[NSKeyedArchiver finishEncoding]
12 Foundation                     0x6e7714 +[NSKeyedArchiver archivedDataWithRootObject:]
13 OneSignalCore                  0x112b4 (Missing UUID 80d4ca199f8333eca9b061f92253dfe1)
14 OneSignalUser                  0x1c264 (Missing UUID 3365bc1a2eb633349e656e7eebb91a77)
15 OneSignalUser                  0x33970 (Missing UUID 3365bc1a2eb633349e656e7eebb91a77)
16 OneSignalCore                  0xdcb4 (Missing UUID 80d4ca199f8333eca9b061f92253dfe1)
17 OneSignalCore                  0xc998 (Missing UUID 80d4ca199f8333eca9b061f92253dfe1)
18 CFNetwork                      0xf368 _CFNetworkSetHSTSStoragePath
19 CFNetwork                      0x2d218 CFHTTPMessageCopySerializedMessage
20 libdispatch.dylib              0x26a8 _dispatch_call_block_and_release
21 libdispatch.dylib              0x4300 _dispatch_client_callout
22 libdispatch.dylib              0xb894 _dispatch_lane_serial_drain
23 libdispatch.dylib              0xc3f8 _dispatch_lane_invoke
24 libdispatch.dylib              0x17004 _dispatch_root_queue_drain_deferred_wlh
25 libdispatch.dylib              0x16878 _dispatch_workloop_worker_thread
26 libsystem_pthread.dylib        0x1964 _pthread_wqthread
27 libsystem_pthread.dylib        0x1a04 start_wqthread

Code of Conduct

nan-li commented 9 months ago

Note to self: this stack trace is very obscured. But the stack trace looks similar to #1365

10 Foundation                     0x6e7714 +[NSKeyedArchiver archivedDataWithRootObject:] + 112
11 OneSignalCore                  0x112b4 -[OneSignalUserDefaults saveCodeableDataForKey:withValue:] + 88
12 OneSignalUser                  0x1c264 block_destroy_helper.32 + 23276
13 OneSignalUser                  0x33970 __swift_noop_void_return + 9644
14 OneSignalCore                  0xdcb4 -[OneSignalClient handleJSONNSURLResponse:data:error:isAsync:withRequest:onSuccess:onFailure:] + 848
15 OneSignalCore                  0xc998 __54-[OneSignalClient executeRequest:onSuccess:onFailure:]_block_invoke + 44
nan-li commented 6 months ago

Hi @danhalliday thanks again for reporting all of these crashes and stack traces. We made more crash fixes since version 5.1.3. Please update to Release 5.1.6 or later, and let us know if the crashes are resolved, or what crashes still remain.

danhalliday commented 6 months ago

@nan-li Thank you for your help. I am still waiting for my release containing 5.1.6 to roll to 100% of my user base so I’ll know more in a week or so. But right now I can say I’m still seeing at least one issue. I have two crashes reported from my new release, here are the traces.

iOS 17.4.1 / iPhone 14:

Crashed: OneSignal.OSPropertyOperationExecutor
0  CoreFoundation                 0x12168 __CFBasicHashRehash + 112
1  CoreFoundation                 0x11df8 __CFBasicHashAddValue + 100
2  CoreFoundation                 0x11d5c CFBasicHashAddValue + 420
3  CoreFoundation                 0x11b4c CFDictionaryAddValue + 208
4  CoreFoundation                 0x11078 _flattenPlist + 308
5  CoreFoundation                 0x11248 _flattenPlist + 772
6  CoreFoundation                 0x111e4 _flattenPlist + 672
7  CoreFoundation                 0x10c2c __CFBinaryPlistWriteOrPresize + 240
8  Foundation                     0x39230 -[NSKeyedArchiver finishEncoding] + 640
9  Foundation                     0x6f12a8 +[NSKeyedArchiver archivedDataWithRootObject:] + 112
10 OneSignalCore                  0xd69c -[OneSignalUserDefaults saveCodeableDataForKey:withValue:] + 88
11 OneSignalUser                  0x1f75c block_destroy_helper.32 + 27880
12 OneSignalUser                  0x1e0bc block_destroy_helper.32 + 22088
13 libdispatch.dylib              0x213c _dispatch_call_block_and_release + 32
14 libdispatch.dylib              0x3dd4 _dispatch_client_callout + 20
15 libdispatch.dylib              0xb400 _dispatch_lane_serial_drain + 748
16 libdispatch.dylib              0xbf30 _dispatch_lane_invoke + 380
17 libdispatch.dylib              0x16cb4 _dispatch_root_queue_drain_deferred_wlh + 288
18 libdispatch.dylib              0x16528 _dispatch_workloop_worker_thread + 404
19 libsystem_pthread.dylib        0x1f20 _pthread_wqthread + 288
20 libsystem_pthread.dylib        0x1fc0 start_wqthread + 8

iPadOS 17.4.1 / iPad Air (5th Generation):

Crashed: OneSignal.OSPropertyOperationExecutor
0  CoreFoundation                 0x12168 __CFBasicHashRehash + 112
1  CoreFoundation                 0x11df8 __CFBasicHashAddValue + 100
2  CoreFoundation                 0x30a0 CFDictionarySetValue + 208
3  Foundation                     0x21534 _encodeObject + 660
4  Foundation                     0x210dc -[NSKeyedArchiver _encodeArrayOfObjects:forKey:] + 460
5  Foundation                     0x200c4 -[NSDictionary(NSDictionary) encodeWithCoder:] + 572
6  Foundation                     0x2173c _encodeObject + 1180
7  Foundation                     0x210dc -[NSKeyedArchiver _encodeArrayOfObjects:forKey:] + 460
8  Foundation                     0x200c4 -[NSDictionary(NSDictionary) encodeWithCoder:] + 572
9  Foundation                     0x2173c _encodeObject + 1180
10 Foundation                     0x210dc -[NSKeyedArchiver _encodeArrayOfObjects:forKey:] + 460
11 Foundation                     0x200c4 -[NSDictionary(NSDictionary) encodeWithCoder:] + 572
12 Foundation                     0x2173c _encodeObject + 1180
13 OneSignalUser                  0xf1f4 block_destroy_helper + 6436
14 OneSignalUser                  0xf3ac block_destroy_helper + 6876
15 Foundation                     0x2173c _encodeObject + 1180
16 Foundation                     0x210dc -[NSKeyedArchiver _encodeArrayOfObjects:forKey:] + 460
17 Foundation                     0x4ffc0 -[NSArray(NSArray) encodeWithCoder:] + 588
18 Foundation                     0x2173c _encodeObject + 1180
19 Foundation                     0x6f12a0 +[NSKeyedArchiver archivedDataWithRootObject:] + 104
20 OneSignalCore                  0xd69c -[OneSignalUserDefaults saveCodeableDataForKey:withValue:] + 88
21 OneSignalUser                  0x1f75c block_destroy_helper.32 + 27880
22 OneSignalUser                  0x1e0bc block_destroy_helper.32 + 22088
23 libdispatch.dylib              0x213c _dispatch_call_block_and_release + 32
24 libdispatch.dylib              0x3dd4 _dispatch_client_callout + 20
25 libdispatch.dylib              0xb400 _dispatch_lane_serial_drain + 748
26 libdispatch.dylib              0xbf30 _dispatch_lane_invoke + 380
27 libdispatch.dylib              0x16cb4 _dispatch_root_queue_drain_deferred_wlh + 288
28 libdispatch.dylib              0x16528 _dispatch_workloop_worker_thread + 404
29 libsystem_pthread.dylib        0x1f20 _pthread_wqthread + 288
30 libsystem_pthread.dylib        0x1fc0 start_wqthread + 8