Fixed
Status Update
Comments
xa...@google.com <xa...@google.com>
es...@google.com <es...@google.com>
py...@squareup.com <py...@squareup.com> #2
Let me know if you'd like me to contribute a patch.
py...@gmail.com <py...@gmail.com> #3
Hi, just came back from pat leave and checking in on this. Any chance this got fixed and the issue just wasn't updated? If not, I'm also happy to provide a small patch, this should be fairly straightforward.
sh...@google.com <sh...@google.com> #4
+ dunno@ what do you think? We can handle that case a bit more gracefully?
I will try looking into why we are missing that thread object.
I will try looking into why we are missing that thread object.
py...@gmail.com <py...@gmail.com> #5
I ended up shipping my own patched version, as you can see avoiding the issue is nothing more than a null check: https://github.com/square/haha/pull/22/commits/a232fc4083ef039c719a01fb6aa2073b9bb38381 (of course I'd love to know why that native thread doesn't exist).
sh...@google.com <sh...@google.com>
sh...@google.com <sh...@google.com> #6
Thanks for the patch link.
I will take a look and why the native thread is missing/referenced, but I don't see a problem adding that check in perflib.
I will take a look and why the native thread is missing/referenced, but I don't see a problem adding that check in perflib.
du...@google.com <du...@google.com> #7
(Congrats on the paternity!)
Sorry, I noticed this thread just now....
It seems like Android itself is failing to dump a thread object? Are those native stacks for a native thread? And which particular Android version is this? I hope it's not the same "issue" as image content bytes....
If the thread object just isn't in the hprof, then I think we should accept the patch and root cause it with the ART team.
Sorry, I noticed this thread just now....
It seems like Android itself is failing to dump a thread object? Are those native stacks for a native thread? And which particular Android version is this? I hope it's not the same "issue" as image content bytes....
If the thread object just isn't in the hprof, then I think we should accept the patch and root cause it with the ART team.
sh...@google.com <sh...@google.com>
ph...@google.com <ph...@google.com>
ph...@google.com <ph...@google.com>
ph...@google.com <ph...@google.com> #8
This bug has been fixed in the latest build and will be available in a future release after Chipmunk
Description
=> I've reproduced this in Android Studio 3.2.1, but have also been running the code from latest master directly and was able to reproduce there as well.
We've discovered this issue thanks to LeakCanary (
Steps:
* Get a heap dump that misses a Thread object (more on that below). Those are sometimes generated by Android (not sure why). LeakCanary users have uploaded their heap dumps, here are two: 1)
* Load the Heap dump in Android Studio.
=> The profiler tab says "Selected Capture has no content"
* Open the same Heap Dump in YourKit Java Profiler, it parses it fine.
I've been debugging through the perflib code, here's what I think is happening:
* When parsing a heap dump, we normally first read a ROOT_THREAD_OBJECT and call HprofParser.loadThreadObject(), that thread gets added to the threads of the current heap.
* Then we get a ROOT_NATIVE_STACK and call HprofParser.loadNativeStack(), which reads the thread serial number and uses that to retrieve the ThreadObj from the current heap.
* Unfortunately, these heap dumps have a ROOT_NATIVE_STACK but no corresponding ROOT_THREAD_OBJECT. I've looked in depth at the second one listed above, it has 700 ROOT_NATIVE_STACK tags all referencing thread serial number 2. Note that YourKit does not show a thread 2, so they likely just ignore this issue. Thread serial number 1 is the main thread, so I wonder what that second missing thread is.
* Because there's no ROOT_THREAD_OBJECT to retrieve in HprofParser.loadNativeStack(), mSnapshot.getThread(threadSerialNumber) returns null and we get an NullPointerException on thread.mStackTrace
* The exception bubbles up, it's caught in HprofParser.parse(), logged and silently ignored.