[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: busyloop in sigchld_handler
From: |
Kim F. Storm |
Subject: |
Re: busyloop in sigchld_handler |
Date: |
Sun, 11 Mar 2007 20:39:25 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.95 (gnu/linux) |
Sam Steingold <address@hidden> writes:
> GNU Emacs 22.0.95.2 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of
> 2007-03-11 on loiso
>
> I have been observing the following behavior:
> emacs hangs in sigchld_handler waiting for the child process to
> terminate:
>
> do
> {
> errno = 0;
> pid = wait3 (&w, WNOHANG | WUNTRACED, 0);
> }
> while (pid < 0 && errno == EINTR);
>
> the system stops responding, loadavg goes to 5-8(!), CPU is 100% busy.
> this lasts for ~10 seconds.
> this happens on M-c compile and when I click on a URL (it is passed to
> an existing Firefox).
I've been annoyed by this behaviour for years - but have seen it occasionally
outside Emacs too, so I didn't expect it to be a problem in Emacs.
> I fixed the problem with the following patch:
Absolutely brilliant! I can confirm that it works.
But can you explain why it works?
And why the problem primarily hit M-x compile.
Does the fix cause a 1 second delay for other sub-processes ?
>
> Index: process.c
> ===================================================================
> RCS file: /sources/emacs/emacs/src/process.c,v
> retrieving revision 1.500
> retrieving revision 1.501
> diff -u -w -u -b -w -i -B -r1.500 -r1.501
> --- process.c 1 Mar 2007 10:17:41 -0000 1.500
> +++ process.c 11 Mar 2007 18:16:50 -0000 1.501
> @@ -6497,6 +6497,7 @@
> /* Keep trying to get a status until we get a definitive result. */
> do
> {
> + sleep (1);
> errno = 0;
> pid = wait3 (&w, WNOHANG | WUNTRACED, 0);
> }
--
Kim F. Storm <address@hidden> http://www.cua.dk
- busyloop in sigchld_handler, Sam Steingold, 2007/03/11
- Re: busyloop in sigchld_handler,
Kim F. Storm <=
- Re: busyloop in sigchld_handler, Sam Steingold, 2007/03/11
- Re: busyloop in sigchld_handler, Eli Zaretskii, 2007/03/11
- Re: busyloop in sigchld_handler, Sam Steingold, 2007/03/11
- Re: busyloop in sigchld_handler, Eli Zaretskii, 2007/03/11
- Re: busyloop in sigchld_handler, Sam Steingold, 2007/03/11
- Re: busyloop in sigchld_handler, Richard Stallman, 2007/03/12
- Re: busyloop in sigchld_handler, David Kastrup, 2007/03/12