Ah, the IBM JDK was holding the signals for the JVM, that explains why
that didn't work (had to use -Xrs).
Works with 2.6:
IBM 1.3.1-6 (with -Xrs)
Sun 1.4.2_03 (no -Xrs)
Does Not Work with 2.6:
Blackdown 1.3.1
Sun 1.3.1_10
Sun 1.3.1_11
Untested:
Blackdown 1.4.x
IBM 1.4.x
Everything tested works fine on a 2.4 kernel.
Attached is the test code that I am using to test the signals.
Feedback welcome... otherwise I am most likely going to test and switch to
the IBM 1.3.1-6 JRE.
Thanks!
-nicole
At 16:52 on Mar 17, nicole shook the earth with:
> The IBM JRE did not appear to catch the signals at all, they get passed
> right through and kill the application.
>
> Once I have something that tests the signals exclusively, hopefully I can
> test all three of the JVMs and see what happens.
>
> At 12:13 on Mar 16, Tony Reix shook the earth with:
>
> > Hi Nicole,
> >
> > { ...
> > { I will be constructing a basic application that just does the signal
> > { handling similar to my application so I can use it to test.
> >
> > Seems your problem is not easy to understand ...
> > Let us know when you have built such a basic application. At that
> > time we'll try to reproduce it there, probably with the Sun or IBM JVMs.
> > Did you try with IBM JVM ?
> >
> > Thanks for helping stabilizing NPTL.
package test;
import sun.misc.Signal;
import sun.misc.SignalHandler;
import java.io.*;
public class SignalTest implements SignalHandler
{
public SignalTest()
{
}
public static void main(String[] args)
{
SignalTest st = new SignalTest();
st.run();
}
public void run()
{
System.out.println("Initializing Signals...");
initSignals();
System.out.println("Signals Initialized.");
System.out.println("I'm going to sit here now while you try to kill me"
+ " (type exit to force quit)");
BufferedReader _input = new BufferedReader(new InputStreamReader(System.in));
String s = "foo";
while(!(s.equals("exit")))
{
try
{
s = _input.readLine();
s = s.trim();
}
catch(java.io.IOException e)
{
System.out.println("oops, I didn't expect that: " + e.toString());
}
}
System.out.println("Exiting on user request.");
System.exit(0);
}
protected void initSignals()
{
try
{
System.out.println("Initializing sig INT");
Signal.handle(new Signal("INT"), this);
}
catch(IllegalArgumentException e)
{
// failed
System.out.println("Signals Caught:" + e.toString());
}
try
{
System.out.println("Initializing sig HUP");
Signal.handle(new Signal("HUP"), this);
}
catch(IllegalArgumentException e)
{
// failed
System.out.println("Signals Caught:" + e.toString());
}
try
{
System.out.println("Initializing sig TERM");
Signal.handle(new Signal("TERM"), this);
}
catch(IllegalArgumentException e)
{
// failed
System.out.println("Signals Caught: " + e.toString());
}
try
{
System.out.println("Initializing sig USR1");
Signal.handle(new Signal("USR1"), this);
}
catch(IllegalArgumentException e)
{
// failed
System.out.println("Signals Caught: " + e.toString());
}
}
public void handle(Signal sig)
{
System.out.println("Caught " + sig.toString() + " ("+sig.getNumber()+")");
if(sig.toString().equals("SIGTERM"))
{
System.out.println("Caught sig TERM, exiting");
System.exit(-1);
}
}
}