🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
10 messages
10 total messages Started by Steve Crook Fri, 06 May 2011 10:08
Rebuilding overview
#84031
Author: Steve Crook
Date: Fri, 06 May 2011 10:08
15 lines
1281 bytes
Hi all,

I'm about to rebuild the history/overview on news.mixmin.net and would
appreciate a sanity check on the process.  I also plan to switch from
the current buffindexed method to tradindexed to make recovery from
future issues easier (via tdx-util).

1) Change ovmethod in inn.conf
2) Stop server
3) Delete ~/db/history*
4) Rebuild with makehistory -O -x -F
5) Start server

I assume the old buffindexed files can then be deleted as they'll no
longer be in use?
Re: Rebuilding overview
#84032
Author: Julien ÉLIE
Date: Fri, 06 May 2011 18:19
58 lines
3381 bytes
Hi Steve,

> I'm about to rebuild the history/overview on news.mixmin.net and would
> appreciate a sanity check on the process.

Does your history also need rebuilding?


> I also plan to switch from
> the current buffindexed method to tradindexed to make recovery from
> future issues easier (via tdx-util).
>
> 1) Change ovmethod in inn.conf
> 2) Stop server
> 3) Delete ~/db/history*
> 4) Rebuild with makehistory -O -x -F
> 5) Start server

If you give the "-x" flag to makehistory, *no* history files will be 
rebuilt.  As you do not change the storage location of articles, I do 
not think step 3 (deleting history) should be done.
So "-x" is fine; but please do *not* delete your history!

I think that you will also want tweaking tradindexed-related inn.conf 
parameters like overcachesize (256? 512?) and tradindexedmmap (true).


> I assume the old buffindexed files can then be deleted as they'll no
> longer be in use?

Anyway, they are not used in the process.  The (tradindexed) overview is 
rebuilt from the articles in the news spool.  The previous (buffindexed) 
overview is not used.



Please do not hesitate to tell me in case I said something wrong in this 
article.


I am also wondering whether someone has already tried such a rebuild 
without any interruption of service longer than a minute for the 
readers?  I mean that innd is stopped, nnrpd is launched as a daemon 
(ports 119, 563 or others) with buffindexed overview.  Reading would 
then be fine.  Posting would be deferred (saved on the disk, and 
processed later by "rnews -U").
The migration of overview is done (just have "tradindexed" mentioned in 
inn.conf at the moment you start makehistory).
After the migration of overview, nnrpd is stopped.
Then INN is switched to tradindexed only, and started in your usual way.

Any comments about such a scenario?

-- 
Julien ÉLIE

« Si Dieu n'est pas marié, pourquoi parle-t-on de sa grande
   Clémence ? » (Raymond Devos)
Re: Rebuilding overview
#84072
Author: Steve Crook
Date: Thu, 19 May 2011 08:46
71 lines
4255 bytes
On Fri, 06 May 2011 20:19:28 +0200, Julien ÉLIE wrote in
Message-Id: <iq1e3h$59m$1@news.trigofacile.com>:

>> 1) Change ovmethod in inn.conf
>> 2) Stop server
>> 3) Delete ~/db/history*
>> 4) Rebuild with makehistory -O -x -F
>> 5) Start server
>
> If you give the "-x" flag to makehistory, *no* history files will be 
> rebuilt.  As you do not change the storage location of articles, I do 
> not think step 3 (deleting history) should be done.
> So "-x" is fine; but please do *not* delete your history!

Thanks for your feedback Julien.  As you know (from email) I suffered a
few problems so I thought I'd document them here for future reference.

First issue occurred when makehistory was run.  After a few seconds it
began reporting a stream of "Too many files open" errors.  At the time
ulimit -n was set to 1024 so I increased it via
/etc/security/limits/conf:
news             soft    nofile          8192
news             hard    nofile          8192

After this change, makehistory ran without issues and completed in about
40 hours. Restarting inn prompted me to run ctlinnd renumber '' which
also ran without issues.

The server then ran fine for a few minutes before I started getting
errors like:

