Richard Cook Guest
|
Posted: Fri Mar 05, 2004 10:21 pm Post subject: Problem with signal chaining with IBM JRE 1.4.1 under LInux |
|
|
OK, I know this one is wierd, but here goes.
We're writing a kind of "application server" that can take in
requests, and run rules for the requests coded in Java or C. Since the
C code can be developed by customers or third parties we want to catch
the "bad" signals (SIGSEGV, SIGFPE, maybe others) and restart the
application.
When running C code we install our own signal handler, which if called
sets a flag in C code that says "an error has occured". In Java we
have a watchdog thread that looks at the variable via a JNI call, and
if the flag gets set then runs shutdown code and restarts the
application via a call to _execv.
All this works on Linux with Sun's JVM 1.4.1 by using signal chaining.
When the C code runs normally:
We install our own signal handler, run the C code, then put the old
signal handlers back.
When the C code has a problem:
We install our own signal handler, run the C code that causes a
signal, run the signal handler that sets the flag, don't put back the
old signal handlers.
Running with IBM's JVM 1.4.1 it looks like my signal handler does run,
but after IBM's signal handler, and the application still stops.
Here's the end of the run:
JVMDG217: Dump Handler is Processing a Signal - Please Wait.
JVMDG303: JVM Requesting Java core file
JVMDG304: Java core file written to
/home/rrc/javacore.20040305.132039.3827.txt
JVMDG215: Dump Handler has Processed Exception Signal 11.
XXXC In signal handler.
XXXC Leaving signal handler.
Memory fault
[rrc@atl1lx02 rrc]$
I'm using the signal chaining mentioned at Sun's site, by using the
LD_PRELOAD environment variable.
|
|