Search code examples
androidcrashreact-nativebugsnag

ReactNative app crashes occasionally on production with no Bugsnag report


a colleague of mine is working on a legacy ReactNative app. There is quite a lot of code both in JavaScript and Java land, the latter being related to HERE Maps SDK.

Two of our clients experience multiple crashes every day and we cannot figure out why as we have no error reports. Bugsnag was installed early last year (circa jan 2020) and we have nothing on there to help us. Nothing to be found in Google Console either. App just stops.

To help us debug we've added a logging system which sends debug info to our backend via dedicated API calls. It roughly consists of logging "start of function A", "end of function A" etc so we know what the app is doing. We don't always enable it as it tends to make the app even more unstable.

In parallel to that we managed to get an idea of when the app crashes via login events that are sent by Firebase Auth when user re-launches the app. Looking at our logs around the time of crash doesn't help us as 1) they look the same as when it all works and 2) we haven't covered all method calls as there are way too many (in JS and Java).

Our users run the app on a Samsung Galaxy Active Tab 2 mounted in the cabin of a tractor. Some use a Galaxy Active Tab 3 and also have the issue.

We have run through various theories :

  • Could it be too hot in the cabin so Android shuts down? No, tablet is always on according to clients.

  • Could it be related to a change in voltage? When WE try to plug and unplug everything continues to work fine.

  • Could it be Android that decides the app is consuming too much battery or CPU (GPS is needed for our app) so it shuts it down? We've let our app in the foreground for hours with no problem.

We logged in with customers' credentials (they are aware) and could not replicate the issue.

Customers interest in helping us find the issue is slowly fading away so we can't keep on asking them to install a patched version every week.

First there was just one client but now we have at least 3 more users complaining about mysterious crashes.

We're a bit stomped as to what to do.

Has anyone any idea of an ultimate catch all library? Or a syslog on the tablet where we could get more info?

Thanks in advance for your help!


Solution

  • After much testing my colleagues managed to easily reproduce the error and found the root cause: poor memory management in one method in Java land. Said method was responsible for changing markers orientation on the map but it duplicated markers when their orientation changed. It resulted in a high memory consumption and when it reached a certain point Android would just kill all running apps.

    My colleague fixed the leak and we're good! Onto the next bug now. :)