3 ms·
A few years ago I also ran into a hardware (or at least very low-level software) bug that was only affecting Samsung devices. I had taken over maintenance of a
by dotdi 3y ago
A few years ago I also ran into a hardware (or at least very low-level software) bug that was only affecting Samsung devices.
I had taken over maintenance of a library that allowed predicting satellite orbits from TLE data, which was used by the European Space Agency (and others) for the occasional mobile app.
Sporadically, we were getting reports of strange situations where the altitude of a satellite was way off, by hundreds or thousands of kilometers. The bug was really difficult to track down and reproduce, and by chance one of our Samsung tablets finally started showing the behaviour.
It turned out that Dalvik (the now obsolete Android VM) was figuring out that the TLE calculation was in a hot path and would JIT it to run more efficiently, and the optimized code used some native arithmetic (or was it trigonometic? can't recall) call that had a bug. We saw that the incorrect values started showing up right around the time when the JIT started kicking in. Fortunately, we could turn off JIT for specific devices and we rolled out an update that fixed the issue.
Fun times!
- spuz 3y agoHow do you trace what the JIT is doing in an Android app?
- dotdi 3y agoIf I recall correctly, there were some TRACE or DEBUG logs one could turn on that would - amid a ton of unhelpful output - also emit logs when the JIT was doing its thing. Then, while running a small reproducer app and combing through the output, we noticed values were always correct before the JIT ran, then when the JIT started to kick in, we had a transition period where sometimes wrong values started to crop up (I assume until all threads had switched to the optimized code), and then always produce the wrong result. This gave me a hunch that it could be related to JIT, and then I tried completely turning it off, which caused the issue to disappear.