# Strange 'too many open files' errors with nginx 0.6.32

**URL:** <https://www.ruby-forum.com/t/strange-too-many-open-files-errors-with-nginx-0-6-32/153450>\
**Category:** NGINX\
**Created:** [November 17, 2008, 11:54am UTC](https://www.ruby-forum.com/t/strange-too-many-open-files-errors-with-nginx-0-6-32/153450 "2008-11-17T11:54:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arash\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/b19c9b/32.png) [@Arash\_F](https://www.ruby-forum.com/u/Arash_F)\
**Post date:** [November 17, 2008, 11:54am UTC](https://www.ruby-forum.com/t/strange-too-many-open-files-errors-with-nginx-0-6-32/153450/1 "2008-11-17T11:54:59Z")

</div>

hi,i’m seeing a strange ‘too many open files’ error with nginx (which  
I’m  
sure many of you have seen before):

2008/11/17 02:15:02 [alert] 21748#0: accept() failed (24: Too many open  
files) while accepting new connection on 67.228.78.114:80

strangely enough, I have the following line in /etc/security/limits:

- hard nofile 524288

and ulimit -n returns the same number. I have 2 workers set to a max  
of 262144 connections. upon receiving that error (and after  
past occurrences) I’ve run lsof and gotten \< 10k sockets. additionally,  
I  
have a nearly identically configured machine (running twisted) where  
each  
process is handling ~15k connections. so I’m a loss as to what’s going  
on  
here (and suspect some subtle bug in nginx or in my server  
configuration.  
any help would be greatly appreciated!

---

<div class="post-metadata">

**Author:** ![Arash\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/b19c9b/32.png) [@Arash\_F](https://www.ruby-forum.com/u/Arash_F)\
**Post date:** [November 17, 2008, 12:00pm UTC](https://www.ruby-forum.com/t/strange-too-many-open-files-errors-with-nginx-0-6-32/153450/2 "2008-11-17T12:00:18Z")

</div>

oh, and one more thing, restarting nginx seems to fix everything (until  
the  
error pops up again a day or so later 🙂

---

<div class="post-metadata">

**Author:** ![Arash\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/b19c9b/32.png) [@Arash\_F](https://www.ruby-forum.com/u/Arash_F)\
**Post date:** [November 17, 2008, 12:03pm UTC](https://www.ruby-forum.com/t/strange-too-many-open-files-errors-with-nginx-0-6-32/153450/3 "2008-11-17T12:03:15Z")

</div>

Hi there,

Add

worker\_rlimit\_nofile 10240;

to your nginx configuration should fix this problem

Regards,

Glen L.

From: removed\_email\_address@domain.invalid [[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of  
Arash F.  
Sent: 17 Nopember 2008 17:50  
To: removed\_email\_address@domain.invalid  
Subject: Re: strange ‘too many open files’ errors with nginx 0.6.32

oh, and one more thing, restarting nginx seems to fix everything (until  
the  
error pops up again a day or so later 🙂

On Mon, Nov 17, 2008 at 2:48 AM, Arash F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

hi,

i’m seeing a strange ‘too many open files’ error with nginx (which I’m  
sure  
many of you have seen before):

2008/11/17 02:15:02 [alert] 21748#0: accept() failed (24: Too many open  
files) while accepting new connection on 67.228.78.114:80

strangely enough, I have the following line in /etc/security/limits:

- hard nofile 524288

and ulimit -n returns the same number. I have 2 workers set to a max of  
262144 connections. upon receiving that error (and after past  
occurrences)  
I’ve run lsof and gotten \< 10k sockets. additionally, I have a nearly  
identically configured machine (running twisted) where each process is  
handling ~15k connections. so I’m a loss as to what’s going on here (and  
suspect some subtle bug in nginx or in my server configuration. any help  
would be greatly appreciated!

–  
Arash F.  
CTO, Dropbox  
913.707.5875 (m)
