Description:
When initializing OneSignal soon after a fresh installation of our app and requesting permissions, our iOS users are getting the following crash:
BACKGROUND THREAD 19 - CRASHED
libobjc.A.dylib objc_msgSend
OurAppName -[OSOutcomeEventsFactory checkVersionChanged]
OurAppName -[OSOutcomeEventsFactory repository]
OurAppName -[OneSignalOutcomeEventsController saveUnattributedUniqueOutcomeEvents]
OurAppName +[OneSignal registerUserInternal]
libdispatch.dylib _dispatch_call_block_and_release
libdispatch.dylib _dispatch_client_callout
libdispatch.dylib _dispatch_lane_serial_drain$VARIANT$armv81
libdispatch.dylib _dispatch_lane_invoke$VARIANT$armv81
libdispatch.dylib _dispatch_workloop_worker_thread
libsystem_pthread.dylib _pthread_wqthread
libsystem_pthread.dylib start_wqthread
After reopening the app again, everything behaves as normal (initialization, notifications, etc.). The initial crash is affecting our users' experience though.
Environment
react-native 0.62.2
react-native-onesignal 3.9.0
OneSignal iOS SDK 2.14.3
Steps to Reproduce Issue:
OneSignal.init{"OUR_ONESIGNAL_APP_ID");
OneSignal.addEventListener("received", onReceived);
OneSignal.addEventListener("opened", onOpened);
OneSignal.addEventListener("ids", onIds);
OneSignal.inFocusDisplaying(0);
I should also mention that it only happens sometimes (reproducible perhaps 1 out of every 5 fresh installs on the same device).
Howdy,
Thanks for your patience.
You shouldn't need to request for permissions yourself as OneSignal will handle this automatically for you. I would recommend reproducing the issue first in a dev environment and then remove the permission prompt with the other react-native-permission package.
Cheers
We are encountering the exact same issue:
OS Version: iOS 13.6 (17G68)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: BUS_NOOP at 0x00000000000007fb
Crashed Thread: 23
Application Specific Information:
isOutcomesV2ServiceEnabled > registerUserInternal >
Attempted to dereference garbage pointer 0x7fb.
Thread 23 Crashed:
0 libobjc.A.dylib 0x30561eb28 objc_msgSend
1 XGAlarm 0x203a0d1fc -[OSOutcomeEventsFactory checkVersionChanged]
2 XGAlarm 0x203a0d174 -[OSOutcomeEventsFactory repository]
3 XGAlarm 0x203a1a788 -[OneSignalOutcomeEventsController saveUnattributedUniqueOutcomeEvents]
4 XGAlarm 0x2039f8694 +[OneSignal registerUserInternal]
5 libdispatch.dylib 0x306b189a8 <redacted>
6 libdispatch.dylib 0x306b19524 <redacted>
7 libdispatch.dylib 0x306ac58a4 <redacted>
8 libdispatch.dylib 0x306ac6294 <redacted>
9 libdispatch.dylib 0x306acf78c <redacted>
10 libsystem_pthread.dylib 0x305fc9b74 _pthread_wqthread
We also use react-native-permissions to handle the notification permission. The flow offered by RNPermissions is amazing and uniform with all the other permission flows we use. We do not want to use another way to integrate our permission flow.
I would argue this is definitely an issue with OneSignal. OneSignal should not obligate us to do 'everything' for us when it's not a sensible way of implementing it for all use cases.
This definitely did not happen before, however I see that the last commit on this file was in May and thus it's weird that this occuring now.
@sunweiyang did you manage to solve this? maybe by downgrading or something?
@jdegger Unfortunately, nothing we've tried on the latest react-native-onesignal has completely eliminated this issue. We haven't tried downgrading; perhaps we'll try that.
@sunweiyang Thanks for getting back to me. We will experiment with downgrading too.
Before our recent app update we came from 3.6.5 and that version seems stable at least. Everything in between (which is a lot!) I'm not sure if it will work correctly. If there was nothing added from 3.6.5 to 3.9.0 you might wanna test this version.
If you are able to narrow it down even more, let me know 👍
@rgomezp I wonder if the issue resolved by the latest OneSignal iOS SDK (2.15.3) has something to do with this?
https://github.com/OneSignal/OneSignal-iOS-SDK/releases/tag/2.15.3
The crash is definitely happening at around the time of OneSignal instantiation and permissions checks using react-native-permissions.
The latest react-native-onesignal (3.9.1) uses 2.15.2, which doesn't have this fix.
@jdegger I'm going to manually update 3.9.1's podspec to use 2.15.3 to see if it prevents the crash; I'll report back soon.
@sunweiyang ,
Good catch making that connection. It certainly seems like it could be related. Looking forward to your findings. Thanks for your help!
It appears that the latest OneSignal iOS SDK (2.15.3) does significantly reduce the instances of [OSOutcomeEventsFactory checkVersionChanged] crashes, but not totally eliminating them (used to be 100%, now down to single digit percentages). Not perfect, but definitely improved!
@rgomezp Are there other possible registration race conditions that could be happening?
➤ Rodrigo Gomez-Palacio commented:
@emawby please check for possible registration race condition
@sunweiyang I am not able to reproduce this using the react-native-permissions library. Was this happening for all iOS versions or only specific ones? (I am testing on an iOS 14 beta device)
Can you try testing against the react-native-onesignal major release?
Closing due to no response
I'm also seeing this issue on v3.9.2