Issue2220

classification
Title: Popen.kill does not kill process outside Windows
Type: Severity: normal
Components: Versions: Jython 2.7
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: zyasoft Nosy List: pekka.klarck, zyasoft
Priority: high Keywords:

Created on 2014-10-14.09:41:23 by pekka.klarck, last changed 2015-02-02.16:32:42 by zyasoft.

Messages
msg9144 (view) Author: Pekka Klärck (pekka.klarck) Date: 2014-10-14.09:41:23
On Jython 2.7b3 `Popen.kill` is just an alias for `Popen.terminate`. This is fine on Windows (tested on Win7) where the latter will always kill the process. Elsewhere (tested only on Linux) JVM correctly sends SIGTERM which isn't always enough.

This is highly related to `Popen.send_signal` only supporting SIGTERM currently: http://bugs.jython.org/issue2219
msg9149 (view) Author: Jim Baker (zyasoft) Date: 2014-10-14.17:51:28
Ack, Java 8 supports the necessary functionality in Process#destroyForcibly; Process#destroy in Java 7 has the wrong doc that says it's forcible and therefore SIGKILL on *nix, but actually it's SIGTERM on such systems.

We can check for destroyForcibly being available, then backoff by trying signal with SIGKILL if we have a pid.
msg9154 (view) Author: Pekka Klärck (pekka.klarck) Date: 2014-10-14.22:34:30
Nice to hear Java 8 has destroyForcibly. Popen.kill definitely should always use it when available. If we get send_signal done (#2219), we can easily use `self.send_signal(signal.SIGKILL)` otherwise.
msg9446 (view) Author: Pekka Klärck (pekka.klarck) Date: 2015-01-23.13:42:37
Implemented by this pull request: https://github.com/jythontools/jython/pull/14
msg9450 (view) Author: Jim Baker (zyasoft) Date: 2015-01-23.23:34:32
Fixed as of https://hg.python.org/jython/rev/8e8c19c827fd
History
Date User Action Args
2015-02-02 16:32:42zyasoftsetstatus: pending -> closed
2015-01-23 23:34:32zyasoftsetstatus: open -> pending
resolution: accepted -> fixed
messages: + msg9450
2015-01-23 13:42:37pekka.klarcksetmessages: + msg9446
2015-01-07 06:20:31zyasoftsetassignee: zyasoft
2015-01-07 06:20:24zyasoftsetpriority: normal -> high
2014-10-14 22:34:30pekka.klarcksetmessages: + msg9154
2014-10-14 17:51:38zyasoftsetpriority: normal
resolution: accepted
2014-10-14 17:51:28zyasoftsetnosy: + zyasoft
messages: + msg9149
2014-10-14 09:41:23pekka.klarckcreate