The -XX:OnError= option is used to run new processes, near the end of fatal error handling. This can be used to gather information at the time of a crash. It is sometimes used to call jcmd, to attach back to the crashing JVM.
e.g.
-XX:OnError="jcmd %p ...command..."
The attach mechanism can be bypassed if we introduce a -XX:OnErrorJCmd= option, which runs "jcmd" diagnostics directly.
e.g.
-XX:OnErrorJcmd="GC.heap_dump my_dump_%p.hprof"
While this is fatal error handling and there can be few guarantees, this may be more reliable than re-attaching.
e.g.
-XX:OnError="jcmd %p ...command..."
The attach mechanism can be bypassed if we introduce a -XX:OnErrorJCmd= option, which runs "jcmd" diagnostics directly.
e.g.
-XX:OnErrorJcmd="GC.heap_dump my_dump_%p.hprof"
While this is fatal error handling and there can be few guarantees, this may be more reliable than re-attaching.