Appboy / appboy-ios-sdk

Public repo for the Braze iOS SDK
https://www.braze.com
Other
165 stars 142 forks source link

ABKPersistentData.m line 348 - SDK VERSION 3.24.1 #240

Closed jesusmateos1234 closed 2 years ago

jesusmateos1234 commented 4 years ago

Crashed: NSOperationQueue 0x10443ca80 (QOS: UNSPECIFIED) EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x00000004d8392b40

-[ABKPersistentData synchronizeDataToUserDefaults:]

Crashed: NSOperationQueue 0x10443ca80 (QOS: UNSPECIFIED)
0  libobjc.A.dylib                0x18a007d90 objc_release + 16
1  Foundation                     0x18a692fd0 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKeys:count:maybeOldValuesDict:maybeNewValuesDict:usingBlock:] + 668
2  Foundation                     0x18a5dd7f8 -[NSObject(NSKeyValueObservingPrivate) _notifyObserversOfChangeFromValuesForKeys:toValuesForKeys:] + 816
3  CoreFoundation                 0x18a1b9bb0 -[CFPrefsSource forEachObserver:] + 324
4  CoreFoundation                 0x18a1bb610 -[CFPrefsSource _notifyObserversOfChangeFromValuesForKeys:toValuesForKeys:] + 108
5  CoreFoundation                 0x18a3139a0 ___CFPrefsDeliverPendingKVONotificationsGuts_block_invoke + 484
6  CoreFoundation                 0x18a21b9f0 __CFDictionaryApplyFunction_block_invoke + 28
7  CoreFoundation                 0x18a2fa520 CFBasicHashApply + 140
8  CoreFoundation                 0x18a21b98c CFDictionaryApplyFunction + 204
9  CoreFoundation                 0x18a30f8a8 _CFPrefsDeliverPendingKVONotificationsGuts + 272
10 CoreFoundation                 0x18a30f778 -[_CFXPreferences _deliverPendingKVONotifications] + 92
11 CoreFoundation                 0x18a23e3e0 __108-[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:cloudConfigurationURL:perform:]_block_invoke + 436
12 CoreFoundation                 0x18a23dc04 normalizeQuintuplet + 356
13 CoreFoundation                 0x18a1aa83c -[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:cloudConfigurationURL:perform:] + 136
14 CoreFoundation                 0x18a1ad9d4 -[_CFXPreferences setValue:forKey:appIdentifier:container:configurationURL:] + 124
15 CoreFoundation                 0x18a311cc8 _CFPreferencesSetAppValueWithContainerAndConfiguration + 136
16 Foundation                     0x18a5d8118 -[NSUserDefaults(NSUserDefaults) setObject:forKey:] + 68
17 Application                      0x1020ad62c -[ABKPersistentData synchronizeDataToUserDefaults:] + 348 (ABKPersistentData.m:348)
18 CoreFoundation                 0x18a2def14 __invoking___ + 148
19 CoreFoundation                 0x18a1a8098 -[NSInvocation invoke] + 400
20 Foundation                     0x18a5f929c -[NSInvocationOperation main] + 48
21 Foundation                     0x18a6ae03c __NSOPERATION_IS_INVOKING_MAIN__ + 24
22 Foundation                     0x18a5ad914 -[NSOperation start] + 752
23 Foundation                     0x18a6aea68 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 24
24 Foundation                     0x18a6ae528 __NSOQSchedule_f + 184
25 libdispatch.dylib              0x189f84db4 _dispatch_block_async_invoke2 + 144
26 libdispatch.dylib              0x189f7833c _dispatch_client_callout + 20
27 libdispatch.dylib              0x189f7aaf8 _dispatch_continuation_pop + 408
28 libdispatch.dylib              0x189f7a258 _dispatch_async_redirect_invoke + 588
29 libdispatch.dylib              0x189f875c0 _dispatch_root_queue_drain + 348
30 libdispatch.dylib              0x189f87d9c _dispatch_worker_thread2 + 116
31 libsystem_pthread.dylib        0x189fdf6d8 _pthread_wqthread + 216
32 libsystem_pthread.dylib        0x189fe59c8 start_wqthread + 8

