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

SurveyManager's NullPointerException crash spike #103

Open
astamato opened this issue Feb 22, 2021 · 8 comments
Open

SurveyManager's NullPointerException crash spike #103

astamato opened this issue Feb 22, 2021 · 8 comments

Comments

@astamato
Copy link

astamato commented Feb 22, 2021

Hello guys;

Over the past few days (specifically past 24 hours) we noticed a spike on crashes happening in our production Android app in Firebase Analytics:

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'android.app.Activity com.wootric.androidsdk.objects.WootricEvent.getActivity()' on a null object reference
       at com.wootric.androidsdk.SurveyManager.showSurveyFragment(SurveyManager.java:302)
       at com.wootric.androidsdk.SurveyManager.access$000(SurveyManager.java:57)
       at com.wootric.androidsdk.SurveyManager$1.run(SurveyManager.java:291)
       at android.os.Handler.handleCallback(Handler.java:883)
       at android.os.Handler.dispatchMessage(Handler.java:100)
       at android.os.Looper.loop(Looper.java:230)
       at android.app.ActivityThread.main(ActivityThread.java:7762)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:526)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1034)

Taking a look at the code, we see that currentEvent is already null at this point (either because or a previous NullPointerException trying to run they survey, or the process called stop()) and because this line is not inside the try-catch in showSurveyFragment() for NullPointerException, it crashes.

Can easily be resolved surrounding this two lines with the try-catch.

However it will maybe require further investigation down the line. Patching it this way might be hiding a bigger issue, an illegal state on the code that shouldn't have come to this.

We're on Wootric SDK version 2.18.1.

Hope this makes sense.

Thank you!

@Yannshu
Copy link
Contributor

Yannshu commented Feb 22, 2021

Hey @astamato!

We've also experienced the exact same crash on one of our apps at Deliveroo, with more than 3K crashes on Sunday 😱 I'm a bit relieved to know it seems to be something wider, not just on our app!
As I'm writing this message, it seems the crash is no longer happening, the last reported was at around 2am GMT.

We're using Wootric SDK version 2.18.1, but we had the same crash reported by an older version of our app which is using version 2.18.0.

As this happened on multiple apps which are not related, I guess it must be related to a Wootric API being down / sending an invalid parameter to the SDK, leading to the crash.
I agree with the quick & dirty patch idea, moving the 2 lines you suggested in the try-catch, but it would be great to have a full investigation & proper fix on this.

Over to you Wootric team!

@diegoserranoa
Copy link
Contributor

Hi! Oh boy, this is not good. Sorry for the trouble! I will put this as a top priority but please be patient 🙏 we're low on resources and I'm doing my best.

Thanks for reporting this!

@Yannshu
Copy link
Contributor

Yannshu commented Mar 1, 2021

Hello,

Is there any update on this? This issue happened a bit more than a week ago, and caused a major crash in our app. While it has auto-resolved, nothing indicates it won't happen again, which is very scary.
I'm not expecting a full resolution straight away, but some explanations would be great:

  • was there any problems on the Wootric API on the 21st of February that could have caused the issue?
  • what are the odds of this happening again?
  • when can we expect a proper fix?

Thank you!

@Yannshu
Copy link
Contributor

Yannshu commented Mar 1, 2021

☝️ In addition to these questions, I've created a quick patch as suggested by @astamato, please have a look at the PR.

@astamato
Copy link
Author

astamato commented Mar 1, 2021

Hey @Yannshu thank you for your follow up message and submitting the patch. I also believe we should release a hotfix while further investigations take place.

For the sake of transparency, last week we've been in communication with Wootric on our end, the messaging has been:

We had an unexpected event yesterday that caused multiple issues across our system. We've since resolved it and are putting some safeguards in place to prevent this in the future.

It would be beneficial for all clients of the SDK to know more about the nature of the event, which these safeguards are, and a high level timeline for releasing 1) the patch for Android which would give us all peace of mind 2) a broader solution.

Cheers.

@diegoserranoa
Copy link
Contributor

Hi! We released version 2.18.2 with the patch. Please update whenever you can!

@Yannshu
Copy link
Contributor

Yannshu commented Mar 2, 2021

Thanks @diegoserranoa!

Is there any news regarding why this happened and which measures were taken in order to prevent it from happening again?

@diegoserranoa
Copy link
Contributor

diegoserranoa commented Mar 2, 2021

@Yannshu yes, like @astamato mentioned, we had an issue with our servers but we identified it and took measures on the backend side to prevent this from happening again.

Now, on the client sides (mobile SDKs) we're scheduling some time to make improvements to the code. Making an app crash is definitely not good and the patch we released was just as an emergency. Putting things inside try/catch isn't the proper solution. We will work with the team in the upcoming sprints to review the SDKs and make fixes/improvements where we see fit.

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

3 participants