2003-07-13 22:17:09

by Andrew Burgess

[permalink] [raw]
Subject: /proc/sys/fs/file-max broken in 2.4.22-pre5


Setting /proc/sys/fs/file-max to 60000 results in a max of 1024 file
handles. In 2.4.21-rc7-ac1 and random earlier kernels this works as expected.

---------------------------------------------------------------------------

root@athlon:/root # cat file-max.c
#include <sys/time.h>
#include <sys/resource.h>
#include <unistd.h>

main() {
int i = 0;
struct rlimit r;
getrlimit(RLIMIT_NOFILE, &r);
r.rlim_cur = 50000;
setrlimit(RLIMIT_NOFILE, &r);
while(1) {
if(fopen("/tmp/file-max-test", "w") == 0) {
perror("");
break;
}
i++;
}
printf("opened %d files\n", i);
}

root@athlon:/root # echo 60000 > /proc/sys/fs/file-max
root@athlon:/root # cc file-max.c
root@athlon:/root # a.out
Too many open files
opened 1021 files
root@athlon:/root # uname -a
Linux athlon 2.4.22-pre5 #2 SMP Sun Jul 13 12:38:04 PDT 2003 i686 unknown



2003-07-14 07:01:42

by Willy Tarreau

[permalink] [raw]
Subject: Re: /proc/sys/fs/file-max broken in 2.4.22-pre5

On Sun, Jul 13, 2003 at 03:31:54PM -0700, Andrew Burgess wrote:

> root@athlon:/root # echo 60000 > /proc/sys/fs/file-max
> root@athlon:/root # cc file-max.c
> root@athlon:/root # a.out
> Too many open files
> opened 1021 files
> root@athlon:/root # uname -a
> Linux athlon 2.4.22-pre5 #2 SMP Sun Jul 13 12:38:04 PDT 2003 i686 unknown

ulimit -n ?

Willy

2003-07-14 19:58:55

by Andrew Burgess

[permalink] [raw]
Subject: Re: /proc/sys/fs/file-max broken in 2.4.22-pre5

Willy wrote:

>On Sun, Jul 13, 2003 at 03:31:54PM -0700, Andrew Burgess wrote:
>
>> root@athlon:/root # echo 60000 > /proc/sys/fs/file-max
>> root@athlon:/root # cc file-max.c
>> root@athlon:/root # a.out
>> Too many open files
>> opened 1021 files
>> root@athlon:/root # uname -a
>> Linux athlon 2.4.22-pre5 #2 SMP Sun Jul 13 12:38:04 PDT 2003 i686 unknown
>
>ulimit -n ?

It works without ulimit on earlier kernels but sure enough this
fixed it on 22-pre5. Thank you!

I assume ignoring ulimit was a bug that is now fixed?