Obtaining system dump files in a race condition

You might be able to obtain system dump files even when a race condition exists.

About this task

When you confirm that you have a race condition in which shut down timing prevents a system dump, you can try to obtain a dump file in two ways:
  • Try to prevent the system from shutting down before the dump file is taken.
  • Add a delay near the end of the Java virtual machine (VM) run time to give the dump handler enough time to write the dump files.

Procedure

  • AIX®, z/OS®, or Linux®: Create a system dump by using the -Xrs Java™ command-line option to disable the Java signal handler. The default signal handler in the operating system triggers a dump file and prevents the system from shutting down before the dump file is taken. For more information, see -Xrs option.
  • On Windows, you cannot use the -Xrs option to collect a system dump file in this situation because the Windows dump system allows the process to shut down while the dump file is being written. Instead, use the -Xtrace:trigger option to add a delay near the end of the VM run time. This delay gives the dump handler enough time to write the system dump file. For more information, see the sleep trigger action in -Xtrace:trigger.
    When the sleep trigger action is added, the console output is similar to the following text:
    java -Xtrace:none,print=tpnid{j9vm.381-394},trigger=tpnid{j9vm.389,sleep} MyApp
    
    11:16:50.234*0x42cc1a00            j9vm.385      > protectedDestroyJavaVM
    11:16:50.234 0x42cc1a00            j9vm.386      - protectedDestroyJavaVM waiting for Java threads to 
    stop
    11:16:50.234 0x42cc1a00            j9vm.387      - protectedDestoryJavaVM all Java threads have stopped
    11:16:50.234 0x42cc1a00            j9vm.388      - protectedDestroyJavaVM protectedDestroyJavaVM 
    vmCleanup complete
    TRCx289: Trace sleep action triggered. Sleeping for 30000 ms.
    Unhandled exception
    Type=Segmentation error vmState=0x00000000
    J9Generic_Signal_Number=00000004 ExceptionCode=c0000005 ExceptionAddress=430514BE ContextFlags=0001003f
    Handler1=7FEE9C40 Handler2=7FEC98C0 InaccessibleAddress=00000000
    EDI=000A70E0 ESI=4333BB28 EAX=00000000 EBX=001926B4
    ECX=00000001 EDX=4368FECC
    EIP=430514BE ESP=4368FED4 EBP=4368FED8 EFLAGS=00010246
    Module=failing_module.dll
    Module_base_address=43050000 Offset_in_DLL=000014be
    Target=2_40_20081203_026494_lHdSMr (Windows XP 5.1 build 2600 Service Pack 2)
    CPU=x86 (2 logical CPUs) (0x7fe6b000 RAM)
    ----------- Stack Backtrace -----------
    _crash:0x430514BE [0x430514B0 +0x0000000E]
    _agent_thread_run:0x430513AD [0x430513A0 +0x0000000D]
    J9VMDllMain:0x7FCA6F70 [0x7FCA5820 +0x00001750]
    0x001926B4
    0x430E0100
    ---------------------------------------
    JVMDUMP006I Processing dump event "gpf", detail "" - please wait.
    JVMDUMP007I JVM Requesting System dump using 'C:\java\pwi3260sr4-20081205_01\core.20081208.111651.5344.
    0001.dmp'
    JVMDUMP010I System dump written to C:\java\pwi3260sr4-20081205_01\core.20081208.111651.5344.0001.dmp
    JVMDUMP007I JVM Requesting Snap dump using 'C:\java\pwi3260sr4-20081205_01\Snap.20081208.111651.5344.
    0002.trc'
    JVMDUMP012E Error in Snap dump: {nothing to snap}
    JVMDUMP007I JVM Requesting Java dump using 'C:\java\pwi3260sr4-20081205_01\javacore.20081208.111651.5344.
    0003.txt'
    JVMDUMP010I Java dump written to C:\java\pwi3260sr4-20081205_01\javacore.20081208.111651.5344.0003.txt
    JVMDUMP013I Processed dump event "gpf", detail "".