Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: App crashes after inAppMessage is dismissed #1546

Closed
2 of 3 tasks
prajanyasoft-madhusudan opened this issue Aug 30, 2023 · 5 comments
Closed
2 of 3 tasks

[Bug]: App crashes after inAppMessage is dismissed #1546

prajanyasoft-madhusudan opened this issue Aug 30, 2023 · 5 comments

Comments

@prajanyasoft-madhusudan
Copy link

prajanyasoft-madhusudan commented Aug 30, 2023

What happened?

What happened

I had a project which previously used the react-native-onesignal version 3.6.1.
I recently migrated the library to the latest version i.e. 5.0.0
Most of the workflow is working fine but I've encountered an issue in inAppMessage.

Steps to reproduce?

1. Install react-native-onesignal v5.0.0 on React Native 0.71.13
2. Launch the App
3. Trigger inAppMessage
4. Try to dismiss the message
5. The app will crash after the message is dismissed.

Note:
If we ignore the inAppMessage and it self dismissed, then the crash didn't happens.

What did you expect to happen?

The application should not crash when inAppMessage is dismissed.

React Native OneSignal SDK version

5.0.0

Which platform(s) are affected?

  • iOS
  • Android

Relevant log output

00:36:02.530  D  [DefaultDispatcher-worker-4] HttpClient: POST in_app_messages/56c9538a-5e91-436b-8b0d-0f8f33539186/click - {"app_id":"f817641c-cb95-4226-9596-c0276415eced","device_type":1,"player_id":"7b927f2b-8ffe-4073-9670-852e3d3920d4","click_id":"5385c0c8-f785-4a81-b220-69278bea0d1c","variant_id":"c92a6da6-52ea-47b8-95ac-cf585c0f275d","first_click":true}
00:36:02.973  D  app_time_stats: avg=22.83ms min=1.81ms max=98.43ms count=44
00:36:03.032  D  [DefaultDispatcher-worker-4] HttpClient: POST in_app_messages/56c9538a-5e91-436b-8b0d-0f8f33539186/click - STATUS: 200 JSON: {"success":true}
00:36:03.033  D  [Thread-41] Successful post for in-app message engagement request: {"success":true}
00:36:03.034  D  [Thread-41] InfluenceManager.onDirectInfluenceFromIAM(messageId: 56c9538a-5e91-436b-8b0d-0f8f33539186)
00:36:03.045  D  [Thread-41] ChannelTracker changed: iam_id
                 from:
                 influenceType: INDIRECT, directNotificationId: null, indirectNotificationIds: ["56c9538a-5e91-436b-8b0d-0f8f33539186"]
                 to:
                 influenceType: DIRECT, directNotificationId: 56c9538a-5e91-436b-8b0d-0f8f33539186, indirectNotificationIds: null
