One of the frequently asked question is : My Jvm just crash but I cannot find any core dump of log.
All this may depend on host and/or Jvm configuration. The Common Agent Container is a service and
then run in background. It is not as easy as with console application to get any traces.
There are several methods I've used, here they are, just pick the one you prefer (some are not working on all jdks).
Note that if you are used to use java debugger like the one in NetBeans
it may be useless
for you to read this page :-)
- getting Jvm stack output using truss/strace.
- enabling core file dump on the host.
By default on systems like Solaris, the dump of core file is disabled.
Use this with caution, enabling core file can cause security issue and/or fill up your disk.
It is recommended to set everything back to default after investigation is done.
See coreadm(1M) man page for details.
#coreadm -e log
#coreadm -e process
#coreadm -e global
#coreadm -G all
#coreadm -i /var/tmp/core.%f.%p.%t
#coreadm -g /var/tmp/core.%f.%p.%t
It is even better to only change the configuration for the running jvm.
#coreadm -p /var/tmp/core.%f.%p.%t -P all <jvm pid>
- set core file limit in /etc/profile.
Replace any line like
ulimit -S -c 0 > /dev/null 2>&1
by something like
[ `/usr/bin/id -u` -eq 0 ] && ulimit -c unlimited
- set core file pattern (cf proc(5) fro details)
echo 1 > /proc/sys/kernel/core_uses_pid
echo /var/tmp/core.%f.%p.%t > /proc/sys/kernel/core_pattern
you can also use the systctl command :
sysctl -w kernel.core_pattern=/var/tmp/core.%f.%p.%t
- Setting Jvm error file path in the command line.
Starting from jdk 6 , you are allowed to set the path of the dump file. This is done with the
XX:ErrorFile option. You can then add this to the Common Agent Container java's flags.
#cacaoadm set-param java-flags=-XX:ErrorFile=/var/tmp/myDump `cacaoadm get-param java-flags --value`
- Using DTrace to catch Jvm fault.
Using the fault probe of the Proc provider you can print the stack trace each time the jvm
triggers one. I've wrote a small DTrace script that you can use. For all running Jvms it will
print output like the following on case of failure. In that example I've hacked a jni call to trigger
a segmentation fault. (get the script)
[java: 4213/ 2] experiencing fault <address not mapped to object>, signal 11