* cannot accept socket
@ 2003-03-06 18:13 Lee Chin
2003-03-06 20:02 ` Ray Olszewski
0 siblings, 1 reply; 4+ messages in thread
From: Lee Chin @ 2003-03-06 18:13 UTC (permalink / raw)
To: hahn, linux-newbie; +Cc: leechin
Hi,
In my web server, when I run a stress test with many clients, after a long time I suddenly get an error on the accept system call and the error is "Too many open files".
When I do a socklist (or netstat), I see that there are only 400 sockets open (and I have 400 clients, so that is correct).
However when I "cat /proc/PID/fd" I see 1024 files. I think accept failed because of this. My web server is as simple as possible (it just serves up a static string compiled in with the server). I know I am closing the sockets... what else could I be doing wrong?
Has anyone seen something similar to this before?
Thanks
Lee
--
__________________________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: cannot accept socket
2003-03-06 18:13 cannot accept socket Lee Chin
@ 2003-03-06 20:02 ` Ray Olszewski
[not found] ` <20030306202252.SSIT8575.mta06-svc.ntlworld.com@there>
2003-03-07 9:52 ` Carl
0 siblings, 2 replies; 4+ messages in thread
From: Ray Olszewski @ 2003-03-06 20:02 UTC (permalink / raw)
To: linux-newbie
At 01:13 PM 3/6/2003 -0500, Lee Chin wrote:
>Hi,
>In my web server, when I run a stress test with many clients, after a long
>time I suddenly get an error on the accept system call and the error is
>"Too many open files".
>
>When I do a socklist (or netstat), I see that there are only 400 sockets
>open (and I have 400 clients, so that is correct).
>
>However when I "cat /proc/PID/fd" I see 1024 files. I think accept failed
>because of this.
Yes. 1024 is the usual Linux limit on filehandles for a single process. I
believe you can change this limit during kernel compilation, but offhand I
do not remember how.
>My web server is as simple as possible (it just serves up a static string
>compiled in with the server). I know I am closing the sockets... what
>else could I be doing wrong?
Depends on what the files are.
Are you really seeing them with "cat /proc/PID/fd"? (This gives me an
error.) And not "ls -l /proc/PID/fd"? (This works here.) Whatever. Use the
second choice to see what the filehandles listed in the pseudo-directory
actually point to, and you (or we, if you report a meaningful subset of
that info in a followup here) may be able to offer a suggestion.
Depending on details you haven't told us, you may be doing nothing wrong
except underestimating the number of filehandles needed per connection
("client").
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: cannot accept socket
[not found] ` <20030306202252.SSIT8575.mta06-svc.ntlworld.com@there>
@ 2003-03-06 20:46 ` Ray Olszewski
0 siblings, 0 replies; 4+ messages in thread
From: Ray Olszewski @ 2003-03-06 20:46 UTC (permalink / raw)
To: bilbo; +Cc: linux-newbie
I assume you meant to send this to the list, not just to me personally, so
I've added it back in.
/proc/sys/fs/file-max contains, according to the man page for "proc", the
*total* number of files the kernel will open at one time. I quickly checked
a half-dozen Linux systems I have access to, and the value for this was
4096 on the older ones, 8192 on the newer ones ... not the 1024 the man
page mentions for this setting.
I **think** the 1024 limit Lee is running into is on files for a *single*
process, not for all processes together. (Full-size Web servers like apache
handle high loads by spawning children, so each process opens only a few
filehandles, making your solution work fine in real-world situations.)
At 08:26 PM 3/6/2003 +0000, bilbo wrote:
>On Thursday 06 March 2003 8:02 pm, Ray Olszewski wrote:
> > At 01:13 PM 3/6/2003 -0500, Lee Chin wrote:
> > >Hi,
> > >In my web server, when I run a stress test with many clients, after a long
> > >time I suddenly get an error on the accept system call and the error is
> > >"Too many open files".
> > >
> > >When I do a socklist (or netstat), I see that there are only 400 sockets
> > >open (and I have 400 clients, so that is correct).
> > >
> > >However when I "cat /proc/PID/fd" I see 1024 files. I think accept failed
> > >because of this.
> >
> > Yes. 1024 is the usual Linux limit on filehandles for a single process. I
> > believe you can change this limit during kernel compilation, but offhand I
> > do not remember how.
> >
>
>All the webservers in my old place of work had a line in rc.local which wrote
>a value to /proc/sys/fs/file-max. eg something like:
>
>echo 8192 > /proc/sys/fs/file-max
>
>You might want to have a look at /proc/sys/fs/file-max on your machine and
>increase it if necessary.
>
>regards,
>
>John Kelly
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: cannot accept socket
2003-03-06 20:02 ` Ray Olszewski
[not found] ` <20030306202252.SSIT8575.mta06-svc.ntlworld.com@there>
@ 2003-03-07 9:52 ` Carl
1 sibling, 0 replies; 4+ messages in thread
From: Carl @ 2003-03-07 9:52 UTC (permalink / raw)
To: leechin, linux-newbie
See the proc.txt file in the Documentation dir that comes with the kernel source.
It says per process limits are set at compile time and are in include/linux/limits.h
Here's the relevant bit in my kernel source:
However, there is still a per process limit of open files, which
unfortunatly can't be changed that easily. It is set to 1024 by
default. To change this you have to edit the files limits.h and
fs.h in the directory /usr/src/linux/include/linux. Change the
definition of NR_OPEN and recompile the kernel.
My limits.h has the following defined:
#define NR_OPEN 1024
Regards
Carl
At 12:02 06/03/2003 -0800, Ray Olszewski wrote:
>At 01:13 PM 3/6/2003 -0500, Lee Chin wrote:
>>Hi,
>>In my web server, when I run a stress test with many clients, after a long time I suddenly get an error on the accept system call and the error is "Too many open files".
>>
>>When I do a socklist (or netstat), I see that there are only 400 sockets open (and I have 400 clients, so that is correct).
>>
>>However when I "cat /proc/PID/fd" I see 1024 files. I think accept failed because of this.
>
>Yes. 1024 is the usual Linux limit on filehandles for a single process. I believe you can change this limit during kernel compilation, but offhand I do not remember how.
>
>>My web server is as simple as possible (it just serves up a static string compiled in with the server). I know I am closing the sockets... what else could I be doing wrong?
>
>Depends on what the files are.
>
>Are you really seeing them with "cat /proc/PID/fd"? (This gives me an error.) And not "ls -l /proc/PID/fd"? (This works here.) Whatever. Use the second choice to see what the filehandles listed in the pseudo-directory actually point to, and you (or we, if you report a meaningful subset of that info in a followup here) may be able to offer a suggestion.
>
>Depending on details you haven't told us, you may be doing nothing wrong except underestimating the number of filehandles needed per connection ("client").
>
>
>
>-
>To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at http://www.linux-learn.org/faqs
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-03-07 9:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-06 18:13 cannot accept socket Lee Chin
2003-03-06 20:02 ` Ray Olszewski
[not found] ` <20030306202252.SSIT8575.mta06-svc.ntlworld.com@there>
2003-03-06 20:46 ` Ray Olszewski
2003-03-07 9:52 ` Carl
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.