Open smccants opened 4 years ago
Edited the ticket to improve readability.
Hi @smccants! Sorry for the delay here - I've been trying to repro this with your gradle setup, as well as the sample test linked in that SO post, but have not been able to repro the crash. Could you share some sample test code that causes the crash? I think especially important is understanding what you're trying to mock that causes it - I've tried mocking a bunch of final methods from various OS classes, and haven't had any problems with or without the debugger. A sample project would be awesome if you have the time. Thanks!!
@kkoser thanks for looking at this ticket. I spent about half a day trying to build a simple test case that would fail, but so far no luck. More interesting, as I pared down the existing test case, it didn't even require anything being mocked to crash. Also, the crash seems to occur at different places and occasionally not at all. It does seem to be time sensitive - I removed almost all of what I was testing (switching between activities by click) and the test would pass consistently. I added a sleep back in and the crash resumed. Best I can tell so far, it looks like a combination of some memory corruption with a race condition. I'm still working on a simple test case, but thought I'd update you on what I found so far.
Thanks, that's useful! If it's a memory leak then it makes sense it would be time-related; theres probably some hidden limit that we hit after a certain amount of time depending on what's happening on the device. As for it requiring no mocking, that's really interesting - I'll try and see if anything stands out as dangerous in init code, although this bug may also be in the JVMTI implementation itself if that's the case...
Similar to the report https://github.com/linkedin/dexmaker/issues/100, but a different flavor.
When running with:
androidTestImplementation 'com.linkedin.dexmaker:dexmaker-mockito-inline:2.25.1'
Any tests under debug crash if they have any breakpoints set. If I switch to:
androidTestImplementation 'org.mockito:mockito-android:2.13.0'
Breakpoints work fine. However, I'm looking to use the ability to mock final methods, so I'm hoping to get dexmaker-mockito-inline working correctly with the debugger.
This is running on real Android 9 hardware (Samsung Galaxy Tab A - 2019). It hangs the tablet is such a way that the easiest way to get it out of that state is to reboot the whole tablet.
Here is my build.gradle for the app:
Here is the crash results:
It does run is there are no breakpoints set, but that defeats the point of the debugger.
Please let me know if you need additional information. Thanks.