Operating System - HP-UX
1819791 Members
3413 Online
109607 Solutions
New Discussion юеВ

EMFILE 24 /* Too many open files*/ error. Please advise

 
SOLVED
Go to solution
Joe Profaizer
Super Advisor

EMFILE 24 /* Too many open files*/ error. Please advise

Does this error mean I need to increase maxfiles or maxfiles_lim. What's the differenct between hard file limit and softfile limit.

I'm on 11.11 and maxfiles_lim is a dynamic parameter.

Thanks,
8 REPLIES 8
Jeff Schussele
Honored Contributor
Solution

Re: EMFILE 24 /* Too many open files*/ error. Please advise

Hi Joe,

I suspect you may have hit the nfile limit, which is still static in 11i.

If so, Id recommend you increase maxusers as by default nfile, nproc & others will be adjusted as well IF nfile is using the default formula.

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
A. Clay Stephenson
Acclaimed Contributor

Re: EMFILE 24 /* Too many open files*/ error. Please advise

This error refers to too-many files open per process and is limited by maxfiles. (Maxfiles_lim is the hard limit and represents the maximum number of open per process file descriptors allowed). Using ulimit -n, you can increase the 'soft' limit up to the 'hard' limit. Man sh_posix and look for ulimit for more details.

Maxfiles is not dynamic and will require a reboot.

If you see errno 23 then nfile will need to be increased.

If it ain't broke, I can fix that.
James R. Ferguson
Acclaimed Contributor

Re: EMFILE 24 /* Too many open files*/ error. Please advise

Hi Joe:

'maxfiles' is called the "soft" limit whereas 'maxfiles_lim" is the "hard" ceiling.

A non-root process is allowed to increase its soft-limit until the hard-limit is reached. Thus, it is expected that 'maxfiles' < 'maxfiles_lim'.

System-wide, 'nfile' comes into play. This is the maximum number of files that can be open simultaneously, overall. Thus, too, 'maxfiles_lim' < 'nfile'.

Regards!

...JRF...
Joe Profaizer
Super Advisor

Re: EMFILE 24 /* Too many open files*/ error. Please advise

Thanks. Is there a way to monitor maxfiles (for instance like i can w/ nfiles in glance -- i.e. #glance -t)
A. Clay Stephenson
Acclaimed Contributor

Re: EMFILE 24 /* Too many open files*/ error. Please advise

Sure, under POSIX shell simply do a ulimit -n w/o args. Remember this is a per process limit.
If it ain't broke, I can fix that.
Bill Hassell
Honored Contributor

Re: EMFILE 24 /* Too many open files*/ error. Please advise

You can change maxfiles in your shell with ulimit -n (well, not ksh, just the POSIX and csh). The maxfiles kernel value is a 'soft' limit so it may be increased before launching a specific process. Or a process may change the limit with a call to setrlimit.

Now the hard limit is maxfiles_lim and this is the ceiling for the maximum number of files opened at the same time for a single process. This is a kernel parameter that will require a reboot to raise this limit.


Bill Hassell, sysadmin
Joe Profaizer
Super Advisor

Re: EMFILE 24 /* Too many open files*/ error. Please advise

If the soft limit of maxfiles is reached at 60, will it climb up to the limit of maxfiles_lim? Or will the process go no further?

maxfiles is set at 60 and maxfiles_lim is 1024

Thanks
A. Clay Stephenson
Acclaimed Contributor

Re: EMFILE 24 /* Too many open files*/ error. Please advise

When the soft limit is reached by a process with a uid of a regular user, then the next open() system call will fail with errno set to EMFILE. If if didn't work like this the soft limit would have no function. However, you can using the POSIX shell as a regular user increase the soft limit by issueing a ulimit -S -n 256 prior to lauching the child process to increase the soft ulimit to 256 open file descriptors but you can't use ulimit to go beyond the hard limit.

It is often necessary to increase maxfiles for non-root users like Oracle or other database users so that a large number of files can be opened.

If it ain't broke, I can fix that.