ReactNative app crashes occasionally on production with no Bugsnag report

Viewed 880

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!

2 Answers

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. :)

The below reasoning is based on hardware failure. If your software hasn't drastically changed (the app or the operating system), then this is a likely scenario:

The Tab 2 was released in 2012, so we're talking about a device that is up to 9 years old. If the users all use the same hardware, and the software hasn't been changed for a while, it could be some kind of hardware failure. It could be related to the vibrations of the tractor, moisture over time, or just because they used the tablet more intensively than you use yours. There could be something (semi-)loose or the memory (SSD or RAM) could start becoming faulty.

It can be a software error too of course, but it's unlikely if you haven't updated in a long time - assuming the tablets haven't been updated either.

Could you perhaps swap your tablet with one of a customer. Preferrably a customer that has the issue most often. Then observe if the issue is resolved. This way, you'll be able figure out if it is related to the tablet (being broken) or the environment (tractor) it is being used in.

If the issue persists after a tablet swap, it's either the environment or the software, but you'd have ruled out the hardware. If the issue is resolved, you'll know for sure it's the hardware at fault.

Related