INN commit: branches/2.5/innd (innd.c)
INN Commit
rra at isc.org
Sun Jul 17 18:23:50 UTC 2011
Date: Sunday, July 17, 2011 @ 11:23:50
Author: iulius
Revision: 9262
implement an upper limit to the number of file descriptors
select() only handles (FD_SETSIZE-1) file descriptors at most.
Otherwise, macros like FD_SET have an unexpected behaviour.
Force this upper limit right now (usually 1023).
In future versions of INN, hopefully libevent will deal with
a larger number of file descriptors.
Thanks to Steve Crook for the bug report.
Modified:
branches/2.5/innd/innd.c
--------+
innd.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
Modified: innd.c
===================================================================
--- innd.c 2011-07-17 18:23:31 UTC (rev 9261)
+++ innd.c 2011-07-17 18:23:50 UTC (rev 9262)
@@ -508,7 +508,7 @@
ac -= optind;
if (ac != 0)
Usage();
- if (ModeReason && !innconf->readerswhenstopped)
+ if (ModeReason != NULL && !innconf->readerswhenstopped)
NNRPReason = xstrdup(ModeReason);
if (ShouldSyntaxCheck) {
@@ -592,19 +592,29 @@
die("SERVER cant open overview method");
/* Attempt to increase the number of open file descriptors. */
- if (innconf->rlimitnofile > 0)
+ if (innconf->rlimitnofile > 0) {
if (setfdlimit(innconf->rlimitnofile) < 0)
syswarn("SERVER cant set file descriptor limit");
+ }
/* Get number of open channels. */
i = getfdlimit();
if (i < 0)
sysdie("SERVER cant get file descriptor limit");
+#ifdef FD_SETSIZE
+ if (i > FD_SETSIZE-1) {
+ syslog(LOG_WARNING, "%s number of descriptors (%d) exceeding FD_SETSIZE-1 (%d)",
+ LogName, i, FD_SETSIZE-1);
+ i = FD_SETSIZE-1;
+ }
+#endif
+
/* There is no file descriptor limit on some hosts; for those, cap at
MaxOutgoing plus maxconnections plus 20, or 5000, whichever is larger.
Otherwise, we use insane amounts of memory for the channel table.
- FIXME: Get rid of this hard-coded constant. */
+ FIXME: Get rid of this hard-coded constant.
+ (TODO: Consider implementing libevent.) */
if (i > 5000) {
unsigned long max;
More information about the inn-committers
mailing list