On Mar 17, 2009, at 10:31 AM, Laszlo Nagy wrote:
Hi Laszlo,
Just a hunch -- are you leaking file handles and eventually running
out?
These file handles are for TCP sockets. They are accept()-ed, used
and then thrown out. I guess after the connection was closed, the
file handle is destroyed automatically. BTW here is the shutdown()
method for socket based endpoints:
def shutdown(self):
try:
self.socket.shutdown(socket.SHUT_RDWR)
except socket.error:
pass
StreamEndpoint.shutdown(self)
This method is called after the connection has been closed. Is is
possible that somehow the file handles are leaking?
Well, anything is possible...it's also possible that file handles are
being leaked elsewhere, by your code or another application. I don't
know socket code very well so my hunch was not so much based on your
code as much as on your general description of the problem. To have
something break after a day of working OK is a common way for a
leaking-resource bug to express itself. Since you're having trouble
with a file handle, it seems logical to conclude that file handles
might be the resource that's being used up.
I had a similar bug in on of my apps and the only reason I found it
was because my Apache logs had "no open file handle" errors. It turned
out that I had a process (unrelated to Apache) that was leaking file
handles at a fixed rate. When the process ended all of the file
handles were returned to the OS. It was only if the process ran for
several days that it would consume all of the available file handles
in the system. And then at some point it would exit and the problem
would magically clear itself up. It was easy to find the broken code
once I realized what was going on.
Like I said, it's just a hunch.
HTH
Philip
--
http://mail.python.org/mailman/listinfo/python-list