Operating System - Linux
1828667 Members
1607 Online
109984 Solutions
New Discussion

Java program always hang.. message "Too many open files" appears sometime.

 
NiCK_76
Respected Contributor

Java program always hang.. message "Too many open files" appears sometime.

Hi ,

perform command lsof will appear following error message.
java 21929 mms31 53u sock 0,0 15544497 can't
identify protocol
java 21929 mms31 54u sock 0,0 15544498 can't
identify protocol
java 21929 mms31 55u sock 0,0 15544522 can't
identify protocol
java 21929 mms31 56u sock 0,0 15544523 can't
identify protocol
java 21929 mms31 57u sock 0,0 15544562 can't
identify protocol
........

my platform:
Redhat enterprice AS3 update 4 x86_64
j2sdk1.4.2_03
CPU Intel(R) Xeon(TM) CPU 2.80GHz *2
MEMORY 2G

Thanks.

NiCK
just for fun
7 REPLIES 7
Steven E. Protter
Exalted Contributor

Re: Java program always hang.. message "Too many open files" appears sometime.

Seems like you may want to increase the number of open files permitted with the kernel.

If I'm right, adding memory will do no good.

Java could stand some patching though.

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
T G Manikandan
Honored Contributor

Re: Java program always hang.. message "Too many open files" appears sometime.

check the value of /proc/sys/fs/file-max.

cat /proc/sys/fs/file-max

if the value is low increase the number.

echo 10000 > /proc/sys/fs/file-max

This will change the kernel limit.No need to reboot.
NiCK_76
Respected Contributor

Re: Java program always hang.. message "Too many open files" appears sometime.

cat /proc/sys/fs/file-max
209689
just for fun
Dave Falloon
Trusted Contributor

Re: Java program always hang.. message "Too many open files" appears sometime.

More likely its a problem with the ulimit set for the user you are running the program as.

If you use bash you can check the number of open files allowed by the shell with the following command:

ulimit -f

or all limits with this:

ulimit -a

ulimit is built into bash. All its documentation is in the bash man page.

man bash then search for ulimit.

--Dave
Clothes make the man, Naked people have little to no effect on society
Dave Falloon
Trusted Contributor

Re: Java program always hang.. message "Too many open files" appears sometime.

Woops, ulimit -f is the file size switch, you'll want the -n

snipped from the man page:

-n The maximum number of open file descriptors

--Dave
Clothes make the man, Naked people have little to no effect on society
NiCK_76
Respected Contributor

Re: Java program always hang.. message "Too many open files" appears sometime.

I use ulimit to change number of open file to 2048, but problem still happen.

Anything else?

Now,I upgrade jdk from 1.4.2-03 to 1.4.2-08 to have a try.

just for fun
Dave Falloon
Trusted Contributor

Re: Java program always hang.. message "Too many open files" appears sometime.

You could try ulimit -n unlimited

I remember having trouble with a Analog CAD tool that used this really clunky java GUI and it would spawn a hundred garbage file descriptors anytime you clicked on a icon so eventually it would tank with too many open files.

If it still doesn't work then it could be your /proc/sys/fs files like other people have said:

file-max
inode-max ( if your system has an inode-max file )

--Dave
Clothes make the man, Naked people have little to no effect on society