[Top][All Lists]

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

Re: Running two processes rapidly makes Emacs eat 100% CPU on w32

From: Slawomir Nowaczyk
Subject: Re: Running two processes rapidly makes Emacs eat 100% CPU on w32
Date: Sat, 14 Oct 2006 09:53:01 +0200

On Fri, 13 Oct 2006 17:50:35 +0200
Eli Zaretskii <address@hidden> wrote:

#> > Your guess that sys_select is to be blamed was likely correct, though,
#> > as (under normal circumstances) my newly added DebPrint executes a
#> > couple of times per second, while after I execute the problematic code,
#> > it gets called thousands of times per second.
#> > 
#> > There were two DebPrint statements guarded by FULL_DEBUG, but I have
#> > activated those as well. Now the one from line 1175:
#> >            DebPrint (("select waiting on child %d fd %d\n",
#> >                       cp-child_procs, i));
#> > keeps printing "select waiting on child 0 fd 3" (thousands of times per
#> > second, every time sys_select is called.
#> Looks like somehow Emacs doesn't pay attention that the process
#> exited, and keeps trying to read its pipe. Do you agree with this
#> conclusion?

Possibly... I didn't have time yet to delve into sys_select and
understand what it does, but I have noticed that executing
(start-process "" nil "sleep" "5") makes several "select waiting on
child 0 fd 3" lines and one "select calling SIGCHLD handler for pid
4616" appear in the log, while executing (call-process "sleep" nil
nil nil "5") does not (no output other than "sys_select returned 1"

I do not know what sys_select does differently for call-process than for
start-process, will look into it. For now, however, my idea is that if
the process started by start-process exits while emacs is waiting for
one started by call-process, the code gets confused in some way and
continues waiting, instead of doing whatever it is supposed to do. When
later the other process exits and emacs has nothing else to wait for,
the 100% CPU behaviour happens... Does it make sense?

One additional thing:
 (progn (start-process "" nil "sleep" "10") (call-process "sleep" nil nil nil  
works OK, while
 (progn (start-process "" nil "sleep"  "5") (call-process "sleep" nil nil nil 
makes emacs eat 100% CPU (but only after 10 seconds, not after 5) -- which 
seems to
confirm my theory, doesn't it?

 Best wishes,
   Slawomir Nowaczyk
     ( address@hidden )

Some mistakes are too much fun to only make once.

reply via email to

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