JDK-4890063 : HPROF: default text truncated when using doe=n option
  • Type: Bug
  • Component: tools
  • Sub-Component: hprof
  • Affected Version: 1.4.1
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2003-07-14
  • Updated: 2003-09-26
  • Resolved: 2003-09-26
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0 tigerFixed
Description

Name: dk106046			Date: 07/14/2003

FULL JDK VERSION(S):
-------------------
(from java -version)
java version "1.4.1_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06)
Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode)


------------
(including:
- Exact steps to reproduce
- Minimal source code that demonstrates the problem
- Exact text of any error messages
- Any trace information
- Any additional configuration information)

Run hprof with the parameter doe=n:
  java -Xrunhprof:doe=n -version

The resultant java.hprof.txt file appears to be truncated, as not all of the header text
is output.

[This bug is being submitted as a courtesy, in order to maintain uniformity between Sun & IBM JDKs.  It has been fixed in IBM JDKs.  Please contact ###@###.### if you have questions.]
======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger FIXED IN: tiger INTEGRATED IN: tiger tiger-b22
01-09-2004

PUBLIC COMMENTS The doe=n option prevents the final buffer from being dumped out.
01-09-2004

EVALUATION A test was using && when it should have been using ||. See suggested Fix. -kto ###@###.### 2003-09-10 Although that fixes the testcase, Dan is correct that is the wrong change. See new suggested fix. A call to hprof_flush() was added right after the prelude file is written out. -kto ###@###.### 2003-09-10
10-09-2003

SUGGESTED FIX ------- hprof.c ------- *** /tmp/sccs.ZqaGMv Wed Sep 10 11:57:46 2003 --- hprof.c Wed Sep 10 11:54:41 2003 *************** *** 1,5 **** /* ! * @(#)hprof.c 1.48 03/01/23 * * Copyright 2003 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. --- 1,5 ---- /* ! * @(#)hprof.c 1.49 03/09/10 * * Copyright 2003 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. *************** *** 424,430 **** (void) CALL(DisableEvent)(i, NULL); } } ! if (dump_on_exit && need_to_dump) { hprof_dump_data(); } #ifdef HASH_STATS --- 424,430 ---- (void) CALL(DisableEvent)(i, NULL); } } ! if (dump_on_exit || need_to_dump) { hprof_dump_data(); } #ifdef HASH_STATS ###@###.### 2003-09-10 I added the need_to_dump flag to deal with the possibility of parallel calls to hprof_jvm_shut_down_event(); some VMs had bugs where the SHUT_DOWN event was posted twice. The purpose of the following if-statement: if (dump_on_exit && need_to_dump) is to only call hprof_dump_data() once if there are competing calls to hprof_jvm_shut_down_event(). Only one thread will get need_to_dump set to TRUE so only one thread will call hprof_dump_data(). I think the correct solution is to modify hprof_init_setup() to flush the output buffer after copying the "prelude_file" to the hprof output file. An hprof_flush() call might do the trick. ------------------------ Suggested fix #2: (cd /net/cruella.sfbay/export/home4/ws/kto_sdk/src/share/tools/hprof && sccs diffs -w -C -r1.19 hprof_setup.c ) ------- hprof_setup.c ------- *** /tmp/sccs.eaaanX Wed Sep 10 19:09:36 2003 --- hprof_setup.c Wed Sep 10 19:09:03 2003 *************** *** 1,5 **** /* ! * @(#)hprof_setup.c 1.19 03/01/23 * * Copyright 2003 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. --- 1,5 ---- /* ! * @(#)hprof_setup.c 1.20 03/09/10 * * Copyright 2003 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. *************** *** 444,449 **** --- 444,450 ---- } fclose(prelude_fd); hprof_printf("\n--------\n\n"); + hprof_flush(); } micro_sec_ticks = hprof_get_milliticks() * 1000; ###@###.### 2003-09-10
10-09-2003