From: Oskar Pearson <oskar@linux.org.za>
To: linux-mm@kvack.org
Subject: Re: Opening 5000 file descriptors in linux??
Date: Tue, 6 Apr 1999 21:35:30 +0200 [thread overview]
Message-ID: <19990406213530.A1581@linux.org.za> (raw)
In-Reply-To: <14082.48568.621877.339352@dukat.scot.redhat.com>; from Stephen C. Tweedie on Thu, Apr 01, 1999 at 01:28:40AM +0100
Hi
Stephen Tweedie wrote:
> Two things: first of all, the default rlimit for open files is still
> 1024, so you need to raise that to use more in one process. From bash,
> that's
>
> ulimit -Hn 100000; ulimit -n 100000
Done.
> or use the setrlimit() kernel call.
>
> Secondly, the default FD_SET type only has space for 1024 fds in the
> bitmap, so either make sure you are using poll, or define your own,
> sufficiently large, FD_SET if you need to use select.
>
> Other than that, all should work.
Interesting thing. Someone sent me a simple piece of code that they
were having problems with. Instead of opening /dev/null 5 million
times, they actually opened a network socket. Here is the code:
--------
#include <stdio.h>
#include <sys/socket.h>
main()
{
int s;
for(s = 0;; s++)
if(socket(AF_INET,SOCK_STREAM,0) < 0)
break;
printf("%d\n", s);
}
--------
This breaks much sooner than the ulimit value:
vi:~ # ./test
508
vi:~ # ./test
519
vi:~ # ./test
519
<fiddle around with random things so that the system swaps>
vi:~ # ./test
552
strace output:
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 552
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 553
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 554
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = -1 ENOBUFS (No buffer space
available)
no dmesg errors.
vi:~ # uname -a
Linux vi.qualica.com 2.2.5-ac1 #2 Sun Apr 4 14:26:31 SAST 1999 i586
unknown
If I add a second delay every 10 seconds, the system seems to free up
enough memory to get to around about 1000 filedescriptors. This points
to a resource management problem, IMHO.
I am not sure if the later ac-? patches do the same thing. I was out
of the country this last weekend.
Oskar
--
To unsubscribe, send a message with 'unsubscribe linux-mm my@address'
in the body to majordomo@kvack.org. For more info on Linux MM,
see: http://humbolt.geo.uu.nl/Linux-MM/
parent reply other threads:[~1999-04-06 20:46 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <14082.48568.621877.339352@dukat.scot.redhat.com>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=19990406213530.A1581@linux.org.za \
--to=oskar@linux.org.za \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox