Ben Parker wrote on 01/18/2006 12:45 PM:
Unfortunately, the 3rd party is unstable, and when they have a problem,
sometimes the appserver crashes with this error:
Traceback (most recent call last):
File "WebKit/ThreadedAppServer.py", line 630, in run
File "WebKit/ThreadedAppServer.py", line 156, in mainloop
File "/usr/local/lib/python2.4/socket.py", line 169, in accept
error: (24, 'Too many open files')
If you're keeping the old data then you can simply wrap your 3rd party
call into a try -except statement and use the old data if your update
fails.
I have that already. I think the problem is that the sockets are not
timing out or throwing any error, so the except block never triggers.
I'm going to partially answer my own question here:
Doh! There is no timeout in the Python 2.4 socket module by default. For
some reason I had thought it was 2 mins. I am now calling
socket.setdefaulttimeout in the __init__ of my context to set a default
timeout of 2.5 mins, which causes these connections to time out instead
of consuming all available files.
However, I need to control the timeout value on a per-socket basis. I
don't want to use socket.setdefaulttimeout because of the variety of
requests this application needs to make. There are some that can
tolerate relatively short timeouts (20 secs or so), but there are
critical transactions which could take a couple minutes to return from
the remote server.
A quick check of the socket module reveals that since Python 2.3 one can
set a timeout on a particular socket object. So now I need to find a way
of doing that through urllib2 or httplib or work around it by rolling my
own httplib. I'll post some more info if I get anything going.
In the meantime, if anyone has an application which is setting
per-socket timeouts for https transactions I would be very interested to
hear how you are doing it. :)
- Ben
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Webware-discuss mailing list
Webware-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-discuss