[Twisted-web] Proxy Could not accept new connection

Glyph Lefkowitz glyph at twistedmatrix.com
Mon Aug 10 20:01:52 EDT 2009

On Mon, Aug 10, 2009 at 5:03 PM, dave fowler <davefowler at gmail.com> wrote:

> Glyph, thanks for the great feedback.  I'm looking into all of this now.
> I don't think it's a ulimit issue as it seems to be "unlimited"
> root at Proxy1:~# ulimit
> unlimited

This is a lie that your shell tells you.  Here it is on my computer:

glyph at nhuvasarim:~$ ulimit
glyph at nhuvasarim:~$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 16135
max locked memory       (kbytes, -l) 32
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 16135
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

as you can see, many of those values (specifically, in your case, "open
files") do actually have limits.

> I think my first step will be to just make a log observer that will simply
> restart the proxy script when it sees (EMFILE) so that I don't have to keep
> logging in at night to restart it myself :).

That does sound like a practical measure to take :).

> Thanks for filing that ticket.  It would be great if there were a way to be
> notified of the particular error inside the code.

No problem; I thought it was already filed.

> I like your suggestion of keeping a list of my open connections.  I could
> also keep a time stamp with them and close down the oldest, or any that are
> over a certain time period.

That's what I was thinking; or, maybe something more elaborate, like
associating connections with accounts, and kicking off the most active
connection associated with a non-administrator account, or the one which has
been idle the longest... it depends on your application and desired security

> I'm new to twisted.  Do you know in what object of the Proxy the new
> connections are made and how to access them to store in a list?

The protocol factory is where you'd want to do this.  This FAQ deals with
the main question, I think:


Thanks again!

No problem!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-web/attachments/20090810/792f4fc9/attachment.htm 

More information about the Twisted-web mailing list