server bootstrapping upon connection (WARNING: LONG)

Benjamin Han this at is.for.spambot
Wed Feb 11 22:47:58 CET 2004

On 2004-02-11 14:50:02 -0500, Alan Kennedy <alanmk at> said:

> [ralf at]
>>>>> I just wanted to say, that even if the server is
>>>>> listening on that port, that connection attempts may fail.
> [Benjamin Han]
>>>> How is it possible? Could you explain a bit more?
> [Krzysztof Stachlewski]
>>> Your server may be accepting connections slower than
>>> the speed at which new connections are coming.
>>> In such situation your operating system maintains a list
>>> of those awaiting connections. You can control the length of
>>> this list with the "backlog" parameter of the "listen" function.
>>> If the list is full, new connections may simply be dropped
>>> as if the server was not listening at all.
> [Benjamin Han]
>> Thanks for the tip - the default queue size is 5. I've since changed it
>> into 100 (much more than what it actually needs), but the original
>> problem remains.
> Another quick point: even if you set the backlog to 100 connections,
> that only gives you 3.3333r seconds of grace before the backlog of
> connections fills up, given the "up to 30 connections/second" you
> mentioned in another message.
> The 101st client to attempt a connect() will fail, if the server
> doesn't start accept()ing connections before the backlog fills up.
> HTH,

The server is threaded, so it only takes fractions of a sec to finish 
off a request. Actually from the log once the server is up there is 
nothing I can see which could fill the entire queue (even if with a 
much smaller size).

My hunch is that the problem is somewhere else. First I can't still 
account for the discrepancy between the server log file and ps log 
file: the former told me only one server instance has been started, but 
the later showed from time to time a second instance had indeed been 
fired up (with state "RV" listed in the log file).

BTW I use this simple line in bash to collec the ps log:

while [ '1' = '1' ] ; do ps awx | grep python | grep -v grep>> ps.log ; 
echo --- >> ps.log ; done

I don't suppose this could interfere anything?

More information about the Python-list mailing list