JDK-4686280 : Process.destroy() method behavior is not guarnateed on Unixes
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 1.3.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_8
  • CPU: sparc
  • Submitted: 2002-05-16
  • Updated: 2002-05-17
  • Resolved: 2002-05-17
Related Reports
Duplicate :  
Description
When running external projects via Runtime.exec() method on Unixes, sometimes it cannot be terminated via Process.destroy() method. I was looking at the sources of JVM and discovered, that destroy() method delegates to JNI call, which then call kill() system call, but uses SIGTERM as signal.

This unfortunately does not have to kill the process, so there is actually no way how to guarantee the spawned process can be terminated uncoditionaly.

So I suggest to either to change signal to SIGKILL or to define several levels of destroying process in Java, in which the highest level would send SIGKILL, the lower SIGTERM, etc ...