From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#15983: 24.3; Emacs Not Killing Child Process Date: Wed, 27 Nov 2013 23:02:35 +0200 Message-ID: <8338mha784.fsf@gnu.org> References: <87zjop3fet.fsf@sjm.io> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1385586196 30087 80.91.229.3 (27 Nov 2013 21:03:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 27 Nov 2013 21:03:16 +0000 (UTC) Cc: 15983@debbugs.gnu.org To: sjm@sjm.io Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Nov 27 22:03:21 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VlmGV-0006fq-KW for geb-bug-gnu-emacs@m.gmane.org; Wed, 27 Nov 2013 22:03:19 +0100 Original-Received: from localhost ([::1]:37776 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VlmGV-0003vW-0i for geb-bug-gnu-emacs@m.gmane.org; Wed, 27 Nov 2013 16:03:19 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57289) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VlmGL-0003uF-Bo for bug-gnu-emacs@gnu.org; Wed, 27 Nov 2013 16:03:15 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VlmGF-00039I-At for bug-gnu-emacs@gnu.org; Wed, 27 Nov 2013 16:03:09 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:34056) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VlmGF-00039C-6V for bug-gnu-emacs@gnu.org; Wed, 27 Nov 2013 16:03:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VlmGE-0004tn-LF for bug-gnu-emacs@gnu.org; Wed, 27 Nov 2013 16:03:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 Nov 2013 21:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 15983-submit@debbugs.gnu.org id=B15983.138558617218813 (code B ref 15983); Wed, 27 Nov 2013 21:03:02 +0000 Original-Received: (at 15983) by debbugs.gnu.org; 27 Nov 2013 21:02:52 +0000 Original-Received: from localhost ([127.0.0.1]:48075 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VlmG3-0004tM-KG for submit@debbugs.gnu.org; Wed, 27 Nov 2013 16:02:51 -0500 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:51113) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VlmG0-0004t5-5g for 15983@debbugs.gnu.org; Wed, 27 Nov 2013 16:02:49 -0500 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0MWX00M00WR2QU00@a-mtaout22.012.net.il> for 15983@debbugs.gnu.org; Wed, 27 Nov 2013 23:02:41 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MWX00MR8X4GID80@a-mtaout22.012.net.il>; Wed, 27 Nov 2013 23:02:41 +0200 (IST) In-reply-to: <87zjop3fet.fsf@sjm.io> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:81035 Archived-At: > From: sjm@sjm.io > Date: Wed, 27 Nov 2013 17:47:38 +0000 > > I'm using nrepl.el for Clojure development and am having trouble with > residual Java processes when quitting nrepl.el. > > The process tree that gets spawned looks like this: > > emacs.exe > |_ cmdproxy.exe > |_ cmd.exe > |_ java.exe > |_ java.exe > > The problem is that after nrepl-quit is called, only the parent java.exe > process is killed and I'm left with an orphaned java.exe that I have to > kill manually. > > The code that does the killing looks like this: > > (defun nrepl--close-buffer (buffer) > "Close the nrepl BUFFER." > (when (get-buffer-process buffer) > (delete-process (get-buffer-process buffer))) > (when (get-buffer buffer) > (kill-buffer buffer))) > > The documentation section "37.5 Deleting Processes" says that child > processes get killed but this doesn't seem to be happening for some reason. > > I've spoken with the main developer of nrepl.el and he seems to think it > might be a bug in Emacs. Emacs on Windows can only monitor and kill its immediate subprocesses, it cannot monitor, let alone kill, any of their descendant processes, because it has no idea about them. And the OS doesn't automatically kill all the processes in the subprocess tree, and there's no way to send a signal to them all, as on Posix platforms. If killing the immediate child process doesn't cause some of its children to exit or abort, then those grandchildren will be left orphaned. Why doesn't the child java.exe exit when it parent does? Can you arrange for that to happen? Failing that, I don't think there's a solution to this problem, sorry.