Workaround bad GC of tombstone watcher.
There's some bad behaviour going on that's exclusive to WatchOS
(discovered on the Pixel Watch 2). The TombstoneWatcher class is
responsible for watching the /data/tombstones/ directory. It is a member
of the NativeTombstoneManager class, which is created when
ActivityManager starts, and lives until the device is powered off.
Unfortunately, some bad behaviour (unclear exactly what at this stage)
means that the TombstoneWatcher class is spuriously garbage collected,
even though the parent NativeTombstoneMenager class is still alive and
reachable. I chatted with hboehm@ from the ART team, and his hypothesis
is that because the TombstoneWatcher member is initialized in the
constructor and never used again, some optimiser is doing the wrong
thing and thinking that it's unused and can be GC'd.
The TombstoneWatcher uses inotify in native code to execute a callback
when a file is added to a directory, so it's clearly in use, but
unfortunately the bug allows this class to be GC'd anyway.
What this means, in practice, is that app native crashes on WatchOS are
not being handled correctly. This includes:
- Apps cannot get their own crashes through the
ApplicationExitInfo::getHistoricalProcessExitReasons API.
- Crash reports are never sent to Google, with the exception of
tombstones that last until the next reboot, where they're one-time
scooped up and sent to Google. This has substantially increased
latency (requires a reboot) and also probably drops quite a number of
reports because there's a limit of tombstones on the device, and a
rate limit of how many are sent by GMS.
Bug: 339371242
Test: atest CtsGwpAsanTestCases on eos (Pixel Watch 2, WatchOS)
Change-Id: I9226e4368b03bd4742fccdafde6018f145da63e6
1 file changed