Native crash at /dev/ashmem/dalvik-jit-code-cache

fadden

The Dalvik VM will throw a SIGSTKFLT at itself in certain circumstances. You can see the code here. One such call site is here. The goal was to get a stack trace from a spinning thread from debuggerd so you could see it in the logcat output. (This pre-dates the nice stack unwinding code that Android has now, and Dalvik went into low-maintenance mode before the unwinder was improved, so it continued to use this somewhat crude mechanism.)

You should see some diagnostics above the crash that complain about a spinning thread -- scroll up in the logcat output and see what you find.

Stack traces in the JIT code cache indicate that the thread was running JIT-compiled code at the time the signal arrived. In other words, this is a VM bug.

You may be seeing an instance of bug 58726, discussed a bit in this question. The specific circumstances of that bug were supposed to have been fixed by 4.4.2, but it's possible there's a different bug with similar failure characteristics. The basic issue is an OEM enhancement gone wrong... note in particular that you haven't seen any failures on stock Google Nexus devices. (I think all of the devices in your list are based on Qualcomm chips, which would point the finger at them. Again.)

As noted in my answer to the other question, the workaround is essentially to un-optimize your code so it doesn't hit the bad path in the JIT.

This problem, or a similar one with Fatal signal 11 (SIGSEGV), can happen when running Instrumentation unit tests on ARM emulators, especially Android 4.1 emulator. You will also see this message in Logcat:

Test failed to run to completion. Reason: Instrumentation run failed due to Process crashed. Check device logcat for details.

It usually happens when tests are running in the background, with no Activity launched, for example ActivityUnitTestCase or SingleLaunchActivityTestCase.

The workaround is to launch an Activity while these tests are running, and ideally rewrite them to use ActivityTestRule.

标签