Thread View: news.software.nntp
15 messages
15 total messages
Started by D. Stussy
Mon, 14 Feb 2011 21:21
File descriptor limits.
Author: D. Stussy
Date: Mon, 14 Feb 2011 21:21
Date: Mon, 14 Feb 2011 21:21
47 lines
3030 bytes
3030 bytes
I'm having a problem with the number of file descriptors.
I'm getting these errors in my logs - wtih 1024 descriptors:
innd: SERVER cant accept RCreader Too many open files
innd: innfeed! cant socketpair Too many open files
innd: innfeed! cant restart Too many open files
innd: tradindexed: cannot open /news/overview/...IDX: Too many open files
...And when I increase the number ("ulimit -n") to above 1,024, I get:
innfeed[5925]: ME fd (1026) looks too big (1024 -- FD_SETSIZE)
(and the connection is rejected)
OK, so how do I increase the number above 1024 in such a way that I don't
get complaints for not having enough descriptors and not having too many?
I am using a tradindex overview and a CNFS spool. The FAQ at doc/FAQ in
the INN source (Q 3.5) didn't help as increasing the limit via ulimit
causes the other problem ("fd looks too big"). When it hits the error
trying to (re-)open the history file, INN exits.
This is for a brand new installation - Linux x86 64-bit using the Slackware
13.1 (64-bit) distribution updated through January 25, 2011.
ulimit -a:
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 257433
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) 262144
open files (-n) 8192
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 257433
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
Probably something obvious here, but I'm just not seeing it....
Re: File descriptor limits.
Author: Ralf Döblitz
Date: Tue, 15 Feb 2011 07:26
Date: Tue, 15 Feb 2011 07:26
26 lines
2711 bytes
2711 bytes
D. Stussy <spam+newsgroups@bde-arc.ampr.org> wrote:
> I'm having a problem with the number of file descriptors.
>
> I'm getting these errors in my logs - wtih 1024 descriptors:
>
> innd: SERVER cant accept RCreader Too many open files
> innd: innfeed! cant socketpair Too many open files
> innd: innfeed! cant restart Too many open files
> innd: tradindexed: cannot open /news/overview/...IDX: Too many open files
>
> ...And when I increase the number ("ulimit -n") to above 1,024, I get:
>
> innfeed[5925]: ME fd (1026) looks too big (1024 -- FD_SETSIZE)
> (and the connection is rejected)
[...]
> Probably something obvious here, but I'm just not seeing it....
You lost. Looks like someone is using select() and your libc is
compiled with a limit of 1024 for the file descriptor set used by
that syscall. Recompile the C library (har har) or switch to using
epoll() or something like that (system-specific).
Ralf (hit the limit of 4096 with apache on linux)
--
"de.alt.comp.kde Dumm und trotzdem UNIX verwenden? KDE ist die Loesung."
 – Sven Paulus in <67hu21$43r$1@imperator.oops.sub.de>