May 17 08:55:44 news innd: SERVER cant recv CCreader Resource
temporarily unavailable
May 17 08:55:45 news innd: last message repeated 16 times
May 17 08:55:45 news innd: SERVER cant accept CCreader Resource
temporarily unavailable
May 17 08:55:45 news innd: SERVER cant recv CCreader Resource
temporarily unavailable
May 17 08:55:47 news innd: last message repeated 20 times

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
May 17 08:56:32 news innd: last message repeated 1522092 times

As a side note: My Debian Squeeze server runs rsyslog which by default
doesn't do the "last message repeated" thing. As a result the log
exceeded the filesystem capacity in a matter of seconds.

It seems that despite ulimit being set to 8192, the server doesn't like
more than 1024 file descriptors.  By switching from buffindexed to
tradindexed, I incurred an increase in the number of required
descriptors and exceeded the 1024 limit.  By tweaking inn.conf with the
following, I now appear to have a stable system.
maxconnections:         250
overcachesize:          256
rlimitnofile:           1024


After some investigation and feedback from Julien, it seems that the
artificial 1024 descriptor limit is caused by inn's use of 'select'. In
innd.c though, the limit will reflect the system limit up to a hard
ceiling of 5000 if rlimitnofile is left at its default (-1). This can be
verified at start time by the log message:
May 15 09:39:53 news innd: SERVER descriptors 5000
May 15 09:39:53 news innd: SERVER outgoing 4987

It appears that inn is unable to support descriptors above 1024 but will
only impose a limit of 5000.  If the descriptors in use then exceeds
1024, bad things happen.
Re: Rebuilding overview
#84073
Author: Julien ÉLIE
Date: Thu, 19 May 2011 17:09
49 lines
2655 bytes
Hi Steve,

I'm glad to hear from you again on Usenet :-)



> I suffered a
> few problems so I thought I'd document them here for future reference.

Thanks, that's very interesting.

Did you also notice an increase in the duration of expireover?  Is 
news.daily taking a different time to run between buffindexed and 
tradindexed overviews?



> After this change, makehistory ran without issues and completed in about
> 40 hours.

For how many articles?



> 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

Again this bug we recently spoke about.  I should have a deeper look 
into it and locate the call that does not check the return value of the 
file descriptor opening.



> In innd.c though, the limit will reflect the system limit up to a hard
> ceiling of 5000 if rlimitnofile is left at its default (-1). This can be
> verified at start time by the log message:
> May 15 09:39:53 news innd: SERVER descriptors 5000
> May 15 09:39:53 news innd: SERVER outgoing 4987
>
> It appears that inn is unable to support descriptors above 1024 but will
> only impose a limit of 5000.  If the descriptors in use then exceeds
> 1024, bad things happen.

Should we then use FD_SETSIZE instead of the hard-coded 5000 value?

-- 
Julien ÉLIE

« Aux quatre coins de l'Hexagone. »
Re: Rebuilding overview
#84074
Author: Steve Crook
Date: Thu, 19 May 2011 19:52
69 lines
4457 bytes
On Thu, 19 May 2011 19:09:42 +0200, Julien ÉLIE wrote in
Message-Id: <93l16mFt5kU1@mid.individual.net>:

> Hi Steve,
>
> I'm glad to hear from you again on Usenet :-)
Thanks, it's very nice to be back. :)

> Did you also notice an increase in the duration of expireover?  Is 
> news.daily taking a different time to run between buffindexed and 
> tradindexed overviews?
My last expire.log reads:
expire begin Thu May 19 03:01:04 BST 2011: (-v1)
    Article lines processed 15616044
    Articles retained       15556225
    Entries expired            59819
    Articles dropped               0
expire end Thu May 19 03:01:54 BST 2011
all done Thu May 19 03:01:54 BST 2011
expireover start Thu May 19 03:01:55 BST 2011
expireover end Thu May 19 04:13:08 BST 2011
lowmarkrenumber begin Thu May 19 04:13:08 BST 2011:
(/usr/local/news/log/expire.lowmark)
lowmarkrenumber end Thu May 19 04:13:09 BST 2011

This isn't appreciably different from my buffindexed experience.

>> After this change, makehistory ran without issues and completed in about
>> 40 hours.
>
> For how many articles?
I assume that's the 15616044 from 'Article lines processed' during
expire?  In terms of CNFS buffers I have:

