🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
9 messages
9 total messages Started by Michael Grimm Thu, 07 Apr 2011 18:32
New CNFS buffers not reported in daily report after "ctlinnd xexec innd"
#83965
Author: Michael Grimm
Date: Thu, 07 Apr 2011 18:32
28 lines
2118 bytes
Hi --

[That's about an INN current 20100814]

I recently added some additional CNFS buffers. According cycbuff.conf(5)
I finalised my modification by "ctlinnd xexec innd":
,----
| innd only reads cycbuff.conf on startup, so if you change anything in
| this file and want innd to pick up the changes, you have to use
| "ctlinnd xexec innd"; "ctlinnd reload all ''" is not sufficient.
`----

All CNFS buffers became initialised as usual, and cnfsstat showed them
as usual, good. Today I realised that those newly added buffers didn't
show up in news daily reports ever since their addition.

No wonder, they didn't show up in news.notice either. Only after a manual 
"ctlinnd -s" they became logged in news.notice.

Thus, I did restart innd by its init scripts, and now, all new buffers
became logged in news.daily at the defined interval.

Hmm, bug, feature, erroneous manual page, anything I do miss?

Regards,
Michael
-- 
to let
Re: New CNFS buffers not reported in daily report after "ctlinnd xexec innd"
#83963
Author: Russ Allbery
Date: Thu, 07 Apr 2011 18:36
16 lines
1811 bytes
Michael Grimm <trashcan@odo.in-berlin.de> writes:

> Thus, I did restart innd by its init scripts, and now, all new buffers
> became logged in news.daily at the defined interval.

> Hmm, bug, feature, erroneous manual page, anything I do miss?

cnfsstat, which reports on the buffers, isn't restarted by ctlinnd xexec
(but is by the init script).  It's just a reporting problem; they're in
use after the xexec, just not being monitored.

-- 
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: New CNFS buffers not reported in daily report after "ctlinnd xexec innd"
#83966
Author: Julien ÉLIE
Date: Thu, 07 Apr 2011 19:58
26 lines
2496 bytes
Hi Russ,

>> Thus, I did restart innd by its init scripts, and now, all new buffers
>> became logged in news.daily at the defined interval.
>
> cnfsstat, which reports on the buffers, isn't restarted by ctlinnd xexec
> (but is by the init script).  It's just a reporting problem; they're in
> use after the xexec, just not being monitored.

Oh, that's an interesting point.

Shouldn't we add an option to cnfsstat to reload storage.conf and 
cycbuff.conf from time to time?  For instance each day by default.  But 
it could be changed (or disabled) by a flag passed to cnfsstat.

The problem is that it could lead to unexpected logs in case the two 
configuration files are not the right ones to use at the time cnfsstat 
reloads them.  For instance if the news administrator is modifying them 
but still has not restarted INN.
I do not know what the best thing to do is in this scenario.

-- 
Julien ÉLIE

« Le travail, c'est le refuge des gens qui n'ont rien de mieux à
   faire. » (Oscar Wilde)
Re: New CNFS buffers not reported in daily report after "ctlinnd xexec innd"
#83968
Author: Russ Allbery
Date: Thu, 07 Apr 2011 20:01
31 lines
2581 bytes
Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> writes:

> Oh, that's an interesting point.

> Shouldn't we add an option to cnfsstat to reload storage.conf and
> cycbuff.conf from time to time?  For instance each day by default.  But
> it could be changed (or disabled) by a flag passed to cnfsstat.

Yeah, that's what I was thinking.  All it would need to do is check the
last modification time of those files periodically and reload them
automatically if they change.

> The problem is that it could lead to unexpected logs in case the two
> configuration files are not the right ones to use at the time cnfsstat
> reloads them.  For instance if the news administrator is modifying them
> but still has not restarted INN.

Hm, true.

> I do not know what the best thing to do is in this scenario.

I think it's probably okay to reload them, as long as we don't die if they
don't exist or have other problems.  I don't think people change their
configuration and then leave INN running without a restart for extended
periods of time very often.

-- 
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: New CNFS buffers not reported in daily report after "ctlinnd xexec innd"
#83969
Author: D. Stussy
Date: Thu, 07 Apr 2011 20:18
27 lines
2318 bytes
"Michael Grimm" <trashcan@odo.in-berlin.de> wrote in message
news:inkvvh$2e4i$1@de-l.enfer-du-nord.net...
> [That's about an INN current 20100814]
>
> I recently added some additional CNFS buffers. According cycbuff.conf(5)
> I finalised my modification by "ctlinnd xexec innd":
> ,----
> | innd only reads cycbuff.conf on startup, so if you change anything in
> | this file and want innd to pick up the changes, you have to use
> | "ctlinnd xexec innd"; "ctlinnd reload all ''" is not sufficient.
> `----
>
> All CNFS buffers became initialised as usual, and cnfsstat showed them
> as usual, good. Today I realised that those newly added buffers didn't
> show up in news daily reports ever since their addition.
>
> No wonder, they didn't show up in news.notice either. Only after a manual
> "ctlinnd -s" they became logged in news.notice.
>
> Thus, I did restart innd by its init scripts, and now, all new buffers
> became logged in news.daily at the defined interval.
>
> Hmm, bug, feature, erroneous manual page, anything I do miss?

Cron job, or the setting in inn.conf to spawn it directly.

Re: New CNFS buffers not reported in daily report after "ctlinnd xexec innd"
#83970
Author: Michael Grimm
Date: Fri, 08 Apr 2011 17:50
40 lines
3097 bytes
Russ Allbery <rra@stanford.edu> wrote:
> Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> writes:

First of all, thanks for the explanations regarding my observations.

>> Shouldn't we add an option to cnfsstat to reload storage.conf and
>> cycbuff.conf from time to time?  For instance each day by default.
>> But it could be changed (or disabled) by a flag passed to cnfsstat.
>
> Yeah, that's what I was thinking.  All it would need to do is check
> the last modification time of those files periodically and reload them
> automatically if they change.
>
>> The problem is that it could lead to unexpected logs in case the two
>> configuration files are not the right ones to use at the time
>> cnfsstat reloads them.  For instance if the news administrator is
>> modifying them but still has not restarted INN.
>
> Hm, true.
>
>> I do not know what the best thing to do is in this scenario.
>
> I think it's probably okay to reload them, as long as we don't die if
> they don't exist or have other problems.  I don't think people change
> their configuration and then leave INN running without a restart for
> extended periods of time very often.

What do you think about extending ctlinnd's capabilities with regard to
'ctlinnd reload cnfsstat <reason>'? That would be comparable to what a
newsadmin normally does: modifing some config files and actively
reloading them whenever he wants his modifications to become activated.

The manual page of cycbuff.conf then only needs to be modified to tell
the user that he needs to apply a 'ctlinnd xexec innd' followed by a
'ctlinnd reload cnfsstat <reason>' in order to restart cnfsstat as well.

Regards,
Michael
-- 
to let
Re: New CNFS buffers not reported in daily report after "ctlinnd xexec innd"
#83973
Author: Russ Allbery
Date: Fri, 08 Apr 2011 18:01
18 lines
2199 bytes
Michael Grimm <trashcan@odo.in-berlin.de> writes:

> What do you think about extending ctlinnd's capabilities with regard to
> 'ctlinnd reload cnfsstat <reason>'? That would be comparable to what a
> newsadmin normally does: modifing some config files and actively
> reloading them whenever he wants his modifications to become activated.

The problem there is that ctlinnd only talks to innd, and innd isn't
what's responsible for running cnfsstat.  I'm not sure that I'd want innd
to take over doing the daemon management of keeping cnfsstat running; it's
extra complexity in the critical service that seems like we might be able
to solve other ways.

-- 
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: New CNFS buffers not reported in daily report after "ctlinnd xexec innd"
#83971
Author: Michael Grimm
Date: Fri, 08 Apr 2011 18:08
18 lines
2023 bytes
Russ Allbery <rra@stanford.edu> wrote:
> Michael Grimm <trashcan@odo.in-berlin.de> writes:

>> What do you think about extending ctlinnd's capabilities with regard
>> to 'ctlinnd reload cnfsstat <reason>'? That would be comparable to
>> what a newsadmin normally does: modifing some config files and
>> actively reloading them whenever he wants his modifications to become
>> activated.
>
> The problem there is that ctlinnd only talks to innd, and innd isn't
> what's responsible for running cnfsstat.

Ok, understood. That wasn't an awfully intelligent idea then ;-)

Regards,
Michael
-- 
to let
Re: New CNFS buffers not reported in daily report after "ctlinnd xexec innd"
#84261
Author: Julien ÉLIE
Date: Thu, 11 Aug 2011 18:58
179 lines
6803 bytes
Hi Michael and Russ,

>> Shouldn't we add an option to cnfsstat to reload storage.conf and
>> cycbuff.conf from time to time?  For instance each day by default.  But
>> it could be changed (or disabled) by a flag passed to cnfsstat.
> 
> Yeah, that's what I was thinking.  All it would need to do is check the
> last modification time of those files periodically and reload them
> automatically if they change.
> 
>> The problem is that it could lead to unexpected logs in case the two
>> configuration files are not the right ones to use at the time cnfsstat
>> reloads them.  For instance if the news administrator is modifying them
>> but still has not restarted INN.
> 
> I think it's probably okay to reload them, as long as we don't die if they
> don't exist or have other problems.  I don't think people change their
> configuration and then leave INN running without a restart for extended
> periods of time very often.

Suggested patch follows.

I also changed the "Cannot open CycBuff Conffile" message because it is not
always true.  The message can be logged when an error occurs during its parsing.
Sometimes, even the parsing was incorrect, the file was accepted.  Not good IMHO
so I also changed that to refuse the file at cnfsstat startup.


Index: cnfsstat.in
===================================================================
--- cnfsstat.in	(révision 9281)
+++ cnfsstat.in	(copie de travail)
@@ -22,6 +22,7 @@
 
 my $conffile = "$INN::Config::pathetc/cycbuff.conf";
 my $storageconf = "$INN::Config::pathetc/storage.conf";
+my $lastconftime = 0;
 
 sub usage {
     print <<"_end_";
@@ -44,8 +45,11 @@
     exit(1);
 }
 
-my (%class, %buff, %stor, @storsort, @buffers);
+my (%class, %buff, %stor, @storsort);
+my (%prevclass, %prevbuff, %prevstor, @prevstorsort);
 
+my @buffers;
+
 my ($oclass, $obuffer);
 my %opt = (c=>\$oclass, m=>\$obuffer);
 Getopt::Long::config('no_ignore_case');
@@ -79,12 +83,12 @@
 my $sleeptime = (defined($opt{'l'}) && $opt{'l'} > 0) ? $opt{'l'} : 600;
 
 unless (read_cycbuffconf()) {
-    print STDERR "Cannot open CycBuff Conffile $conffile ...\n";
+    print STDERR "Invalid $conffile file.\n";
     exit (1);
 }
 
 unless (read_storageconf()) {
-    print STDERR "No valid $storageconf.\n";
+    print STDERR "Invalid $storageconf file.\n";
     exit (1);
 }
 
@@ -95,6 +99,46 @@
 
 START:
 
+# Check whether the configuration files need reloading.
+my $cycbufftime = (stat($conffile))[9];
+my $storagetime = (stat($storageconf))[9];
+my $maxtime = ($cycbufftime < $storagetime) ? $storagetime : $cycbufftime;
+
+# Set $lastconftime for the first run of the comparison.
+$lastconftime = $maxtime if not $lastconftime;
+
+if ($lastconftime < $maxtime) {
+    my $reloadok = 1;
+
+    $lastconftime = $maxtime;
+
+    # Save the previous configuration, in case reloading it fails.
+    # Direct copies of the arrays and hashes works fine here.
+    %prevclass = %class; undef %class;
+    %prevbuff = %buff; undef %buff;
+    %prevstor = %stor; undef %stor;
+    @prevstorsort = @storsort; undef @storsort;
+
+    unless (read_cycbuffconf()) {
+        print STDERR "Invalid $conffile file.\n";
+        $reloadok = 0;
+    }
+
+    unless (read_storageconf()) {
+        print STDERR "Invalid $storageconf file.\n";
+        $reloadok = 0;
+    }
+
+    # In case reloading configuration files fails, restore the
+    # previous known configuration for this run of cnfsstat.
+    if (!$reloadok) {
+        %class = %prevclass;
+        %buff = %prevbuff;
+        %stor = %prevstor;
+        @storsort = @prevstorsort;
+    }
+}
+
 my $logline;
 my $header_printed = 0;
 my ($gr, $cl, $min, $max);
@@ -216,13 +260,14 @@
 	    @line = split(/:/, $_);
 	    if ($buff{$line[1]}) {
 		print STDERR "Buff $line[1] more than one time in CycBuff Conffile $conffile ...\n";
-		return 1;
+		return 0;
 	    }
 	    $buff{$line[1]} = $line[2];
 	    next;
 	}
 
 	print STDERR "Unknown config line \"$_\" in CycBuff Conffile $conffile ...\n";
