🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #84113

Re: Rebuilding overview

#84113
From: Julien ÉLIE
Date: Sat, 11 Jun 2011 08:46
65 lines
3555 bytes
Hi Steve,

> May 17 08:56:02 news innd: free:-1 -1 free but was in WMASK
> May 17 08:56:02 news innd: free:-1 74 free but was in SMASK
> May 17 08:56:14 news innd: SERVER cant select: Bad file descriptor
>
> It seems that despite ulimit being set to 8192, the server doesn't like
> more than 1024 file descriptors.

It is a pretty interesting information, thanks!

I read on <http://www.delorie.com/gnu/docs/glibc/libc_248.html>:

«
Macro: int FD_SETSIZE
The value of this macro is the maximum number of file descriptors that a 
fd_set object can hold information about.  On systems with a fixed 
maximum number, FD_SETSIZE is at least that number.  On some systems, 
including GNU, there is no absolute limit on the number of descriptors 
open, but this macro still has a constant value which controls the 
number of bits in an fd_set; if you get a file descriptor with a value 
as high as FD_SETSIZE, you cannot put that descriptor into an fd_set.

Macro: void FD_SET (int filedes, fd_set *set)
This macro adds filedes to the file descriptor set set.

Function: int select (int nfds, fd_set *read-fds, fd_set *write-fds, 
fd_set *except-fds, struct timeval *timeout)
The select function checks only the first nfds file descriptors. The 
usual thing is to pass FD_SETSIZE as the value of this argument.
»



I see that in innd/innd.c, we do:

count = select(channels.max_fd + 1, &rdfds, &wrfds, NULL, &tv);

where max_fd is the number you spoke about in a previous article in this 
thread.  (The "rlimitnofile" inn.conf parameter or the hard-coded 5000 
value.)

Maybe it is the source of the bug in WMASK/SMASK because we are looking 
1025 in a fd_set limited to 1024.  The bit in the mask is not the right 
and it leads to an unexpected behaviour.

With the suggested fix, where max_fd is set to FD_SETSIZE at most, no 
new file description above FD_SETSIZE can be added (it will be refused 
later).

Does it sound good to you?



I do not understand well why it is (max_fd+1) and not max_fd.
Wouldn't max_fd be enough?

Well, I bet I should then use (FD_SETSIZE-1) instead of FD_SETSIZE when 
setting the upper value so as not to cause problem here.

-- 
Julien ÉLIE

« Un voyage de mille lieues commence toujours par un premier pas. »
   (Lao Zi)
Technical Details
Message-ID: <95gob9Fsl1U1@mid.individual.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.ams3.giganews.com!border1.nntp.ams2.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news.addix.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
References: <slrnis7i5f.bet.steve@news.mixmin.net> <iq1e3h$59m$1@news.trigofacile.com> <slrnit9m74.23b.steve@news.mixmin.net>

Show Full Headers
Complete Article Headers
Message-ID: <95gob9Fsl1U1@mid.individual.net>
Subject: Re: Rebuilding overview
Date: Sat, 11 Jun 2011 10:46:33 +0200
From: Julien ÉLIE <iulius@nom-de-mon-site.com.invalid>
References: <slrnis7i5f.bet.steve@news.mixmin.net> <iq1e3h$59m$1@news.trigofacile.com> <slrnit9m74.23b.steve@news.mixmin.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.ams3.giganews.com!border1.nntp.ams2.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news.addix.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
Newsgroups: news.software.nntp
Organization: TrigoFACILE -- http://www.trigofacile.com/
Lines: 65
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: individual.net jNw0pgWKoxr/7Z7lZ4mXeQY07720pjMvzwnfLc2HF7bbNPq0A=
Cancel-Lock: sha1:CKAI2Noj9fIPDofpWckoLEUvP70=
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; fr;
In-Reply-To: <slrnit9m74.23b.steve@news.mixmin.net>
X-Original-Bytes: 3385