INN commit: trunk/innd (innd.c)
INN Commit
rra at isc.org
Wed Jul 6 17:13:41 UTC 2011
Date: Wednesday, July 6, 2011 @ 10:13:41
Author: iulius
Revision: 9220
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:
trunk/innd/innd.c
--------+
innd.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
Modified: innd.c
===================================================================
--- innd.c 2011-07-06 16:19:49 UTC (rev 9219)
+++ innd.c 2011-07-06 17:13:41 UTC (rev 9220)
@@ -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