bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#15983: 24.3; Emacs Not Killing Child Process


From: Eli Zaretskii
Subject: bug#15983: 24.3; Emacs Not Killing Child Process
Date: Wed, 27 Nov 2013 23:02:35 +0200

> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]