Crash on 13.5.1 iPhone XS

Bucimis commented 4 years ago

@jesusmateos1234 thanks for bringing to our attention. Can you provide steps to repro the crash?

jesusmateos1234 commented 4 years ago

No, I don't have them. Seems like it's happen when configuration it's finish done

On Thu, Jul 9, 2020 at 9:20 PM Jared Poelman notifications@github.com wrote:

@jesusmateos1234 https://github.com/jesusmateos1234 thanks for bringing to our attention. Can you provide steps to repro the crash?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Appboy/appboy-ios-sdk/issues/240#issuecomment-656305854, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQHLKDSKNCCVKLDUS7QSAEDR2YKBHANCNFSM4OVXOCRQ .

vlad-litvinenko commented 4 years ago

Hey guys, it's same for us. Also, no particular steps.

Crashed: NSOperationQueue 0x153f1b820 (QOS: UNSPECIFIED) EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000aa85bd600 -[ABKPersistentData synchronizeDataToUserDefaults:]

Crashed: NSOperationQueue 0x153f1b820 (QOS: UNSPECIFIED) 0 libobjc.A.dylib 0x1a7743d90 objc_release + 16 1 Foundation 0x1a7dcefd0 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKeys:count:maybeOldValuesDict:maybeNewValuesDict:usingBlock:] + 668 2 Foundation 0x1a7d197f8 -[NSObject(NSKeyValueObservingPrivate) _notifyObserversOfChangeFromValuesForKeys:toValuesForKeys:] + 816 3 CoreFoundation 0x1a78f5bb0 -[CFPrefsSource forEachObserver:] + 324 4 CoreFoundation 0x1a78f7610 -[CFPrefsSource _notifyObserversOfChangeFromValuesForKeys:toValuesForKeys:] + 108 5 CoreFoundation 0x1a7a4f9a0 _CFPrefsDeliverPendingKVONotificationsGuts_block_invoke + 484 6 CoreFoundation 0x1a79579f0 __CFDictionaryApplyFunction_block_invoke + 28 7 CoreFoundation 0x1a7a36520 CFBasicHashApply + 140 8 CoreFoundation 0x1a795798c CFDictionaryApplyFunction + 204 9 CoreFoundation 0x1a7a4b8a8 _CFPrefsDeliverPendingKVONotificationsGuts + 272 10 CoreFoundation 0x1a7a4b778 -[_CFXPreferences _deliverPendingKVONotifications] + 92 11 CoreFoundation 0x1a797a3e0 108-[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:cloudConfigurationURL:perform:]_block_invoke + 436 12 CoreFoundation 0x1a7979c04 normalizeQuintuplet + 356 13 CoreFoundation 0x1a78e683c -[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:cloudConfigurationURL:perform:] + 136 14 CoreFoundation 0x1a78e99d4 -[_CFXPreferences setValue:forKey:appIdentifier:container:configurationURL:] + 124 15 CoreFoundation 0x1a7a4dcc8 _CFPreferencesSetAppValueWithContainerAndConfiguration + 136 16 Foundation 0x1a7d14118 -[NSUserDefaults(NSUserDefaults) setObject:forKey:] + 68 17 Appboy_iOSSDK 0x101d27640 -[ABKPersistentData synchronizeDataToUserDefaults:] + 348 (ABKPersistentData.m:348) 18 CoreFoundation 0x1a7a1af14 invoking + 148 19 CoreFoundation 0x1a78e4098 -[NSInvocation invoke] + 400 20 Foundation 0x1a7d3529c -[NSInvocationOperation main] + 48 21 Foundation 0x1a7dea03c __NSOPERATION_IS_INVOKING_MAIN + 24 22 Foundation 0x1a7ce9914 -[NSOperation start] + 752 23 Foundation 0x1a7deaa68 NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION + 24 24 Foundation 0x1a7dea528 NSOQSchedule_f + 184 25 libdispatch.dylib 0x1a76c0db4 _dispatch_block_async_invoke2 + 144 26 libdispatch.dylib 0x1a76b433c _dispatch_client_callout + 20 27 libdispatch.dylib 0x1a76b6af8 _dispatch_continuation_pop + 408 28 libdispatch.dylib 0x1a76b6258 _dispatch_async_redirect_invoke + 588 29 libdispatch.dylib 0x1a76c35c0 _dispatch_root_queue_drain + 348 30 libdispatch.dylib 0x1a76c3d9c _dispatch_worker_thread2 + 116 31 libsystem_pthread.dylib 0x1a771b6d8 _pthread_wqthread + 216 32 libsystem_pthread.dylib 0x1a77219c8 start_wqthread + 8

