Hi, Besides file-max and file-nr is there anywhere else I should be looking to solve a C program giving me 'too many open files' problem? (centos 3.4) While the program is complaining here were the values file-max 209632 file-nr 3655 258 209632 lsof | wc -l around 7000 during and about 1111 less after I closed the application. Any ideas? thx __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Check any ulimits imposed on the process you are running. # ulimit -n 1024 You should be able to increase that value to your file-max value. and FD_SETSIZE defined in: /usr/include/linux/posix_types.h /usr/include/bits/typesizes.h #define __FD_SETSIZE 1024 If you are feeling silly you can modify the value of FD_SETSIZE and recompile your software. In either case, standard warnings apply. - Mike On Sat, May 06, 2006 at 06:06:07PM -0700, Michael Rock wrote:> Hi, > > Besides file-max and file-nr is there anywhere else I > should be looking to solve a C program giving me 'too > many open files' problem? (centos 3.4) > > While the program is complaining here were the values > > file-max > 209632 > > file-nr > 3655 258 209632 > > lsof | wc -l > around 7000 during and about 1111 less after I closed > the application. > > Any ideas? thx
ulimit -n was 1024, so I am assuming that is likely the problem. So if I understand your reply correctly, I can do a 'ulimit -n 8192' to increase the value, but that is only for the session? Since I have the program starting at bootup what you are saying is I need to edit these files and reboot, Then ulimit -n should show whatever I set it to below? FD_SETSIZE defined in: /usr/include/linux/posix_types.h /usr/include/bits/typesizes.h #define __FD_SETSIZE 8192 Do I have that right? thx __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
> Besides file-max and file-nr is there anywhere else I > should be looking to solve a C program giving me 'too > many open files' problem? (centos 3.4)If the program is running as a non-root user, you will need to grant the user in question a limit higher than 1024 by adding a "nofile" statement in "/etc/security/limits.conf" Once that is done, you will need to open a new session as that user. You can verify that your settings took hold by typing "ulimit -n". HTH, Barry