Class GENERAL for groups matching "*"
 Buffer a1, size:  7.81 GBytes, position:  3.36 GBytes  4.43 cycles
  Newest: 2011-05-19 20:49:06,    0 days,  0:00:03 ago
  Oldest: 2010-08-31  5:45:17,  261 days, 15:03:52 ago
 Buffer a2, size:  7.81 GBytes, position:  3.36 GBytes  4.43 cycles
  Newest: 2011-05-19 20:49:06,    0 days,  0:00:03 ago
  Oldest: 2010-08-31 13:58:22,  261 days,  6:50:47 ago
 Buffer a3, size:  7.81 GBytes, position:  3.34 GBytes  4.43 cycles
  Newest: 2011-05-19 20:49:06,    0 days,  0:00:03 ago
  Oldest: 2010-08-30 17:43:33,  262 days,  3:05:36 ago
 Buffer a4, size:  7.81 GBytes, position:  3.33 GBytes  4.43 cycles
  Newest: 2011-05-19 20:49:06,    0 days,  0:00:03 ago
  Oldest: 2010-08-30 21:24:19,  261 days, 23:24:50 ago
 Buffer a5, size:  7.81 GBytes, position:  3.34 GBytes  4.43 cycles
  Newest: 2011-05-19 20:49:06,    0 days,  0:00:03 ago
  Oldest: 2010-08-31  2:30:48,  261 days, 18:18:21 ago
 Buffer a6, size:  7.81 GBytes, position:  3.36 GBytes  4.43 cycles
  Newest: 2011-05-19 20:49:06,    0 days,  0:00:03 ago
  Oldest: 2010-08-31  9:18:44,  261 days, 11:30:25 ago

>> In innd.c though, the limit will reflect the system limit up to a hard
>> ceiling of 5000 if rlimitnofile is left at its default (-1). This can be
>> verified at start time by the log message:
>> May 15 09:39:53 news innd: SERVER descriptors 5000
>> May 15 09:39:53 news innd: SERVER outgoing 4987
>>
>> It appears that inn is unable to support descriptors above 1024 but will
>> only impose a limit of 5000.  If the descriptors in use then exceeds
>> 1024, bad things happen.
>
> Should we then use FD_SETSIZE instead of the hard-coded 5000 value?
Yes, I think that would be a good option. Alternatively, log an error
message when descriptors exceed FD_SETSIZE.  Is there any plan to
migrate from select to epoll? I guess this would cause problems for
anyone running a <2.6 kernel?
Re: Rebuilding overview
#84112
Author: Julien ÉLIE
Date: Sat, 11 Jun 2011 08:32
61 lines
3075 bytes
Hi Steve,

>> Did you also notice an increase in the duration of expireover?  Is
>> news.daily taking a different time to run between buffindexed and
>> tradindexed overviews?
> 
> This isn't appreciably different from my buffindexed experience.

Pretty interesting to know.  (I would have thought the contrary.)
Thanks for the benchmark!


>>> After this change, makehistory ran without issues and completed in about
>>> 40 hours.
>>
>> For how many articles?
>
> I assume that's the 15616044 from 'Article lines processed' during
> expire?

Yes.
Which means 6500 messages per minute, so about a hundred per second.
Oh, thinking about it, it is not that slow!


>> Should we then use FD_SETSIZE instead of the hard-coded 5000 value?
>
> Yes, I think that would be a good option. Alternatively, log an error
> message when descriptors exceed FD_SETSIZE.  Is there any plan to
> migrate from select to epoll? I guess this would cause problems for
> anyone running a<2.6 kernel?

In innd/innd.c:

     i = getfdlimit();

     if (i < 0)
         sysdie("SERVER cant get file descriptor limit");
 
+#ifdef FD_SETSIZE
+    if (i > FD_SETSIZE) {
+        syslog(LOG_WARNING, "%s number of descriptors %d exceeding FD_SETSIZE %d",
+               LogName, i, FD_SETSIZE);
+        i = FD_SETSIZE;
+    }
+#endif



Seems to work fine. 
(Log done with the condition (i >= FD_SETSIZE), just for testing purpose.)