romanfurman6 commented 3 years ago

Same here ^

hokstuff commented 3 years ago

Thank you for reporting this issue. Please email support@braze.com with any further context / repro steps to help us with the investigation.

salling commented 2 years ago

This has started popping up more and more in our apps that use the Braze SDK. Looks like a data race in most of the crashers I have here:

Braze thread:

Thread 14 Crashed:
0   libobjc.A.dylib                      0x000000019c2f1430 objc_release + 16
1   Foundation                           0x0000000186826fa4 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKeys:count:maybeOldValuesDict:maybeNewValuesDict:usingBlock:] + 636
2   Foundation                           0x00000001868445b4 -[NSObject(NSKeyValueObservingPrivate) _notifyObserversOfChangeFromValuesForKeys:toValuesForKeys:] + 792
3   CoreFoundation                       0x0000000185119718 -[CFPrefsSource forEachObserver:] + 300
4   CoreFoundation                       0x00000001851accb4 -[CFPrefsSource _notifyObserversOfChangeFromValuesForKeys:toValuesForKeys:] + 80
5   CoreFoundation                       0x0000000185189a58 ___CFPrefsDeliverPendingKVONotificationsGuts_block_invoke + 352
6   CoreFoundation                       0x00000001850e7ac8 __CFDictionaryApplyFunction_block_invoke + 20
7   CoreFoundation                       0x00000001850e571c CFBasicHashApply + 132
8   CoreFoundation                       0x00000001850e72e4 CFDictionaryApplyFunction + 188
9   CoreFoundation                       0x0000000185175eb8 _CFPrefsDeliverPendingKVONotificationsGuts + 284
10  CoreFoundation                       0x00000001850e4940 -[_CFXPreferences _deliverPendingKVONotifications] + 88
11  CoreFoundation                       0x0000000185110994 __108-[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:cloudConfigurationURL:perform:]_block_invoke + 380
12  CoreFoundation                       0x00000001850ead18 normalizeQuintuplet + 344
13  CoreFoundation                       0x00000001850e4624 -[_CFXPreferences withSearchListForIdentifier:container:cloudConfigurationURL:perform:] + 120
14  CoreFoundation                       0x000000018518c8ec -[_CFXPreferences setValue:forKey:appIdentifier:container:configurationURL:] + 96
15  CoreFoundation                       0x0000000185115c30 _CFPreferencesSetAppValueWithContainerAndConfiguration + 128
16  Foundation                           0x00000001868358b0 -[NSUserDefaults(NSUserDefaults) setObject:forKey:] + 76
17  XXX                                  0x00000001004f7bbc -[ABKPersistentData synchronizeDataToUserDefaults:] (ABKPersistentData.m:365)
18  CoreFoundation                       0x00000001850de8d0 __invoking___ + 140
19  CoreFoundation                       0x00000001850fa5a8 -[NSInvocation invoke] + 296
20  Foundation                           0x0000000186963638 -[NSInvocationOperation main] + 40
21  Foundation                           0x000000018683623c __NSOPERATION_IS_INVOKING_MAIN__ + 16
22  Foundation                           0x000000018684631c -[NSOperation start] + 776
23  Foundation                           0x0000000186849714 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 16
24  Foundation                           0x0000000186856e4c __NSOQSchedule_f + 176
25  libdispatch.dylib                    0x0000000184dc8dc8 _dispatch_block_async_invoke2 + 100
26  libdispatch.dylib                    0x0000000184e1c198 _dispatch_client_callout + 12
27  libdispatch.dylib                    0x0000000184dbe550 _dispatch_continuation_pop$VARIANT$mp + 440
28  libdispatch.dylib                    0x0000000184dbdc58 _dispatch_async_redirect_invoke + 596
29  libdispatch.dylib                    0x0000000184dcb42c _dispatch_root_queue_drain + 336
30  libdispatch.dylib                    0x0000000184dcbc28 _dispatch_worker_thread2 + 168
31  libsystem_pthread.dylib              0x00000001de22de48 _pthread_wqthread + 220
32  libsystem_pthread.dylib              0x00000001de22d9f0 start_wqthread + 4

