unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Slawomir Nowaczyk <slawomir.nowaczyk.847@student.lu.se>
Subject: Re: Running two processes rapidly makes Emacs eat 100% CPU on w32
Date: Thu, 12 Oct 2006 15:52:20 +0200	[thread overview]
Message-ID: <20061012145009.C39D.SLAWOMIR.NOWACZYK.847@student.lu.se> (raw)
In-Reply-To: <E1GXy5v-0001UH-BU@fencepost.gnu.org>

On Thu, 12 Oct 2006 06:47:19 -0400
Eli Zaretskii <eliz@gnu.org> wrote:

#> > Date: Thu, 12 Oct 2006 10:44:48 +0200
#> > From: Slawomir Nowaczyk <slawomir.nowaczyk.847@student.lu.se>
#> > 
#> > What is the best way to debug such problem?
#> 
#> Try to figure out what happens inside w32proc.c:sys_select would be a
#> beginning, I think. There are already quite a few DebPrint statements
#> in that function; compiling with EMACSDEBUG defined will activate
#> them. You should be able to see the strings emitted by DebPrint with
#> any debugger; or you can install DbgView as a lightweight solution.

Thanks for the advice, I managed to activate DebPrint. I have added one
which prints the return value of w32proc:sys_select, and it is "1"
consistently. None of the DebPrint statements already present in this
function gets executed, neither in normal work nor when Emacs eats all
the CPU.

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.

Anyway, the log of DebPrints looks like this:

return 1                                           ;; this part corresponds to correctly working emacs
return 1
...
return 1                                           ;; there are a couple (1-10) of those per second
return 1
                                                   ;; now I executed (progn (start-process "" nil "ls") (call-process "ls"))
"select waiting on child 0 fd 3"
"select calling SIGCHLD handler for pid 1668"      ;; observe that this line only happens ONCE
return 1                                           
"select waiting on child 0 fd 3"                   ;; and this repeats, thousands of times per second
return 1                                           ;;    I got about 40.000 of those in 7 seconds
"select waiting on child 0 fd 3"
return 1
...
"select waiting on child 0 fd 3"
return 1

#> Once you have this in place, add DebPrint as needed to see what is
#> going on there.

w32proc:sys_select is much too complex for me to understand quickly. I
will try to look at the code and do some more debugging tomorrow evening
if I have time...

In the meantime, if anyone has any ideas as to where would be a good
place to put some DebPrint statements, I would be grateful.

-- 
 Best wishes,
   Slawomir Nowaczyk
     ( slawomir.nowaczyk.847@student.lu.se )

I plan on living forever. So far, so good.

  reply	other threads:[~2006-10-12 13:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-12  8:44 Running two processes rapidly makes Emacs eat 100% CPU on w32 Slawomir Nowaczyk
2006-10-12 10:47 ` Eli Zaretskii
2006-10-12 13:52   ` Slawomir Nowaczyk [this message]
2006-10-13 15:50     ` Eli Zaretskii
2006-10-14  7:53       ` Slawomir Nowaczyk
2006-10-27 21:36       ` Slawomir Nowaczyk
2006-11-03 21:11         ` Slawomir Nowaczyk
2006-11-04  3:37           ` Chong Yidong

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=20061012145009.C39D.SLAWOMIR.NOWACZYK.847@student.lu.se \
    --to=slawomir.nowaczyk.847@student.lu.se \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).