From Bugzilla Helper: User-Agent: Opera/7.20 (Windows NT 5.0; U) [en] Description of problem: I am having the following situation. I am starting java app with a lot of threads. I want to kill the app with kill JVM_PID not with signal -9. But when i exec the command kill PID the process does not care and continues execution. I have tested the same thing on RH7.2 with util-linux-2.11f-17.7.2 and kernel 2.4.19 (not RH kernel). I have tryed and on non RH distribution too. On all other machines it works like expected the process exits but on redhat9 it continue working. The system is: RH9 Kernel 2.4.20-20.9smp kernel-2.4.20-20.9 util-linux-2.11y-9 JAVA: java version "1.3.1_09" Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_09-b03) Java HotSpot(TM) Client VM (build 1.3.1_09-b03, mixed mode) downloaded from java.sun.com CPU: Dual processor XEON 2.4 cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 15 model : 2 model name : Intel(R) Xeon(TM) CPU 2.40GHz stepping : 9 cpu MHz : 2387.262 cache size : 512 KB physical id : 0 siblings : 2 fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 2 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm bogomips : 4757.91 processor : 1 vendor_id : GenuineIntel cpu family : 15 model : 2 model name : Intel(R) Xeon(TM) CPU 2.40GHz stepping : 9 cpu MHz : 2387.262 cache size : 512 KB physical id : 0 siblings : 2 fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 2 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm bogomips : 4771.02 processor : 2 vendor_id : GenuineIntel cpu family : 15 model : 2 model name : Intel(R) Xeon(TM) CPU 2.40GHz stepping : 9 cpu MHz : 2387.262 cache size : 512 KB physical id : 3 siblings : 2 fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 2 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm bogomips : 4771.02 processor : 3 vendor_id : GenuineIntel cpu family : 15 model : 2 model name : Intel(R) Xeon(TM) CPU 2.40GHz stepping : 9 cpu MHz : 2387.262 cache size : 512 KB physical id : 3 siblings : 2 fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 2 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm bogomips : 4771.02 The machine is DELL i dont know the exact model. It is updated with all patches available from RH with up2date The other machines i am testing on are single CPU P3 733 and 933 Version-Release number of selected component (if applicable): util-linux-2.11y-9 How reproducible: Always Steps to Reproduce: 1.Write the following class in p.java file: class myThread extends Thread{ public void run(){ System.out.println("start sleeping"); try{ Thread.sleep(100000); } catch(InterruptedException ex){ System.out.println(ex.toString()); } System.out.println("Exit"); } } public class p { public static void main(String[] args) { int i; myThread p; for(i=0;i<=50;i++){ System.out.println("Creating thread -- "+i); p = new myThread(); p.start(); } } } 2. compile the file with javac p.java 3. start it with java p & 4. try to kill the JVM with kill PID_OF_JVM 5. the JVM is still running Actual Results: The results are that the JVM is still running but it should have exited Expected Results: It should exit. Additional info:
Forgot to mention that this all happens if i execute "java p &" as non root user. If i do all of the steps above as root everything is working as expected JVM exits after kill PID_OF_JVM.
Older Java versions are not NPTL friendly. You should update to 1.4.1+ (1.4.2+ is recommended). $ /usr/java/j2re1.4.2/bin/java -showversion java version "1.4.2" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28) Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)
Ok they dont support NPTL threads but does this mean that it should have different behaviour when it is started as root and as regular user.
I believe that the simple nature that the VM is unpredictable with NPTL enabled GLIBC and kernels makes it entirely possible that there would be differences between root and a normal user. Have you upgraded to 1.4.2+ to see if the issue disappears?
Yes it disappears with jdk 1.4.2 but the strange thing is that it dsappears and with jdk1.3.1_08
I am asking about jdk1.3.1_09 because we have an important business apps running on this version of jdk and it would be very heavy work to migrate to 1.4 because a lot of source should be modified. And even if we migrate i guess a lot of problems will come up.
Let's see.. you can LD_ASSUME_KERNEL=2.2.5 to disable NPTL for a piece of software that is not working with NPTL. If that doesn't solve your problem - then your problem is either 1) in YOUR code 2) in SUN's code.
NPTL and older Java impls just don't get along. The fix needs to be done in the Java impls.