Main thread often deallocating something:

Thread 0:
0   libobjc.A.dylib                      0x000000019c2f7384 getMethodNoSuper_nolock(objc_class*, objc_selector*) + 128
1   libobjc.A.dylib                      0x000000019c2f4614 lookUpImpOrForward + 380
2   libobjc.A.dylib                      0x000000019c2f8eb4 class_getInstanceMethod + 56
3   Foundation                           0x000000018684b810 NSResolvedSelectorForName + 256
4   Foundation                           0x0000000186875d24 __84+[NSObject(NSKeyValueObservingCustomization) keyPathsForValuesAffectingValueForKey:]_block_invoke + 296
5   Foundation                           0x00000001868ca83c +[NSObject(NSKeyValueObservingCustomization) keyPathsForValuesAffectingValueForKey:] + 156
6   Foundation                           0x00000001868be494 -[NSKeyValueUnnestedProperty _givenPropertiesBeingInitialized:getAffectingProperties:] + 160
7   Foundation                           0x00000001868d9a1c -[NSKeyValueUnnestedProperty _initWithContainerClass:key:propertiesBeingInitialized:] + 124
8   Foundation                           0x000000018689e860 NSKeyValuePropertyForIsaAndKeyPathInner + 276
9   Foundation                           0x000000018682b888 NSKeyValuePropertyForIsaAndKeyPath + 152
10  Foundation                           0x000000018682665c -[NSObject(NSKeyValueObserverRegistration) addObserver:forKeyPath:options:context:] + 104
11  UIKitCore                            0x00000001878654ec __49-[_UIFeedbackPreferences _startObservingDefaults]_block_invoke + 80
12  UIKitCore                            0x0000000187559a28 -[_UIFeedbackPreferences _startObservingDefaults] + 296
13  UIKitCore                            0x00000001878df868 -[_UIFeedbackPreferences init] + 256
14  UIKitCore                            0x0000000187898904 __43+[_UIFeedbackPreferences sharedPreferences]_block_invoke + 12
15  libdispatch.dylib                    0x0000000184e1c198 _dispatch_client_callout + 12
16  libdispatch.dylib                    0x0000000184dbd464 _dispatch_once_callout + 24
17  UIKitCore                            0x00000001878e1974 +[_UIFeedbackPreferences sharedPreferences] + 108
18  UIKitCore                            0x00000001875d9010 -[_UIFeedbackGeneratorConfiguration dealloc] + 88
19  UIKitCore                            0x000000018762c768 -[UIFeedbackGenerator .cxx_destruct] + 36
20  libobjc.A.dylib                      0x000000019c2f5f10 object_cxxDestructFromClass(objc_object*, objc_class*) + 108
21  libobjc.A.dylib                      0x000000019c2f2f08 objc_destructInstance + 84
22  libobjc.A.dylib                      0x000000019c2fbdbc _objc_rootDealloc + 48
23  UIKitCore                            0x00000001876607bc -[UIFeedbackGenerator dealloc] + 256
24  UIKitCore                            0x0000000187660558 -[UIScrollView .cxx_destruct] + 540
25  libobjc.A.dylib                      0x000000019c2f5f10 object_cxxDestructFromClass(objc_object*, objc_class*) + 108
26  libobjc.A.dylib                      0x000000019c2f2f08 objc_destructInstance + 84
27  libobjc.A.dylib                      0x000000019c2fbdbc _objc_rootDealloc + 48
28  UIKitCore                            0x0000000187708998 -[UIResponder dealloc] + 148
29  UIKitCore                            0x0000000187607e50 -[UIView dealloc] + 932
30  UIKitCore                            0x000000018767f430 -[UIScrollView dealloc] + 848
31  WebKit                               0x0000000192b57428 -[WKWebView .cxx_destruct] + 356
32  libobjc.A.dylib                      0x000000019c2f5f10 object_cxxDestructFromClass(objc_object*, objc_class*) + 108
33  libobjc.A.dylib                      0x000000019c2f2f08 objc_destructInstance + 84
34  libobjc.A.dylib                      0x000000019c2fbdbc _objc_rootDealloc + 48
35  UIKitCore                            0x0000000187708998 -[UIResponder dealloc] + 148
36  UIKitCore                            0x0000000187607e50 -[UIView dealloc] + 932
37  WebKit                               0x0000000192b57048 -[WKWebView dealloc] + 364
38  XXXXXXKit                            0x00000001028bc7a8 @objc XXXXXXKit.WebContainerView.__ivar_destroyer (WebContainerView.swift:0)
39  libobjc.A.dylib                      0x000000019c2f5f10 object_cxxDestructFromClass(objc_object*, objc_class*) + 108
40  libobjc.A.dylib                      0x000000019c2f2f08 objc_destructInstance + 84
41  libobjc.A.dylib                      0x000000019c2fbdbc _objc_rootDealloc + 48
42  UIKitCore                            0x0000000187708998 -[UIResponder dealloc] + 148
43  UIKitCore                            0x0000000187607e50 -[UIView dealloc] + 932
44  XXXXXXKit                            0x00000001028bc254 XXXXXXKit.WebContainerView.__deallocating_deinit (WebContainerView.swift:62)
45  XXXXXXKit                            0x00000001028bc28c @objc XXXXXXKit.WebContainerView.__deallocating_deinit (<compiler-generated>:0)
46  CoreFoundation                       0x00000001850cb880 __RELEASE_OBJECTS_IN_THE_ARRAY__ + 108
47  CoreFoundation                       0x00000001850dec00 -[__NSArrayM dealloc] + 268
48  libobjc.A.dylib                      0x000000019c2f5588 AutoreleasePoolPage::releaseUntil(objc_object**) + 192
49  libobjc.A.dylib                      0x000000019c2f1df0 objc_autoreleasePoolPop + 200
50  CoreFoundation                       0x00000001850d0fcc _CFAutoreleasePoolPop + 24
51  CoreFoundation                       0x00000001850ca350 __CFRunLoopPerCalloutARPEnd + 40
52  CoreFoundation                       0x00000001850c912c __CFRunLoopRun + 2592
53  CoreFoundation                       0x00000001850dbd7c CFRunLoopRunSpecific + 568
54  GraphicsServices                     0x000000019f3509a0 GSEventRunModal + 156
55  UIKitCore                            0x000000018790e05c -[UIApplication _run] + 1076
56  UIKitCore                            0x00000001876a3ce0 UIApplicationMain + 2024
57  XXXXXXKit                            0x000000010235a374 XXXXXXKit.hermesMain(dependencies: @autoclosure () -> XXXXXXKit.HermesDependencies) -> () (AppDelegate.swift:387)
58  XXX                                  0x00000001003eeb84 main (main.swift:11)
59  ???                                  0x000000010096c190 0x0 + 0

I know this thread is old, but could it be that there's an issue in iOS 15 that is making the issue worse now?

Would it make sense for the BrazeSDK to make changes to NSUserDefaults on the main thread?

mkuliszkiewicz commented 2 years ago

@hokstuff 👋 Any ETA on the new Swift SDK?

hokstuff commented 2 years ago

Hey @mbanasiewicz,

Thanks for your interest in our Swift SDK! We currently don't have an exact timeline, but we are nearing our initial release and are aiming it to be during H1 of 2022. Please follow this issue to receive any updates around it - thank you!

hokstuff commented 2 years ago

Hi @mbanasiewicz @salling @romanfurman6 @vlad-litvinenko and @jesusmateos1234,

We have released our Swift SDK (Early Access) here, which addresses the root cause of this issue. You can look into the documentation for the new SDK here, examples here, and some guidelines around transitioning from ObjC to Swift here.

Please note there are a few features that will be coming soon to the Swift SDK (Objective-C support, tvOS support, Content Cards, News Feed) - thanks!