00:36:03.045  D  [Thread-41] InfluenceManager.setSessionTracker: Trackers changed to: [ChannelTracker{tag=notification_id, influenceType=UNATTRIBUTED, indirectIds=null, directId=null}, ChannelTracker{tag=iam_id, influenceType=DIRECT, indirectIds=null, directId=56c9538a-5e91-436b-8b0d-0f8f33539186}]
00:36:03.504  D  [main] InAppMessageView.removeAllViews()
00:36:03.552  D  [Thread-43] InAppMessagesManager.persistInAppMessage: OSInAppMessage{messageId='56c9538a-5e91-436b-8b0d-0f8f33539186', variants={all={default=c92a6da6-52ea-47b8-95ac-cf585c0f275d}}, triggers=[[Trigger{triggerId='a1294a59-ed4a-4b7e-a659-58132916a449', kind=session_time, property='', operatorType=greater_or_equal, value=60}]], clickedClickIds=[5385c0c8-f785-4a81-b220-69278bea0d1c], redisplayStats=OSInAppMessageDisplayStats{lastDisplayTime=1693421463, displayQuantity=1, displayLimit=2147483647, displayDelay=0}, displayDuration=10.0, displayedInSession=true, triggerChanged=false, actionTaken=true, isPreview=false, endTime=null, hasLiquid=false} with msg array data: [OSInAppMessage{messageId='56c9538a-5e91-436b-8b0d-0f8f33539186', variants={all={default=c92a6da6-52ea-47b8-95ac-cf585c0f275d}}, triggers=[[Trigger{triggerId='a1294a59-ed4a-4b7e-a659-58132916a449', kind=session_time, property='', operatorType=greater_or_equal, value=60}]], clickedClickIds=[5385c0c8-f785-4a81-b220-69278bea0d1c], redisplayStats=OSInAppMessageDisplayStats{lastDisplayTime=1693421463, displayQuantity=1, displayLimit=2147483647, displayDelay=0}, displayDuration=10.0, displayedInSession=true, triggerChanged=false, actionTaken=true, isPreview=false, endTime=null, hasLiquid=false}]
00:36:03.552  D  [Thread-43] InAppMessagesManager.messageWasDismissed: dismissedMessages: [56c9538a-5e91-436b-8b0d-0f8f33539186]
00:36:03.552  D  [Thread-43] InfluenceManager.onInAppMessageDismissed()
00:36:03.552  D  [Thread-43] ChannelTracker.getLastReceivedIds: lastChannelObjectReceived: [{"iam_id":"56c9538a-5e91-436b-8b0d-0f8f33539186","time":1693421457977}]
00:36:03.552  D  [Thread-43] ChannelTracker.resetAndInitInfluence: iam_id finish with influenceType: INDIRECT
00:36:03.552  D  [Thread-43] InAppMessagesManager.messageWasDismissed: In app message dismissed evaluating messages
00:36:03.552  D  [Thread-43] InAppMessagesManager.evaluateInAppMessages()
00:36:03.552  D  [Thread-43] InAppMessagesManager.onTriggerCompleted: called with triggerId: a1294a59-ed4a-4b7e-a659-58132916a449
00:36:03.552  D  [Thread-43] InAppMessagesManager.makeRedisplayMessagesAvailableWithTriggers: Trigger changed for message: OSInAppMessage{messageId='56c9538a-5e91-436b-8b0d-0f8f33539186', variants={all={default=c92a6da6-52ea-47b8-95ac-cf585c0f275d}}, triggers=[[Trigger{triggerId='a1294a59-ed4a-4b7e-a659-58132916a449', kind=session_time, property='', operatorType=greater_or_equal, value=60}]], clickedClickIds=[5385c0c8-f785-4a81-b220-69278bea0d1c], redisplayStats=OSInAppMessageDisplayStats{lastDisplayTime=1693421463, displayQuantity=1, displayLimit=2147483647, displayDelay=0}, displayDuration=10.0, displayedInSession=true, triggerChanged=false, actionTaken=true, isPreview=false, endTime=null, hasLiquid=false}
00:36:03.552  D  [Thread-43] InAppMessagesManager.setDataForRedisplay: OSInAppMessage{messageId='56c9538a-5e91-436b-8b0d-0f8f33539186', variants={all={default=c92a6da6-52ea-47b8-95ac-cf585c0f275d}}, triggers=[[Trigger{triggerId='a1294a59-ed4a-4b7e-a659-58132916a449', kind=session_time, property='', operatorType=greater_or_equal, value=60}]], clickedClickIds=[5385c0c8-f785-4a81-b220-69278bea0d1c], redisplayStats=OSInAppMessageDisplayStats{lastDisplayTime=1693421463, displayQuantity=1, displayLimit=2147483647, displayDelay=0}, displayDuration=10.0, displayedInSession=true, triggerChanged=true, actionTaken=true, isPreview=false, endTime=null, hasLiquid=false} triggerHasChanged: false
00:36:03.661  D  tagSocket(271) with statsTag=0xffffffff, statsUid=-1
00:36:03.672  D  app_time_stats: avg=2830.16ms min=12.32ms max=33330.84ms count=12
00:36:04.685  D  app_time_stats: avg=29.48ms min=3.69ms max=573.47ms count=27
00:36:05.669  D  tagSocket(170) with statsTag=0xffffffff, statsUid=-1
00:36:05.778  D  app_time_stats: avg=68.06ms min=13.92ms max=370.01ms count=16
00:36:07.206  D  app_time_stats: avg=40.69ms min=2.53ms max=516.46ms count=28
00:36:08.210  D  app_time_stats: avg=4.75ms min=1.97ms max=8.74ms count=61
00:36:09.716  E  FATAL EXCEPTION: Thread-39
                 Process: com.merokirana, PID: 20596
                 java.lang.NullPointerException
                 	at com.onesignal.inAppMessages.internal.display.impl.WebViewManager.showMessageView(WebViewManager.kt:288)
                 	at com.onesignal.inAppMessages.internal.display.impl.WebViewManager.access$showMessageView(WebViewManager.kt:40)
                 	at com.onesignal.inAppMessages.internal.display.impl.WebViewManager$showMessageView$1.invokeSuspend(Unknown Source:15)
                 	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
                 	at kotlinx.coroutines.UndispatchedCoroutine.afterResume(CoroutineContext.kt:233)
                 	at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:102)
                 	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
                 	at kotlinx.coroutines.DispatchedTaskKt.resume(DispatchedTask.kt:234)
                 	at kotlinx.coroutines.DispatchedTaskKt.dispatch(DispatchedTask.kt:166)
                 	at kotlinx.coroutines.CancellableContinuationImpl.dispatchResume(CancellableContinuationImpl.kt:397)
                 	at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl(CancellableContinuationImpl.kt:431)
                 	at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl$default(CancellableContinuationImpl.kt:420)
                 	at kotlinx.coroutines.CancellableContinuationImpl.resumeUndispatched(CancellableContinuationImpl.kt:518)
                 	at kotlinx.coroutines.android.HandlerContext$scheduleResumeAfterDelay$$inlined$Runnable$1.run(Runnable.kt:19)
                 	at android.os.Handler.handleCallback(Handler.java:942)
                 	at android.os.Handler.dispatchMessage(Handler.java:99)
                 	at android.os.Looper.loopOnce(Looper.java:201)
                 	at android.os.Looper.loop(Looper.java:288)
                 	at android.app.ActivityThread.main(ActivityThread.java:7872)
                 	at java.lang.reflect.Method.invoke(Native Method)
                 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
                 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
