[Twisted-Python] twisted run out of file descriptors

Alec Matusis matusis at matusis.com
Tue Oct 26 03:53:55 EDT 2004

My application is a chat, and it has > 1024 simultaneously connected chat
clients at the peak of usage.
I checked the numbers of fds in /proc/PID/fd before, during and after a
client connect- there is no leak, I just have > 1024 people connected...

I was trying to avoid using poll() but I will have to resort to it if there
is no other choice.
Do you know how where to find instructions to change this in glibc ?
I have been looking in Google, but to no avail...


-----Original Message-----
From: twisted-python-bounces at twistedmatrix.com
[mailto:twisted-python-bounces at twistedmatrix.com]On Behalf Of Tommi
Sent: Tuesday, October 26, 2004 12:25 AM
To: Twisted general discussion
Subject: Re: [Twisted-Python] twisted run out of file descriptors

Alec Matusis wrote:

>My chat server has been puking and dying the last couple days and it
>seemed pretty clear that it was dying when it was reaching 1024 open
>file descriptors.
>I noticed the default ulimit -n was 1024, so I added a 'ulimit -n
>4096' before starting the chat server. That has apparently allowed it to
>1024 descriptors (it has 1263 at the moment) but now it is failing to
>call select (see sample errors below).
>There is this value
>FD_SETSIZE in the C headers that determines the maximum number of
>sockets a proc can select() on, and it's set to 1024. It it possible to
>increase this limit, short of recompiling the Kernel?
Yes (in some libcs) but you don't want to play with that thing. Switch
to pollreactor.
Poll has no builtin limits, but will start to get slow after a few
thousand fds.

But, do you know why your app has over a thousand fds open? If there's
no really
good reason, you have a leak and should fix that. A thousand fds is
quite a lot.

Twisted-Python mailing list
Twisted-Python at twistedmatrix.com

More information about the Twisted-Python mailing list