[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 100% CPU on TCP servers
From: |
Kim F. Storm |
Subject: |
Re: 100% CPU on TCP servers |
Date: |
Wed, 12 Oct 2005 17:07:00 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
Jason Rumney <address@hidden> writes:
> Juanma Barranquero <address@hidden> writes:
>
>> (A question for process-savvy people)
>>
>> It seems like
>>
>>> (make-network-process :name "test" :server t :service t)
>>
>> on Windows makes the server process to call server_accept_connection()
>> continuously (in a 2.8 GHz Pentium IV I've measured around 10,200
>> calls in 3,5 s, almost 2,900 calls per second). It's no wonder Emacs
>> is munching 50% CPU.
>>
>> Any idea why that can be happening?
>
> Probably a bug in sys_select() in w32proc.c
I investigate it a little bit and found that it seems that w32 server
sockets must use WSAAsyncSelect + FD_ACCEPT to request notifications
of incoming connections -- but exactly how that is done is not for me
to look at...
In its current form, it sys_select says the socket is ready, so we
call server_accept_connection which again calls accept() which returns
-1 with errno == WSAEWOULDBLOCK (10035) indicating that there is no
pending connection to accept.
Can somebody pls. look into doing this the right way?
--
Kim F. Storm <address@hidden> http://www.cua.dk
- Re: 100% CPU on TCP servers,
Kim F. Storm <=