Jun 11 10:04:32 news innd: SERVER number of descriptors 1024 exceeding FD_SETSIZE 1024
Jun 11 10:04:32 news innd: SERVER descriptors 1024
Jun 11 10:04:32 news innd: SERVER outgoing 1011

-- 
Julien ÉLIE

« Un voyage de mille lieues commence toujours par un premier pas. »
  (Lao Zi)
Re: Rebuilding overview
#84113
Author: 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)
Re: Rebuilding overview
#84114
Author: Julien ÉLIE
Date: Sat, 11 Jun 2011 09:03
39 lines
2466 bytes
Hi all,

> 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.

I think this discussion on inn-workers answers the question:
https://lists.isc.org/mailman/htdig/inn-workers/2000-April/002336.html

"innd is a heavy user of select(), and Bad Things will happen if you try 
to use fds > 1023 with select() pre Solaris 7...
Yeah, if I recall correctly, the FD_*() macros will happily scribble all 
over memory if you try to initialize an fd_set that's larger than 1024."


I understand for innd.
But something still puzzles me.  What for backends/innxmit.c where we have:

     fd_set rmask;

     FromServer = fileno(From);
     FD_ZERO(&rmask);
     FD_SET(FromServer, &rmask);
     i = select(FromServer + 1, &rmask, NULL, NULL, &t);

Don't we have a problem if we do not check the value of FromServer with 
FD_SETSIZE?



Same thing in a few other programs.  For instance authprogs/radius.c:

     sock = socket(AF_INET, SOCK_DGRAM, 0)
     got = select(sock+1, &rdfds, 0, 0, &tmout);

-- 
Julien ÉLIE

« Un voyage de mille lieues commence toujours par un premier pas. »
   (Lao Zi)
Re: Rebuilding overview
#84119
Author: Russ Allbery
Date: Sat, 11 Jun 2011 19:50
32 lines
2537 bytes
Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> writes:

> I understand for innd.
> But something still puzzles me.  What for backends/innxmit.c where we have:

>     fd_set rmask;

>     FromServer = fileno(From);
>     FD_ZERO(&rmask);
>     FD_SET(FromServer, &rmask);
>     i = select(FromServer + 1, &rmask, NULL, NULL, &t);

> Don't we have a problem if we do not check the value of FromServer with
> FD_SETSIZE?

Once upon a time, the limit on file descriptor numbers in stdio was even
lower than that for FD_SETSIZE, but that's probably not true any more.
However, it's likely true for anything that would do something
particularly horrible if the file descriptor number is larger than
FD_SETSIZE.

But probably somewhat more to the point, it's hard to see how innxmit
would ever open enough connections to get a large file descriptor number.
They're always allocated starting with 3 (since 0, 1, and 2 are stdin,
stdout, and stderr), so if you only open a few sockets, there's usually no
need to worry about it.

-- 
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: Rebuilding overview
#84271
Author: Julien ÉLIE
Date: Wed, 31 Aug 2011 21:21
37 lines
2513 bytes
Hi Steve,

> As a side note: My Debian Squeeze server runs rsyslog [...]
>
> After some investigation and feedback from Julien, it seems that the
> artificial 1024 descriptor limit is caused by inn's use of 'select'. In
> innd.c though, the limit will reflect the system limit up to a hard
> ceiling of 5000 if rlimitnofile is left at its default (-1).

Having yet another look at this issue, I wonder whether there is not a 
problem with BSD systems.
I read in http://linux.die.net/man/2/setrlimit that RLIMIT_OFILE is the 
BSD name for RLIMIT_NOFILE.

In lib/fdlimit.c, we never define RLIMIT_OFILE and only use:

#if HAVE_GETRLIMIT && defined(RLIMIT_NOFILE)
int
getfdlimit(void)
{
     struct rlimit rl;

     if (getrlimit(RLIMIT_NOFILE, &rl) < 0)
         return -1;
     return rl.rlim_cur;
}
[...]


Maybe we should define RLIMIT_NOFILE to RLIMIT_OFILE if the first one is 
not set and the second one is?  This way, lib/fdlimit.c would work on 
BSD systems the way it is expected to.  (?)

-- 
Julien ÉLIE

« Medicus curat, natura sanat. »
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