+        return 0;
     }
     close $CONFFILE;
     return 1;




Index: rc.news.pod
===================================================================
--- rc.news.pod	(r?vision 9281)
+++ rc.news.pod	(copie de travail)
@@ -32,7 +32,11 @@
 
 =item *
 
-If I<docnfsstat> is true in F<inn.conf>:  B<ovdb_init> is run;
+If I<docnfsstat> is true in F<inn.conf>:  B<cnfsstat> is started and stopped.
+
+=item *
+
+If I<ovmethod> is set to C<ovdb> in F<inn.conf>:  B<ovdb_init> is run;
 B<ovdb_server> and B<ovdb_monitor> are stopped.
 
 =item *




Index: cnfsstat.pod
===================================================================
--- cnfsstat.pod	(r?vision 9281)
+++ cnfsstat.pod	(copie de travail)
@@ -38,6 +38,10 @@
 and only exits if an error occurs.  When unspecified, the default interval
 is C<600> seconds.
 
+At each iteration, B<cnfsstat> checks whether the F<cycbuff.conf> and
+F<storage.conf> files have been modified, and loads the new configuration
+if needed.
+
 =item B<-m> I<buffer>
 
 Print information about the specified buffer in a format suitable for MRTG.




-- 
Julien ÉLIE

« Sitis licita, etiam potio licita. »
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