Re: File descriptor limits.
Author: D. Stussy
Date: Tue, 15 Feb 2011 08:21
Date: Tue, 15 Feb 2011 08:21
5 lines
1430 bytes
1430 bytes
Never mind. Since CNFS buffers each eat up a file descriptor, I figured that my better option is to re-do the buffer section: Half as many buffers but twice as large, and that will free up 100+ descriptors.
Re: File descriptor limits.
Author: Richard Kettlewell
Date: Wed, 16 Feb 2011 09:13
Date: Wed, 16 Feb 2011 09:13
34 lines
3035 bytes
3035 bytes
Ralf Döblitz <doeblitz@doeblitz.net> writes:
> D. Stussy <spam+newsgroups@bde-arc.ampr.org> wrote:
>> I'm having a problem with the number of file descriptors.
>>
>> I'm getting these errors in my logs - wtih 1024 descriptors:
>>
>> innd: SERVER cant accept RCreader Too many open files
>> innd: innfeed! cant socketpair Too many open files
>> innd: innfeed! cant restart Too many open files
>> innd: tradindexed: cannot open /news/overview/...IDX: Too many open files
>>
>> ...And when I increase the number ("ulimit -n") to above 1,024, I get:
>>
>> innfeed[5925]: ME fd (1026) looks too big (1024 -- FD_SETSIZE)
>> (and the connection is rejected)
> [...]
>> Probably something obvious here, but I'm just not seeing it....
>
> You lost. Looks like someone is using select() and your libc is
> compiled with a limit of 1024 for the file descriptor set used by
> that syscall. Recompile the C library (har har) or switch to using
> epoll() or something like that (system-specific).
On many platforms it's sufficient to rebuild your program with an
explicit, larger, definition for FD_SETSIZE; rebuilding the whole Libc
is not required.
Glibc makes this unusually awkward, for some reason, unconditionally
using an internal __FD_SETSIZE and explicitly ignoring any attempts to
override it.
--
http://www.greenend.org.uk/rjk/
Re: File descriptor limits.
Author: Miquel van Smoorenburg
Date: Thu, 17 Feb 2011 14:58
Date: Thu, 17 Feb 2011 14:58
38 lines
2432 bytes
2432 bytes
In article <87lj1g4a0y.fsf@araminta.anjou.terraraq.org.uk>,
Richard Kettlewell <rjk@greenend.org.uk> wrote:
>On many platforms it's sufficient to rebuild your program with an
>explicit, larger, definition for FD_SETSIZE; rebuilding the whole Libc
>is not required.
>
>Glibc makes this unusually awkward, for some reason, unconditionally
>using an internal __FD_SETSIZE and explicitly ignoring any attempts to
>override it.
#define LARGE_FD_SETSIZE 4096
/*
* Cannot increase FD_SETSIZE on Linux, but we can increase __FD_SETSIZE
* with glibc 2.2 and 2.3 at least. We do this by including
* bits/types.h which defines __FD_SETSIZE first (before any other include),
* then we redefine __FD_SETSIZE. Ofcourse a user program may NEVER
* include bits/whatever.h directly, so this is a dirty hack!
*/
#if LARGE_FD_SETSIZE > 1024
# ifdef __linux__
# include <features.h>
# if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
# include <bits/types.h>
# undef __FD_SETSIZE
# define __FD_SETSIZE LARGE_FD_SETSIZE
# endif
# else
/* Works on most BSDs */
# define FD_SETSIZE LARGE_FD_SETSIZE
# endif
#endif
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
Mike.
Re: File descriptor limits.
Author: D. Stussy
Date: Thu, 17 Feb 2011 23:35
Date: Thu, 17 Feb 2011 23:35
51 lines
3279 bytes
3279 bytes
"Miquel van Smoorenburg" <miquels@netscum.invalid> wrote in message
news:4d5d37ad$0$41113$e4fe514c@news.xs4all.nl...
> In article <87lj1g4a0y.fsf@araminta.anjou.terraraq.org.uk>,
> Richard Kettlewell <rjk@greenend.org.uk> wrote:
> >On many platforms it's sufficient to rebuild your program with an
> >explicit, larger, definition for FD_SETSIZE; rebuilding the whole Libc
> >is not required.
> >
> >Glibc makes this unusually awkward, for some reason, unconditionally
> >using an internal __FD_SETSIZE and explicitly ignoring any attempts to
> >override it.
>
> #define LARGE_FD_SETSIZE 4096
>
> /*
> * Cannot increase FD_SETSIZE on Linux, but we can increase __FD_SETSIZE
> * with glibc 2.2 and 2.3 at least. We do this by including
> * bits/types.h which defines __FD_SETSIZE first (before any other
include),
> * then we redefine __FD_SETSIZE. Ofcourse a user program may NEVER
> * include bits/whatever.h directly, so this is a dirty hack!
> */
> #if LARGE_FD_SETSIZE > 1024
> # ifdef __linux__
> # include <features.h>
> # if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
> # include <bits/types.h>
> # undef __FD_SETSIZE
> # define __FD_SETSIZE LARGE_FD_SETSIZE
> # endif
> # else
> /* Works on most BSDs */
> # define FD_SETSIZE LARGE_FD_SETSIZE
> # endif
> #endif
>
> #include <sys/time.h>
> #include <sys/types.h>
> #include <unistd.h>
Thanks for the replies. However, I took a different approach: I re-did
the spool to have half-as-many CNFS buffers which are twice-as-large as
what I had before, and that reduced the number so that I have enough free
descriptors available so as not to hit the limit.
I also complained at kernel.org by requesting an "enhancement" type-bug - #
29342, and suggested that the limit be based on the actual resource
available ("ulimit -n") as opposed to hard-coded in a define.
Re: File descriptor limits.
Author: River Tarnell
Date: Thu, 17 Feb 2011 23:52
Date: Thu, 17 Feb 2011 23:52
22 lines
2274 bytes
2274 bytes
In article <ijkbb3$612$1@snarked.org>,
D. Stussy <replies@newsgroups.kd6lvw.ampr.org> wrote:
> I also complained at kernel.org by requesting an "enhancement" type-bug - #
> 29342, and suggested that the limit be based on the actual resource
> available ("ulimit -n") as opposed to hard-coded in a define.
As far as I know, this is impossible. select() uses the C type
'fd_set', which has to be defined at compile time to hold a particular
number of fds. (It can't be allocated dynamically because there's no
API for that.) FD_SETSIZE sets the number of fds in an fd_set.
The real fix here is for INN on Linux to start using epoll, which is a
new, much more efficient select()-like interface (equivalent to kqueue
on BSD, event ports on Solaris, etc). As well as being much faster for
non-trivial fd sets, epoll has no limit on number of fds which can be
monitored.
An interim fix would be to use poll() instead of select(). Although it
offers very little (or no) performance advantage, it does remove the
compile-time fd limit.
- river.
Re: File descriptor limits.
Author: Julien ÉLIE
Date: Fri, 18 Feb 2011 22:52
Date: Fri, 18 Feb 2011 22:52
15 lines
1721 bytes
1721 bytes
Hi Dieter, > Never mind. Since CNFS buffers each eat up a file descriptor, I figured > that my better option is to re-do the buffer section: Half as many buffers > but twice as large, and that will free up 100+ descriptors. Just out of curiosity, how did you manage the transition between your old buffers to your new ones? (I mean, how did you transfer the articles from one to another?) -- Julien ÉLIE « Après la clairière d'attente, on entre dans la hutte de consultation. » (Astérix)
Re: File descriptor limits.
Author: D. Stussy
Date: Sat, 19 Feb 2011 08:17
Date: Sat, 19 Feb 2011 08:17
30 lines
2687 bytes
2687 bytes
"Julien ÉLIE" <iulius@nom-de-mon-site.com.invalid> wrote in message news:8s8bhqFthkU2@mid.individual.net... > > Never mind. Since CNFS buffers each eat up a file descriptor, I figured > > that my better option is to re-do the buffer section: Half as many buffers > > but twice as large, and that will free up 100+ descriptors. > > Just out of curiosity, how did you manage the transition between your > old buffers to your new ones? (I mean, how did you transfer the > articles from one to another?) For the most part, I haven't (yet). I saved the first 16MB of each of the buffers I had created (since they did use 12-14MB before I reformatted them). As for how I transferred articles originally from the old server to the new one, I created a feed effective January 1 on the old server and buffered the transfer. When I actually performed that transfer, my old server was still colocated and the new server was at home, so I had two different IP addresses - so it looked like normal peering. I'm looking for suggestions on how to get the 6 weeks of articles out of the old buffers and into the new ones. I'm thinking of running a second instance of INN with a separate file structure to extract them. I can use makehistory and extract the message token and ID from the overview-formatted output to drive innfeed to push them over. ...Unless you have a better idea?
Re: File descriptor limits.
Author: Julien ÉLIE
Date: Sat, 11 Jun 2011 09:23
Date: Sat, 11 Jun 2011 09:23
49 lines
2657 bytes
2657 bytes
Hi Dieter,
> I'm having a problem with the number of file descriptors.
>
> I'm getting these errors in my logs - wtih 1024 descriptors:
>
> innd: SERVER cant accept RCreader Too many open files
> innd: innfeed! cant socketpair Too many open files
> innd: innfeed! cant restart Too many open files
> innd: tradindexed: cannot open /news/overview/...IDX: Too many open files
>
> ....And when I increase the number ("ulimit -n") to above 1,024, I get:
>
> innfeed[5925]: ME fd (1026) looks too big (1024 -- FD_SETSIZE)
> (and the connection is rejected)
Pretty interestingly, I read the following code in innfeed:
#if defined (FD_SETSIZE)
if ((unsigned int) fd >= FD_SETSIZE)
{
sizelogged = true ;
warn ("ME fd (%d) looks too big (%d -- FD_SETSIZE)", fd,
FD_SETSIZE) ;
return NULL ;
}
#else
if (fd > (sizeof (fd_set) * CHAR_BIT))
{
sizelogged = true ;
warn ("ME fd (%d) looks too big (%d -- sizeof (fd_set) * CHAR_BIT)",
fd, (sizeof (fd_set) * CHAR_BIT)) ;
return NULL ;
}
#endif
A useful protection!
I wonder if it should not be implemented at other places where fd_set is used.
Several people in this newsgroup and in inn-workers suggest a switch to
epoll() instead of select(). Is epoll() as portable as select()?
--
Julien ÉLIE
« Un voyage de mille lieues commence toujours par un premier pas. »
(Lao Zi)
Re: File descriptor limits.
Author: Russ Allbery
Date: Sat, 11 Jun 2011 19:52
Date: Sat, 11 Jun 2011 19:52
21 lines
2005 bytes
2005 bytes
Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> writes:
> Several people in this newsgroup and in inn-workers suggest a switch to
> epoll() instead of select(). Is epoll() as portable as select()?
No, which is the problem.
At this point, actually, the best solution to this problem would probably
be to do the work to replace INN's event loop with something that handles
all these details for us, like libevent. See:
http://www.monkey.org/~provos/libevent/
Adding our own portability for epoll would basically be redoing the work
of libevent, except without the same user and testing base.
--
Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>
Please post questions rather than mailing me directly.
<http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: File descriptor limits.
Author: Julien ÉLIE
Date: Sat, 11 Jun 2011 22:02
Date: Sat, 11 Jun 2011 22:02
47 lines
3549 bytes
3549 bytes
Hi Russ,
> At this point, actually, the best solution to this problem would probably
> be to do the work to replace INN's event loop with something that handles
> all these details for us, like libevent. See:
>
> http://www.monkey.org/~provos/libevent/
>
> Adding our own portability for epoll would basically be redoing the work
> of libevent, except without the same user and testing base.
I have just taken time to read more carefully what libevent does. (We
recently spoke about it in a discussion for TLS support in innd.)
That library has great features.
I even see a evdns_getaddrinfo() function which does an asynchronous DNS
request, with a callback when the resolution is done.
http://mc.kev009.com/libevent/dns_8h.html
It would solve a long-standing feature request for INN!
I'm just wondering: when should DNS requests be done? Every time we
have to open a socket? (We therefore rely on the DNS cache capability
of the system so that it does not send the actual request before the TTL.)
I see that libevent handles timeouts. It could be useful at several
places in our code (client timeout, channels timeout or things like that).
It also does buffering when sending data. It could also be used in lieu
of the buffering system in nnrpd for instance.
A bufferevent_openssl library exists… It could be useful for TLS
support in innd. I assume it solves the problem of synchronizing TLS
data blocks.
Well, libevent looks pretty promising to use with INN.
The libevent license allows to redistribute their source code. So we
basically just have to ship the relevant files in include/libevent? (I
hope they compile fine with gcc warnings on.)
--
Julien ÉLIE
« Un voyage de mille lieues commence toujours par un premier pas. »
(Lao Zi)
Re: File descriptor limits.
Author: Russ Allbery
Date: Sat, 11 Jun 2011 22:11
Date: Sat, 11 Jun 2011 22:11
41 lines
3188 bytes
3188 bytes
Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> writes:
> I'm just wondering: when should DNS requests be done? Every time we
> have to open a socket? (We therefore rely on the DNS cache capability
> of the system so that it does not send the actual request before the
> TTL.)
Yup, that sounds like the right thing to do to me. With DNS, INN has
suffered for years from being a little too smart, when in practice people
already ensure that DNS lookups are relatively fast and are cached. We
still want asychronous lookups, but once we have that, I think doing a
lookup for each incoming connection is quite reasonable.
> I see that libevent handles timeouts. It could be useful at several
> places in our code (client timeout, channels timeout or things like
> that). It also does buffering when sending data. It could also be used
> in lieu of the buffering system in nnrpd for instance.
Yes.
> A bufferevent_openssl library exists… It could be useful for TLS support
> in innd. I assume it solves the problem of synchronizing TLS data
> blocks.
I hope so, and yeah, that would also make things much easier.
> Well, libevent looks pretty promising to use with INN.
> The libevent license allows to redistribute their source code. So we
> basically just have to ship the relevant files in include/libevent? (I
> hope they compile fine with gcc warnings on.)
I would instead recommend requiring people install libevent separately,
rather than including the code inside INN, like we do with other library
dependencies. Linux distributions probably already have separate packages
(Debian does).
--
Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>
Please post questions rather than mailing me directly.
<http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: File descriptor limits.
Author: Julien ÉLIE
Date: Sat, 11 Jun 2011 22:59
Date: Sat, 11 Jun 2011 22:59
37 lines
2876 bytes
2876 bytes
Hi Russ, >> The libevent license allows to redistribute their source code. So we >> basically just have to ship the relevant files in include/libevent? (I >> hope they compile fine with gcc warnings on.) > > I would instead recommend requiring people install libevent separately, > rather than including the code inside INN, like we do with other library > dependencies. Linux distributions probably already have separate packages > (Debian does). The problem with Linux distributions is that they do not necessarily have the right package. For Debian, libevent-dev 1.4.14 is in Squeeze, Wheezy and sid. Only experimental currently has the 2.0.10 version. libevent 2.0.10 was released in December 2010. 2.0.11 at the end of April 2011. (And 2.0.12 a few days ago.) evdns_getaddrinfo() is only in libevent 2.0.3 and above. TLS support on bufferevents is only in libevent 2.0.3 and above. We therefore need the version in experimental for Debian. Marco will be pleased to hear that :-) Well, I understand that it is better to require that people install the library separately. We then just have to update our installation guide to mention the mandatory dependency. -- Julien ÉLIE « Un voyage de mille lieues commence toujours par un premier pas. » (Lao Zi)
Re: File descriptor limits.
Author: D. Stussy
Date: Sun, 12 Jun 2011 00:32
Date: Sun, 12 Jun 2011 00:32
51 lines
2900 bytes
2900 bytes
"Julien ÉLIE" <iulius@nom-de-mon-site.com.invalid> wrote in message
news:95gqhdFd2hU1@mid.individual.net...
> > I'm having a problem with the number of file descriptors.
> >
> > I'm getting these errors in my logs - wtih 1024 descriptors:
> >
> > innd: SERVER cant accept RCreader Too many open files
> > innd: innfeed! cant socketpair Too many open files
> > innd: innfeed! cant restart Too many open files
> > innd: tradindexed: cannot open /news/overview/...IDX: Too many open
files
> >
> > ....And when I increase the number ("ulimit -n") to above 1,024, I get:
> >
> > innfeed[5925]: ME fd (1026) looks too big (1024 -- FD_SETSIZE)
> > (and the connection is rejected)
>
> Pretty interestingly, I read the following code in innfeed:
>
> #if defined (FD_SETSIZE)
> if ((unsigned int) fd >= FD_SETSIZE)
> {
> sizelogged = true ;
> warn ("ME fd (%d) looks too big (%d -- FD_SETSIZE)", fd,
> FD_SETSIZE) ;
> return NULL ;
> }
> #else
> if (fd > (sizeof (fd_set) * CHAR_BIT))
> {
> sizelogged = true ;
> warn ("ME fd (%d) looks too big (%d -- sizeof (fd_set) *
CHAR_BIT)",
> fd, (sizeof (fd_set) * CHAR_BIT)) ;
> return NULL ;
> }
> #endif
>
>
>
> A useful protection!
> I wonder if it should not be implemented at other places where fd_set is
used.
>
> Several people in this newsgroup and in inn-workers suggest a switch to
> epoll() instead of select(). Is epoll() as portable as select()?
However, the problem was that ulimit was telling me I could have 8,192
concurrently open files.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads