24: Too many open files

Hi. Hope someone can answer which open file limit is being reached
(doesn’t seem right to me)

tail error.log
2011/04/01 15:43:46 [alert] 18945#0: accept() failed (24: Too many open
files)
2011/04/01 15:43:46 [alert] 18945#0: accept() failed (24: Too many open
files)
2011/04/01 15:43:46 [alert] 18945#0: accept() failed (24: Too many open
files)
2011/04/01 15:43:46 [alert] 18945#0: accept() failed (24: Too many open
files)
2011/04/01 15:43:46 [alert] 18945#0: accept() failed (24: Too many open
files)
2011/04/01 15:43:46 [alert] 18945#0: accept() failed (24: Too many open
files)
2011/04/01 15:43:46 [alert] 18945#0: accept() failed (24: Too many open
files)

lsof -n | wc -l
4321

cat /proc/sys/fs/file-max
1645538

ulimit -n
1000000

Why it the limit being reached?

Many thanks
Richard

Hi,

Why it the limit being reached?

Check “worker_rlimit_nofile” directive.

Best regards,
Piotr S. < [email protected] >

write the ulimit number into profile file. then source it.

blog: http://chenxiaoyu.org

On Fri, Apr 1, 2011 at 11:58 PM, Richard K.
<[email protected]

Do you have a example?
What will this do?

From: smallfish [mailto:[email protected]]
Sent: 01 April 2011 17:07
To: [email protected]
Subject: Re: 24: Too many open files

write the ulimit number into profile file. then source it.

blog: http://chenxiaoyu.org

On Fri, Apr 1, 2011 at 11:58 PM, Richard K.
<[email protected]mailto:[email protected]> wrote:
Hi. Hope someone can answer which open file limit is being reached
(doesn’t seem right to me)

tail error.log
2011/04/01 15:43:46 [alert] 18945#0: accept() failed (24: Too many open
files)
2011/04/01 15:43:46 [alert] 18945#0: accept() failed (24: Too many open
files)
2011/04/01 15:43:46 [alert] 18945#0: accept() failed (24: Too many open
files)
2011/04/01 15:43:46 [alert] 18945#0: accept() failed (24: Too many open
files)
2011/04/01 15:43:46 [alert] 18945#0: accept() failed (24: Too many open
files)
2011/04/01 15:43:46 [alert] 18945#0: accept() failed (24: Too many open
files)
2011/04/01 15:43:46 [alert] 18945#0: accept() failed (24: Too many open
files)

lsof -n | wc -l
4321

cat /proc/sys/fs/file-max
1645538

ulimit -n
1000000

Why it the limit being reached?

Many thanks
Richard

Hi
Thanks for the reply.

The only references to worker in my config are:

worker_processes 4;
events
{
worker_connections 4096;
}

I read in nginx wiki if worker_rlimit_nofile is not defined, the value
from ulimit -n is used?

On Fri, Apr 01, 2011 at 04:08:30PM +0000, Richard K. wrote:

I read in nginx wiki if worker_rlimit_nofile is not defined, the value from
ulimit -n is used?

“ulimit -n” sets/shows the limit of you current login session.
If you run nginx in this session, it will inherit this value.
If it run at bootstrap or something else the limit may be other.
The simplest way is to set it in nginx.conf:

worker_processes 4;
worker_rlimit_nofile 100000;


Igor S.
http://sysoev.ru/en/

Hi
Thank you, I will try this.

Can anyone shed any light?
It really hurts at peak time :slight_smile:

If this is on a linux host. “cat /proc//status”.

Look at value for FDSize.

Sridhar

On Fri, Apr 1, 2011 at 4:58 PM, Richard K.