JDK-6657108 : -XX:+HeapDumpOnCtrlBreak function added in 1.5.0_14 does not work
  • Type: Bug
  • Component: core-svc
  • Sub-Component: tools
  • Affected Version: 5.0u14
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_9
  • CPU: sparc
  • Submitted: 2008-01-30
  • Updated: 2010-04-02
  • Resolved: 2008-01-30
Related Reports
Duplicate :  
Relates :  
Description
FULL JDK VERSION(S):
java version "1.5.0_14"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_14-b03)
Java HotSpot(TM) Server VM (build 1.5.0_14-b03, mixed mode)

DESCRIPTION:
The HeapDumpOnCtrlBreak option was added to Java 1.5.0_14 under CR 6454676. However, the implementation does not work, apparently due to the dump's filename being badly formed by the heapdumping code. The problem does not exist in 1.4.2_16.

To reproduce, start the VM with the -XX:+HeapDumpOnCtrlBreak option on Solaris, and try to obtain a heapdump by sending the process a SIGQUIT (kill -3). You will see output like this:

    ...
    "VM Thread" prio=10 tid=0x000fa9c8 nid=0x4 runnable

    "VM Periodic Task Thread" prio=10 tid=0x0010c340 nid=0xa runnable

--> Dumping heap to java_pid8549.hprof.m30.10/05/07M49 ...
--> Unable to create java_pid8549.hprof.m30.10/05/07M49: No such file or directory
    ...

The problem seems to be caused by this line in the SIGQUIT handling code (os.cpp, line 109):

    ...
    time_t current_time = time(0);
    today = localtime(&current_time);
--> time_length = strftime(time_string, buffer_size, "m%d.10/05/07M%S", today);
    ...

The equivalent code in 1.4.2_16 is much simpler and does not exhibit this problem.

Comments
EVALUATION Code changed when checked into SCCS - already fixed by 6615248.
30-01-2008