I want to collect a thread dump when an OutOfMemory error occurs.
I add this option on my run.conf script :
JAVA_OPTS="${JAVA_OPTS} -XX:OnOutOfMemoryError=/bin/kill -3 %p"
But at startup I have :
Unrecognized option: -3
Could not create the Java virtual machine.
I tried with :
JAVA_OPTS="${JAVA_OPTS} -XX:OnOutOfMemoryError=\"/bin/kill -3 %p\""
The result in process launched args is ok :
.... -XX:OnOutOfMemoryError="/bin/kill -3 %p" ....
But the error at startup is the same :
Unrecognized option: -3
Could not create the Java virtual machine.
This is a quoting problem. The
/bin/kill -3 %p
is not sent down as a single string to the JVM by the shell.I would suggest trying single quotes instead (untested):