You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "Jaroslav Tulach (Jira)" <ji...@apache.org> on 2020/07/23 03:29:00 UTC

[jira] [Commented] (NETBEANS-4618) HeapFactory cannot process multi heap segment files

    [ https://issues.apache.org/jira/browse/NETBEANS-4618?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17163193#comment-17163193 ] 

Jaroslav Tulach commented on NETBEANS-4618:
-------------------------------------------

The root cause of the exception is the {{TagBounds[] tagBounds = new TagBounds[0xff];}} array which assumes that each segment appears there only one. When multiple heap dump segments (id {{0x1C}}) are present, the {{tagBound.start}} is set to beginning of the first segment, but the {{tagBound.end}} is set to the end of the last segment. The {{readDumpTag}} code then tries to process everything from start to end and gets confused by other, non-heap data in between. In the particular case of [^multiheapsegment.hprof] a definition of {{STACK_FRAME}} is treated as {{ROOT_NATIVE_STACK}} and then an exception is thrown.

> HeapFactory cannot process multi heap segment files
> ---------------------------------------------------
>
>                 Key: NETBEANS-4618
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-4618
>             Project: NetBeans
>          Issue Type: Bug
>          Components: profiler - Base
>    Affects Versions: 12.0, 12.0.1
>            Reporter: Jaroslav Tulach
>            Priority: Major
>         Attachments: multiheapsegment.hprof, singleheapsegment.hprof
>
>
> I am trying to generate {{.hprof}} file according to the [Java Profile 1.0.2|http://hg.openjdk.java.net/jdk6/jdk6/jdk/raw-file/tip/src/share/demo/jvmti/hprof/manual.html#mozTocId848088] specification. I believe I am fully following the specification (which allows multiple heap segments), but NetBeans Profiler library chokes up on my file and yields following exception:
> {code:java}
> java.lang.IllegalArgumentException: Invalid dump tag 0 at position 1415
> 	at org.netbeans.lib.profiler.heap.HprofHeap.readDumpTag(HprofHeap.java:1138)
> 	at org.netbeans.lib.profiler.heap.HprofHeap.fillHeapTagBounds(HprofHeap.java:1215)
> 	at org.netbeans.lib.profiler.heap.HprofHeap.<init>(HprofHeap.java:140)
> 	at org.netbeans.lib.profiler.heap.HeapFactory.createHeap(HeapFactory.java:80)
> 	at org.netbeans.lib.profiler.heap.HeapFactory.createHeap(HeapFactory.java:49)
> {code}
> I am able to generate the file with a single heap segment (see [^singleheapsegment.hprof]) as well as multiple heap segments (see [^multiheapsegment.hprof]). The first one can be opened by NetBeans 12.x, the latter cannot.
>  
> In my usecase I'd like to generate the file incrementally while my application is running. As such it is essential to flush the heap segments multiple times, otherwise I may run out of memory. It would be fantastic if the NetBeans heap profiler library could be enhanced to work with multiheapsegment files properly.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists