By ejannett on févr. 05, 2008
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.
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.
- On Solaris :
#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>
- On Linux :
- set core file limit in /etc/profile.
- set core file pattern (cf proc(5) fro details)
sysctl -w kernel.core_pattern=/var/tmp/core.%f.%p.%t
- Setting Jvm error file path in the command line.
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