Re: Proxy Could not accept new connection

Glyph Lefkowitz <[email protected]>
Newsgroups gmane.comp.python.twisted.web
Message-ID <[email protected]>
On Mon, Aug 10, 2009 at 5:03 PM, dave fowler <[email protected]> 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@Proxy1:~# ulimit
> unlimited
>

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

glyph@nhuvasarim:~$ ulimit
unlimited
glyph@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
model.


> 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:

<
http://twistedmatrix.com/trac/wiki/FrequentlyAskedQuestions#HowdoImakeinputononeconnectionresultinoutputonanother
>

Thanks again!
>

No problem!

_______________________________________________
Twisted-web mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.