linkedin / dexmaker

A utility for doing compile or runtime code generation targeting Android's Dalvik VM
Apache License 2.0
1.86k stars 248 forks source link

SIGSEGV crashes when using dexmaker-mockito-inline #147

Closed lukaville closed 4 years ago

lukaville commented 4 years ago

Hi! I'm having strange random crashes when I use mocks with dexmaker-mockito-inline. It happens randomly but it consistently happens with some probability when I use mocks. When I use mocks it crashes sometimes and without mocks it doesn't crash in 100% cases so I'm pretty sure it's related to runtime instrumentation that is done by dexmaker-mockito-inline.

Here is an excerpt from the crash log:

2019-10-19 14:42:30.551 9633-9646/com.example.app.test A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x8 in tid 9646 (HeapTaskDaemon), pid 9633 (ncomponent.test)

2019-10-19 14:42:30.753 9698-9698/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2019-10-19 14:42:30.753 9698-9698/? A/DEBUG: Build fingerprint: 'google/sdk_gphone_x86/generic_x86:10/QSR1.190920.001/5891938:userdebug/dev-keys'
2019-10-19 14:42:30.753 9698-9698/? A/DEBUG: Revision: '0'
2019-10-19 14:42:30.753 9698-9698/? A/DEBUG: ABI: 'x86'
2019-10-19 14:42:30.754 9698-9698/? A/DEBUG: Timestamp: 2019-10-19 14:42:30+0100
2019-10-19 14:42:30.754 9698-9698/? A/DEBUG: pid: 9633, tid: 9646, name: HeapTaskDaemon  >>> com.example.app.test <<<
2019-10-19 14:42:30.754 9698-9698/? A/DEBUG: uid: 10134
2019-10-19 14:42:30.754 9698-9698/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x8
2019-10-19 14:42:30.754 9698-9698/? A/DEBUG: Cause: null pointer dereference
2019-10-19 14:42:30.754 9698-9698/? A/DEBUG:     eax e0d60100  ebx f2c74a74  ecx 00000000  edx 00000001
2019-10-19 14:42:30.754 9698-9698/? A/DEBUG:     edi ec293fe4  esi ec293fe0
2019-10-19 14:42:30.754 9698-9698/? A/DEBUG:     ebp ea114a58  esp ea114a00  eip f27e1f8e

I can't find any backtrace or tombstone and looks like the crash is happening in HeapTaskDaemon. Does anyone have any ideas why is this happening or how can I debug this issue?

Full crash log: https://gist.github.com/lukaville/955fffb4b11f882668141e0355d8ec0d

I've tested on different Android versions and it is reproducible on Android 9, 10

kkoser commented 4 years ago

Hi! Assuming this is still an issue, can you share the example project it looks like you were using to test? This crash is happening on the GC background thread (which only exists on newer android versions, hence the OS levels you saw this on), which is why we don't get a full stacktrace. I agree it's likely some issue with memory being freed by the code generator, but it's a large search area without being able to reproduce the issue locally. Thanks!

kkoser commented 4 years ago

Hi! Gentle bump on above, please let me know if this is still an issue for you. Thanks!

lukaville commented 4 years ago

Hey, Yes, this issue is still relevant. Unfortunately, we can't share our project but I will try to reproduce it on a sample project.

lukaville commented 4 years ago

Closing this as we were able to reproduce this issue even without dexmaker-mockito-inline dependency