Due to a regression, the Java Heap/CPU Profiling Tool (HPROF) produced truncated output when used with the "doe=n" argument. Consequently, the output file contained only the header, the data was missing. A patch has been applied, and the output of HPROF is now correct when using "doe=n".
Created attachment 1018052[details]
patch containing fix to the issue.
Description of problem:
----------------------
Output of java profiling tool hprof is being truncated when used with argument "doe=n". This argument should define wheter output should be written over time or at end of java program.
Version-Release number of selected component (if applicable):
------------------------------------------------------------
This issue is probably present in all versions of Java starting from May 2007 when Sun released most of its Java source code as free software.
I used jdk1.7.0_51 and jdk1.6.0_31
How reproducible:
----------------
100%
Steps to Reproduce:
------------------
There are more ways how to run hproftool, I will describe just one:
1. Set hprof argument "doe" to "n", eg.: export JAVA_TOOL_OPTIONS="-Xrunhprof:thread=y,force=n,doe=n,file=/home/my_user/my-hprof-output.txt"
2. Run some java job, eg.: java example
3. collect output, compare it to one runned with "doe=y"
Actual results:
--------------
Output file is truncated when using argument "doe=n". Output file contains just header, relevant data is missing. File is much smaller.
Expected results:
----------------
HPROF tool should produce same output regardless "doe" argument setting.
Additional info:
---------------
This issue has been reported and fixed in 2003, but fix was somehow lost. Please see original bug report: http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4890063
Check for description of hprof: http://docs.oracle.com/javase/7/docs/technotes/samples/hprof.html
There is a patch for this issue in attachment.
affected file should be in: src/share/demo/jvmti/hprof/hprof_init.c
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
https://rhn.redhat.com/errata/RHEA-2015-1245.html