[Bug]: OneSignalUserDefaults Crash Take II
What happened?
The crash I reported in #1365 is still present in the 5.1.6 release. I’m reporting it again here because the previous issue was closed.
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.6
iOS version
17
Specific iOS version
No response
Relevant log output
Crashed: OneSignal.OSPropertyOperationExecutor
EXC_BREAKPOINT 0x00000001a3578168
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 OneSignalUser 0xf1f4 block_destroy_helper + 6436
8 OneSignalUser 0xf3ac block_destroy_helper + 6876
9 Foundation 0x2173c _encodeObject + 1180
10 Foundation 0x210dc -[NSKeyedArchiver _encodeArrayOfObjects:forKey:] + 460
11 Foundation 0x4ffc0 -[NSArray(NSArray) encodeWithCoder:] + 588
12 Foundation 0x2173c _encodeObject + 1180
13 Foundation 0x6f12a0 +[NSKeyedArchiver archivedDataWithRootObject:] + 104
14 OneSignalCore 0xd69c -[OneSignalUserDefaults saveCodeableDataForKey:withValue:] + 88
15 OneSignalUser 0x1f75c block_destroy_helper.32 + 27880
16 OneSignalUser 0x1e0bc block_destroy_helper.32 + 22088
17 libdispatch.dylib 0x213c _dispatch_call_block_and_release + 32
18 libdispatch.dylib 0x3dd4 _dispatch_client_callout + 20
19 libdispatch.dylib 0xb400 _dispatch_lane_serial_drain + 748
20 libdispatch.dylib 0xbf30 _dispatch_lane_invoke + 380
21 libdispatch.dylib 0x16cb4 _dispatch_root_queue_drain_deferred_wlh + 288
22 libdispatch.dylib 0x16528 _dispatch_workloop_worker_thread + 404
23 libsystem_pthread.dylib 0x1f20 _pthread_wqthread + 288
24 libsystem_pthread.dylib 0x1fc0 start_wqthread + 8
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Hi @danhalliday I followed up on your other stacktrace reports.
I am not sure how these crashes could be happening, so I am still investigating.
Any additional information you can share will be helpful:
- Do you have updated data on frequency of these crash reports?
- Do you have data if the app is in the background or foreground?
- Do you have information about the memory usage or state of the memory at time of the crash? One possibility I am considering is the app being out of memory at the time we are saving information. Particularly if you know that there is high memory usage in the app already.
I’m afraid my team has decided to drop OneSignal on the basis of these crashes, so I can’t devote any more time to investigating. But briefly:
- It’s about the same still, being roughly 1% of both users and sessions.
- It’s all foreground.
- I don’t have good data on that, all I have is the Crashlytics reports. I couldn’t discount something like that. But in general this app is not using a lot of memory.
Hi there @nan-li,
We are getting similar crashes in our production version of the app. Here is some data from Crashlytics:
The main line of the crash is
OneSignalCore -[OneSignalUserDefaults saveDoubleForKey:withValue:] + 72
Crashed: com.apple.main-thread
EXC_BAD_ACCESS KERN_PROTECTION_FAILURE 0x000000016d90fff8
Crashed: com.apple.main-thread
0 libsystem_pthread.dylib 0x14c0 ___chkstk_darwin + 60
1 libsystem_pthread.dylib 0x14c0 thread_chkstk_darwin + 60
2 Foundation 0x47cd8 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKeys:count:maybeOldValuesDict:maybeNewValuesDict:usingBlock:] + 212
3 Foundation 0x1416d0 -[NSObject(NSKeyValueObservingPrivate) _notifyObserversOfChangeFromValuesForKeys:toValuesForKeys:] + 652
4 CoreFoundation 0xce2e0 -[CFPrefsSource forEachObserver:] + 320
5 CoreFoundation 0x548a4 -[CFPrefsSource _notifyObserversOfChangeFromValuesForKeys:toValuesForKeys:] + 112
6 CoreFoundation 0x54788 ___CFPrefsDeliverPendingKVONotificationsGuts_block_invoke + 432
7 CoreFoundation 0x52988 __CFDictionaryApplyFunction_block_invoke + 28
8 CoreFoundation 0x52524 CFBasicHashApply + 148
9 CoreFoundation 0x21040 CFDictionaryApplyFunction + 224
10 CoreFoundation 0x7a6b0 _CFPrefsDeliverPendingKVONotificationsGuts + 300
11 CoreFoundation 0x777d0 -[_CFXPreferences _deliverPendingKVONotifications] + 96
12 CoreFoundation 0x776ac __108-[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:cloudConfigurationURL:perform:]_block_invoke + 420
13 CoreFoundation 0x5cf24 normalizeQuintuplet + 412
14 CoreFoundation 0x5cd60 -[_CFXPreferences withSearchListForIdentifier:container:cloudConfigurationURL:perform:] + 164
15 CoreFoundation 0xd0768 -[_CFXPreferences setValue:forKey:appIdentifier:container:configurationURL:] + 124
16 CoreFoundation 0xd06a8 _CFPreferencesSetAppValueWithContainerAndConfiguration + 120
17 Foundation 0xf0a4c -[NSUserDefaults(NSUserDefaults) setObject:forKey:] + 68
18 OneSignalCore 0xcd2c -[OneSignalUserDefaults saveDoubleForKey:withValue:] + 72
19 OneSignalFramework 0xcc60 +[OneSignalTracker updateLastClosedTime] + 96
20 OneSignalFramework 0xc6fc +[OneSignalTracker applicationBackgrounded] + 56
21 CoreFoundation 0x4e488 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 148
22 CoreFoundation 0x4e3a4 ___CFXRegistrationPost_block_invoke + 88
23 CoreFoundation 0x4cf18 _CFXRegistrationPost + 436
24 CoreFoundation 0x4c01c _CFXNotificationPost + 728
25 Foundation 0x9fa9c -[NSNotificationCenter postNotificationName:object:userInfo:] + 92
26 UIKitCore 0x8ff608 -[_UISceneLifecycleMonitor willResignActive] + 240
27 UIKitCore 0x2526e0 __111-[_UIWindowSceneFBSSceneLifecycleMonitor transitionToTargetState:fromState:withTransitionContext:preparations:]_block_invoke_5 + 332
28 UIKitCore 0x24f5e4 _UIScenePerformActionsWithLifecycleActionMask + 112
29 UIKitCore 0x1b61d8 __111-[_UIWindowSceneFBSSceneLifecycleMonitor transitionToTargetState:fromState:withTransitionContext:preparations:]_block_invoke_4 + 156
30 UIKitCore 0x1b60fc ___UISceneLifecycleSettingsUpdateBlockWithCanvasAndTransitionContext_block_invoke_2 + 296
31 UIKitCore 0x1b5e9c -[_UIWindowSceneFBSSceneLifecycleMonitor transitionToTargetState:fromState:withTransitionContext:preparations:] + 680
32 UIKitCore 0x1b5188 ___UISceneLifecycleSettingsUpdateBlockWithCanvasAndTransitionContext_block_invoke + 308
33 UIKitCore 0x1b4fec __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke + 116
34 UIKitCore 0x1b41b4 +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:fromCurrentState:actions:completion:] + 736
35 UIKitCore 0x1b37ec _UISceneSettingsDiffActionPerformChangesWithTransitionContextAndCompletion + 224
36 UIKitCore 0x1b349c -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 316
37 UIKitCore 0x24f394 __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke.229 + 612
38 UIKitCore 0x24ece4 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 208
39 UIKitCore 0x246708 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 244
40 UIKitCore 0x245ee8 -[UIApplicationSceneClientAgent scene:handleEvent:withCompletion:] + 336
41 FrontBoardServices 0xc290 __76-[FBSScene updater:didUpdateSettings:withDiff:transitionContext:completion:]_block_invoke.146 + 244
42 FrontBoardServices 0x9834 -[FBSScene _callOutQueue_coalesceClientSettingsUpdates:] + 68
43 FrontBoardServices 0x7090 -[FBSScene updater:didUpdateSettings:withDiff:transitionContext:completion:] + 796
44 FrontBoardServices 0x1f868 __94-[FBSWorkspaceScenesClient _queue_updateScene:withSettings:diff:transitionContext:completion:]_block_invoke_2 + 148
45 FrontBoardServices 0x1f4c8 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 168
46 FrontBoardServices 0xa510 __94-[FBSWorkspaceScenesClient _queue_updateScene:withSettings:diff:transitionContext:completion:]_block_invoke + 340
47 libdispatch.dylib 0x3fa8 _dispatch_client_callout + 20
48 libdispatch.dylib 0x79f0 _dispatch_block_invoke_direct + 284
49 FrontBoardServices 0x18378 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 52
50 FrontBoardServices 0x182f8 -[FBSMainRunLoopSerialQueue _targetQueue_performNextIfPossible] + 240
51 FrontBoardServices 0x181d0 -[FBSMainRunLoopSerialQueue _performNextFromRunLoopSource] + 28
52 CoreFoundation 0x73f4c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
53 CoreFoundation 0x73ee0 __CFRunLoopDoSource0 + 176
54 CoreFoundation 0x76b40 __CFRunLoopDoSources0 + 244
55 CoreFoundation 0x75d3c __CFRunLoopRun + 840
56 CoreFoundation 0xc8284 CFRunLoopRunSpecific + 588
57 GraphicsServices 0x14c0 GSEventRunModal + 164
58 UIKitCore 0x3ee674 -[UIApplication _run] + 816
59 UIKitCore 0x14e88 UIApplicationMain + 340
60 SwiftUI 0x291ef8 closure #1 in KitRendererCommon(_:) + 168
61 SwiftUI 0x291e28 runApp<A>(_:) + 100
62 SwiftUI 0x291d0c static App.main() + 180
63 [Redacted App Name] 0x6a2480 main + 4317635712 (AlmaApp.swift:4317635712)
64 ??? 0x1aa64dde8 (Missing)
Also getting this