1837896 Members
3326 Online
110122 Solutions
New Discussion

Java:open files error

 
joe_91
Super Advisor

Java:open files error

Here is the error from syslog

syslog: Java: Number of open files: 1024
Jun 5 08:17:32 syslog: Java: Maximum number of allowed open files: 1024

The current nfile setting is 50000. maxfiles and maxfiles_lim are both 2048.

Does this require a kernel parm change. I can't think of any other parameter for these open files error. no other error in syslog. Please advise.

Thanks

Joe

16 REPLIES 16
Sandman!
Honored Contributor

Re: Java:open files error

Looks like you will have to drop the maxfile limit from 2048 to 1024 for the particular user who own the java processes. nfile can stay the same as it is system-wide while maxfile and maxfiles_lim are soft and hard limits on a per process basis.
Steven E. Protter
Exalted Contributor

Re: Java:open files error

Shalom,

Yes it probably requires a kernel change.

Check maxuprc

Thats probably the problem.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
A. Clay Stephenson
Acclaimed Contributor

Re: Java:open files error

It's possible that a ulimit has been issued which has reduced the per process maximum number of files. Normally, you should set maxfiles_lim > maxfiles.

Before invoking java, issue a
ulimit -Sn
and ulimit -Hn
to display the soft and hard limits, respectively.

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

Re: Java:open files error

Is the an ulimit set for the user executing the java program?


Jov

joe_91
Super Advisor

Re: Java:open files error

current ulimit settings as follows

# ulimit -Sa
time(seconds) unlimited
file(blocks) unlimited
data(kbytes) 2015464
stack(kbytes) 8192
memory(kbytes) unlimited
coredump(blocks) 4194303

# ulimit -Ha
time(seconds) unlimited
file(blocks) unlimited
data(kbytes) 2015464
stack(kbytes) 8192
memory(kbytes) unlimited
coredump(blocks) unlimited

Also clay, ulimit -Sn and ulimit -Hn, is that the correct command?

Thanks

Joe
joe_91
Super Advisor

Re: Java:open files error

Shalom Steve:

The maxuprc is set at 2550. I am not sure where it thinks the open files for java is set to 1024.

Thanks

Joe.
Patrick Wallek
Honored Contributor

Re: Java:open files error

Yes, the 'ulimit -Sn' and 'ulimit -Hn' commands are correct. They display the (S)oft and (H)ard limits for '-n' which is the number of file descriptors.

For more information on 'ulimit' have a look at the man page for whatever shell you are using.

If POSIX (the HP-UX default /usr/bin/sh or /sbin/sh (for root) ) then do 'man sh-posix' and search for 'ulimit'.

Patrick Wallek
Honored Contributor

Re: Java:open files error

maxuprc is irrelevant. maxuprc is the maximum number of processes (NOT files) per user.
joe_91
Super Advisor

Re: Java:open files error

here is what i get. I run HP-UX 11.0

# ulimit -Sn
ksh: ulimit: bad option(s)
# ulimit -Hn
ksh: ulimit: bad option(s)

Thanks

Joe
A. Clay Stephenson
Acclaimed Contributor

Re: Java:open files error

Since you are posting in the HP-UX Forum, I am making the silly assumption that this is an HP-UX box. The ulimit command I supplied assumed that you were running the POSIX shell --- as you should be. The ulimit -Xa output makes me think that you are running the Korn shell. Ksh does not display the nofiles (number of file descriptors per process) value.
If it ain't broke, I can fix that.
joe_91
Super Advisor

Re: Java:open files error

OK. i changed the shell to sh and the commands ulimit -Sn and ulimit -Hn comes back with 2048. I think with ksh it takes the default value 1024..is that correct?

Thanks

Joe
joe_91
Super Advisor

Re: Java:open files error

Thanks Clay. MY BAD.So, is that all that is required a change of shell for that user who launches java. i see the ulimit -Sn and ulimit -Hn both give 2048 now.

Thanks

Joe
Patrick Wallek
Honored Contributor

Re: Java:open files error

It is possible that having that user change their shell from ksh to sh will work. There's only one way to really know thoug....Try it.
A. Clay Stephenson
Acclaimed Contributor

Re: Java:open files error

Now the bad news is that Java itself may be using a setrlimit(RLIMIT_NOFILE,...) system call to set the maxfiles value either to a hard-coded limit or by a value controlled in some configuration file. In any event, if you still are having problems I would increase maxfiles and maxfiles_lim but this time set maxfiles < maxfiles_lim because any well-written application is going to make that assumption at least initially. You could start your java under tusc (or attach it after starting if it doesn't immediately die) and see if getrlimit and/or setrlimit are being called.
If it ain't broke, I can fix that.
Steven E. Protter
Exalted Contributor

Re: Java:open files error

Shalom Joe,

If all limits are set higher than 1024 and this is still happening, then it probably is a Java issue.

Then its time to go to sun and report it.

What other OS's have maxfiles_lim and maxuprc other than HP-UX.

This IS a HP-UX box is it not?

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
joe_91
Super Advisor

Re: Java:open files error

Thanks Clay. Shalom (again) Steve, yes this is HP-UX 11.0

Thanks

Joe.