00:36:09.741  D  app_time_stats: avg=20.27ms min=2.04ms max=582.26ms count=55
00:36:09.906  D  Initializing libcrashlytics version 3.2.0
00:36:09.954  D  Initializing native crash handling successful.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jennantilla
Copy link
Contributor

@prajanyasoft-madhusudan thanks for reaching out! We'll investigate this and get back to you as soon as possible.

@prajanyasoft-madhusudan
Copy link
Author

@jennantilla any updates regarding this issue?

@jennantilla
Copy link
Contributor

@prajanyasoft-madhusudan thank you for your patience!

We have a fix for this in our latest release, 5.0.1. Please let us know if you have any additional questions or concerns.

@xrealx369
Copy link

xrealx369 commented Oct 26, 2023

@jennantilla This is still happening on latest version 5.0.3 on Android devices (tested on Samsung A53, Samsung S22), after dismissing in-app message, few seconds later and the app crashes with this error
Screenshot 2023-10-26 132737

@VirtualDOMinic
Copy link

@prajanyasoft-madhusudan or @xrealx369 did you make any progress with this? E.g. found the cause or the fix?

My issue #1643 has several differences (previous major version of OneSignal, error occurs before even trying to dismiss, different stacktrace), but has enough similarities to this (in-app messages, NullPointerException) that it might be something I can learn from

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants