2001-04-10 01:56:30

by Ram Madduluri

[permalink] [raw]
Subject: Increasing the FD_SETSIZE

Hi,

I am having trouble with increasing the file descriptor size for my
application - it opens several files for each client session (and needs
to keep them open as long as the session is active, which can be upto 3
hours long). What I see from the application is "open failed in
FileStreamReader::setupFile: Too many open files".

I have bumped up /proc/sys/fs/file-max to 16K, but I am failing at 2638
(cat /proc/sys/fs/file-max returns "2638 97 16384") when the number of
files my app opened reached 1023.

There is a comment in /usr/include/linux/posix_types.h regarding
__FD_SETSIZE being set to 1024. How can I increase this value?

Thanks,
Ram Madduluri


Attachments:
ram.vcf (193.00 B)
Card for Ram Madduluri

2001-04-10 02:42:03

by David Schwartz

[permalink] [raw]
Subject: RE: Increasing the FD_SETSIZE


> I am having trouble with increasing the file descriptor size for my
> application - it opens several files for each client session (and needs
> to keep them open as long as the session is active, which can be upto 3
> hours long). What I see from the application is "open failed in
> FileStreamReader::setupFile: Too many open files".
>
> I have bumped up /proc/sys/fs/file-max to 16K, but I am failing at 2638
> (cat /proc/sys/fs/file-max returns "2638 97 16384") when the number of
> files my app opened reached 1023.
>
> There is a comment in /usr/include/linux/posix_types.h regarding
> __FD_SETSIZE being set to 1024. How can I increase this value?

You are tinkering with the wrong value. FD_SETSIZE affects fd_sets used in
the 'select' system call. If you don't use select (and you shouldn't) it's
not an issue.

Also, tampering with the system-wide limits is the wrong approach too.
There is no problem in the kernel for you to fix.

What you are hitting is a per-process resource limit. Read the man pages on
'setrlimit' or the bash help on 'ulimit'.

DS