Unicorn 3.3.1 "Too many open files" error in kgio_tryaccept

Eric Wong normalperson at yhbt.net
Thu Jan 13 21:47:53 EST 2011

ghazel at gmail.com wrote:
> On Thu, Jan 13, 2011 at 3:06 PM, Eric Wong <normalperson at yhbt.net> wrote:
> > ghazel at gmail.com wrote:
> > How does lsof output look for your workers?
> Hm. The workers seem to be at 80-90 file descriptors each. I did catch
> one at 787 (!) with mostly handles to a geoip database from the geoip
> gem, but they got collected pretty quickly. Perhaps that's the cause!

OK, that's a fairly likely cause of EMFILE.

A tip for geoip users:

  Install the io-extra gem to get IO.pread.  This allows you to reuse
  the same file descriptor with geoip automatically between any number
  of threads/processes without reopening it.

> > Does this happen with 3.3.0?
> I've only seen it once. If I manage to reproduce it I'll try with 3.3.0.

The 3.3.x series generates less garbage than previous versions, so
it could be causing the GC to run less frequently and increase
the chance of the GC failing to collect descriptors.

Eric Wong

More information about the mongrel-unicorn mailing list