Re: [nevow.appserver.NevowSite] Could not accept new connection (EMFILE)

Werner Thie <[email protected]> Thu, 06 Sep 2007 15:04:55 +0200
Newsgroups gmane.comp.python.quotient.dev
Message-ID <[email protected]>
It's always fun to bring in answers to your own questions :-)

Using fstat shows, that the amount of reserved inodes is growing slowly 
but surely up to a point, where it hits the preset ulimit, no additional 
tmp file can be created and is then killing all connections.

But why is this list growing. After staring at nevow/appserver.py and 
cgi.py for some time I deduce that:

- as per the comment in appserver.py:108 the server kills all
   connections while it is blocked stating that it could not open a
   tmp file

- cgi.py uses a UNIX trick when using cgi.FieldStorage() to push the
   field storage value into a tmp file, seek(0) and deleting it
   immediately. This tmp file does not show in the tmp dir when ls is
   used, but remains readable and in existence as long as the embracing
   cgi objects exists and the file is not explicitely closed.
   (see comment in cgi.py:765). I then started to fiddle with gc, namely
   doing a gc.collect() every 10 sec and the fstat count inode count
   remains now at a stable level. I did not investigate if this problem
   is associated with the OpenBSD implementation.

Sorry for being so noisy lately, but this list and its archive helped me 
a lot in the past and probably will help somebody else in future.

Thxs, Werner

Werner Thie wrote:
> Hi all
> 
> I am running into a major problem when running an nevow site with 
> LivePages under low load conditions:
> 
> After some time (non-determininstic), say 7-10 minutes with continous 
> interaction of say 4 clients the server disconnects the clients with no 
> apparent reason and logs a host of
...snip