GNU bug report logs -
#1112
23.0.60; Child process not cleaned up properly
Previous Next
Reported by: "Brent Goodrick" <bgoodr <at> gmail.com>
Date: Tue, 7 Oct 2008 15:25:03 UTC
Severity: normal
Tags: wontfix
Done: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 1112 in the body.
You can then email your comments to 1112 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#1112
; Package
emacs
.
Full text and
rfc822 format available.
Acknowledgement sent to
"Brent Goodrick" <bgoodr <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
Full text and
rfc822 format available.
Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):
Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.
Your bug report will be posted to the emacs-pretest-bug <at> gnu.org mailing list.
Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:
1. M-x compile
2. Enter in: sudo apt-get install gimp-help-en
3. See the apt-get prompt:
Reading package lists... 0%
<snip>
The following extra packages will be installed:
gimp-help-common
The following NEW packages will be installed:
gimp-help-common gimp-help-en
0 upgraded, 2 newly installed, 0 to remove and 1 not upgraded.
Need to get 15.9MB of archives.
After this operation, 27.5MB of additional disk space will be used.
Do you want to continue [Y/n]?
4. Kill the buffer, and expect the underlying process to die, just
like you would have if you had typed the above command in a shell
buffer.
5. Open up a shell, and type ps to see that the apt-get process still
exists
6. Go through step 1 again and notice now that a lock is being
reported by the second apt-get session because the first process
was not properly torn down by the act of killing the previous
compilation buffer.
My assessment: The shell mode somehow works differently than the
compilation mode since the compilation mode does not allow user
input. Fair enough, but the two modes should work the same in terms of
tearing down the two processes if the buffers are killed, and should
not ever leave dormant child processes.
If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
`bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/home/brentg/emacs_from_source/install/share/emacs/23.0.60/etc/DEBUG
for instructions.
Emacs did not crash.
In GNU Emacs 23.0.60.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.12.11)
of 2008-10-03 on hungover
Windowing system distributor `The X.Org Foundation', version 11.0.10402000
configured using `configure '--with-x-toolkit' '--with-xft'
'--prefix=/home/brentg/emacs_from_source/install''
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: en_US.UTF-8
value of $XMODIFIERS: nil
locale-coding-system: utf-8-unix
default-enable-multibyte-characters: t
Major mode: Apropos
Minor modes in effect:
desktop-save-mode: t
iswitchb-mode: t
erc-services-mode: t
erc-networks-mode: t
display-time-mode: t
shell-dirtrack-mode: t
delete-selection-mode: t
mouse-wheel-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
global-auto-composition-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: 1
transient-mark-mode: t
Recent input:
o m p i <return> C-1 d C-x h <backspace> <return> M-P
<return> C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p
C-p C-a C-n C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f
C-f C-b C-b C-M-SPC C-z M-> C-4 M-P <return> k i l
l C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-a
C-n C-n C-n C-n C-p C-p C-p C-p C-n C-f C-f C-f C-f
C-f C-f C-f C-f C-f C-M-SPC C-z M-> SPC C-v C-a <return>
M-P C-a s u d i <backspace> o SPC <return> C-4 M-P
C-k C-g C-v <return> C-1 C-c d p s f <return> C-r a
p t - C-g C-g M-> a p t = g e t <backspace> <backspace>
<backspace> <backspace> <C-backspace> C-r a p t - g
e t C-g C-f M-> M-x a p r o <tab> <return> p t y <backspace>
t y <backspace> <backspace> y <return> C-x o C-s c
o m i n t C-b <return> C-x o C-M-SPC C-z C-c d C-x
h <backspace> M-P SPC | SPC g r e p SPC a p t - g e
t <return> M-x M-P C-g C-4 M-p <return> C-x o M-: C-v
<return> <down-mouse-1> <mouse-1> C-1 M-P <return>
s u d o SPC k i l l SPC a p t = <backspace> - g e t
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> 1 2 2 5 <backspace> 6 0 <return>
M-x a p r o <tab> <return> e m a c s . * f <backspace>
b u g <return> C-x o C-n C-n C-n C-n C-n C-n C-n C-n
C-n C-n <return> M-x r e p o r t - e m a c s = <backspace>
- b u g <tab> <return>
Recent messages:
Not applicable. It is repeatable.
Information forwarded to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#1112
; Package
emacs
.
Full text and
rfc822 format available.
Acknowledgement sent to
Chong Yidong <cyd <at> stupidchicken.com>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
Full text and
rfc822 format available.
Message #10 received at 1112 <at> emacsbugs.donarmstrong.com (full text, mbox):
> 1. M-x compile
> 2. Enter in: sudo apt-get install gimp-help-en
> 4. Kill the buffer, and expect the underlying process to die
> 5. Open up a shell, and type ps to see that the apt-get process still
> exists
I suspect Emacs may fail to kill the process due to insufficient
permissions: it's a sudo process.
If you run Emacs with sudo, does the same problem appear?
Information forwarded to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#1112
; Package
emacs
.
Full text and
rfc822 format available.
Acknowledgement sent to
Sven Joachim <svenjoac <at> gmx.de>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
Full text and
rfc822 format available.
Message #15 received at 1112 <at> emacsbugs.donarmstrong.com (full text, mbox):
On 2008-10-07 17:15 +0200, Brent Goodrick wrote:
> 1. M-x compile
> 2. Enter in: sudo apt-get install gimp-help-en
> 3. See the apt-get prompt:
> Reading package lists... 0%
> <snip>
> The following extra packages will be installed:
> gimp-help-common
> The following NEW packages will be installed:
> gimp-help-common gimp-help-en
> 0 upgraded, 2 newly installed, 0 to remove and 1 not upgraded.
> Need to get 15.9MB of archives.
> After this operation, 27.5MB of additional disk space will be used.
> Do you want to continue [Y/n]?
> 4. Kill the buffer, and expect the underlying process to die, just
> like you would have if you had typed the above command in a shell
> buffer.
Won't work for processes run under sudo, see below.
> 5. Open up a shell, and type ps to see that the apt-get process still
> exists
> 6. Go through step 1 again and notice now that a lock is being
> reported by the second apt-get session because the first process
> was not properly torn down by the act of killing the previous
> compilation buffer.
>
> My assessment: The shell mode somehow works differently than the
> compilation mode since the compilation mode does not allow user
> input. Fair enough, but the two modes should work the same in terms of
> tearing down the two processes if the buffers are killed, and should
> not ever leave dormant child processes.
The real problem is that sudo is suid root and thus the compilation
process runs with superuser rights. Emacs is simply lacking the
privileges to kill it.
You can try something similar in your shell:
,----
| % sudo sleep 1000 &
| [1] 2186
| % kill %1
| kill: kill %1 failed: operation not permitted
| % sudo kill $(pidof sleep)
| [1] + 2186 terminated sudo sleep 1000
| %
`----
Sven
Information forwarded to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#1112
; Package
emacs
.
Full text and
rfc822 format available.
Acknowledgement sent to
"Brent Goodrick" <bgoodr <at> gmail.com>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
Full text and
rfc822 format available.
Message #20 received at 1112 <at> emacsbugs.donarmstrong.com (full text, mbox):
Hi Sven,
I agree about the part about the process permissions: Emacs definitely
cannot kill the process because it is a sudo process. However, if
Emacs fails to kill the process, Emacs should emit a warning message
as to the reason why the process could not be killed (e.g., "process
id 12345 could not be killed: operation not permitted"). This would
be appropriate in the case where the user kills the process buffer on
a long running process (a process that is not attempting to read from
standard input as this one is; see next paragraph). This warning is
appropriate because otherwise, the user thinks that the process died
on its own and will have to discover the hard way via some degree of
head-scratching that the process could not be killed.
There is more to this problem than process permissions. The process
has opened up standard input for the Y/N prompt. When I run
compilation mode on some process, I expect no user prompts (if I
wanted to handle prompts,I would execute it under the ever so handy
shell mode). But, when that process does read standard input for
prompting, I want that process to exit immediately (and most well
behaved apps do this these days, with the exception of Bourne shell
scripts using the "read" operator which doesn't behave correctly IMO).
As a proof of concept, when I type "sudo apt-get some_package <
/dev/null" into a M-x compile prompt, I see reasonable behavior:
<snip>
After this operation, 27.5MB of additional disk space will be used.
Do you want to continue [Y/n]? Abort.
Compilation exited abnormally with code 1 at Wed Oct 8 07:18:54
So, is there any harm in having compilation mode close standard input
when it spawns any and all processes (perhaps only under the direction
of a customizable and properly documented defvar variable so as to
avoid backlash from users expecting the existing behavior)? If so,
this would fix this issue in the majority of cases. Actually, this
closing of standard input should be an option on the lowest level
Elisp command that compile uses to start processes, if it is not
already exposed as such: I imagine that having to hack this into the
compile mode Elisp code itself would be problematic given that the "<
/dev/null" construct would have to vary quite a bit on the two axes of
type of shell and execution platform.
Thanks,
Brent
On Tue, Oct 7, 2008 at 12:24 PM, Sven Joachim <svenjoac <at> gmx.de> wrote:
>
> On 2008-10-07 17:15 +0200, Brent Goodrick wrote:
>
> > 1. M-x compile
> > 2. Enter in: sudo apt-get install gimp-help-en
> > 3. See the apt-get prompt:
> > Reading package lists... 0%
> > <snip>
> > The following extra packages will be installed:
> > gimp-help-common
> > The following NEW packages will be installed:
> > gimp-help-common gimp-help-en
> > 0 upgraded, 2 newly installed, 0 to remove and 1 not upgraded.
> > Need to get 15.9MB of archives.
> > After this operation, 27.5MB of additional disk space will be used.
> > Do you want to continue [Y/n]?
> > 4. Kill the buffer, and expect the underlying process to die, just
> > like you would have if you had typed the above command in a shell
> > buffer.
>
> Won't work for processes run under sudo, see below.
>
> > 5. Open up a shell, and type ps to see that the apt-get process still
> > exists
> > 6. Go through step 1 again and notice now that a lock is being
> > reported by the second apt-get session because the first process
> > was not properly torn down by the act of killing the previous
> > compilation buffer.
> >
> > My assessment: The shell mode somehow works differently than the
> > compilation mode since the compilation mode does not allow user
> > input. Fair enough, but the two modes should work the same in terms of
> > tearing down the two processes if the buffers are killed, and should
> > not ever leave dormant child processes.
>
> The real problem is that sudo is suid root and thus the compilation
> process runs with superuser rights. Emacs is simply lacking the
> privileges to kill it.
>
> You can try something similar in your shell:
>
> ,----
> | % sudo sleep 1000 &
> | [1] 2186
> | % kill %1
> | kill: kill %1 failed: operation not permitted
> | % sudo kill $(pidof sleep)
> | [1] + 2186 terminated sudo sleep 1000
> | %
> `----
>
> Sven
Tags added: wontfix
Request was from
Chong Yidong <cyd <at> stupidchicken.com>
to
control <at> emacsbugs.donarmstrong.com
.
(Wed, 29 Oct 2008 21:55:04 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
1112 <at> debbugs.gnu.org and "Brent Goodrick" <bgoodr <at> gmail.com>
Request was from
Lars Magne Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Tue, 02 Aug 2011 16:04:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 31 Aug 2011 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 13 years and 355 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.