Search code examples
debuggingjvmgdbwebspherej9

Core dump generated by J9 VM on linux shows/contains only one thread


What is the reason for the core dump generated by J9 VM on linux platform, it just shows/contains only one thread (i.e current thread)?

Note: It is complete core dump(not truncated).

(gdb) info threads
* 1 Thread 0x7f33544d9700 (LWP 6471)  0x00007f335484d6e4 in j9dump_create () from ./app/was/IBM/WebSphere/AppServer/java/jre/lib/amd64/compressedrefs/libj9prt24.so

Solution

  • This is by design (in bold below):

    Linux does not provide an operating system API for generating a system dump from a running process. The JVM produces system dumps on Linux by using the fork() API to start an identical process to the parent JVM process. The JVM then generates a SIGSEGV signal in the child process. The SIGSEGV signal causes Linux to create a system dump for the child process. The parent JVM processes and renames the system dump, as required, by the -Xdump options, and might add additional data into the dump file.

    The system dump for the child process contains an exact copy of the memory areas used in the parent. The SDK dump viewer can obtain information about the Java threads, classes, and heap from the system dump. However, the dump viewer [gdb], and other system dump debuggers show only the single native thread that was running in the child process.

    If you want all the threads, you may use gcore ${PID} or -Xdump:tool cleverly and execute gcore %pid.

    IBM proposed a kernel API to create a core dump but it was rejected for security reasons (DoS). There is some experimentation with user-land core dumping.