all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: sjm@sjm.io
Cc: 15983@debbugs.gnu.org
Subject: bug#15983: 24.3; Emacs Not Killing Child Process
Date: Wed, 27 Nov 2013 23:02:35 +0200	[thread overview]
Message-ID: <8338mha784.fsf@gnu.org> (raw)
In-Reply-To: <87zjop3fet.fsf@sjm.io>

> 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.





  reply	other threads:[~2013-11-27 21:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-27 17:47 bug#15983: 24.3; Emacs Not Killing Child Process sjm
2013-11-27 21:02 ` Eli Zaretskii [this message]
2013-12-19 15:44 ` Joan Karadimov
2013-12-19 15:56   ` bug#15983: Fw: " Bozhidar Batsov
2013-12-19 17:24   ` Eli Zaretskii
2013-12-20 22:28     ` Joan Karadimov
2013-12-21  8:15       ` Eli Zaretskii
2013-12-21 16:22         ` Joan Karadimov
2013-12-21 18:38           ` Eli Zaretskii
2013-12-22  2:03             ` Joan Karadimov
2013-12-22  3:53               ` Eli Zaretskii
2013-12-23 16:02                 ` Joan Karadimov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8338mha784.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=15983@debbugs.gnu.org \
    --cc=sjm@sjm.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.