4 innduct \- quickly and reliably stream Usenet articles to remote site
12 implements NNTP peer-to-peer news transmission including the streaming
13 extensions, for sending news articles to a remote site. It is
14 intended as a replacement for
21 You need to run one instance of innduct for each peer site. innduct
22 manages its interaction with
24 including flushing the feed as appropriate, etc., so that articles are
25 transmitted quickly, and manages the retransmission of its own
26 backlog. innduct includes the locking necessary to avoid multiple
27 simutaneous invocations.
29 By default, innduct reads the default feedfile corresponding to
33 .IR pathoutgoing / site )
34 and feeds it via NNTP, streaming if possible, to the host
38 is not specified, it defaults to
41 innduct daemonises after argument parsing, and all logging (including
42 error messages) are sent to syslog (facility
45 The best way to run innduct is probably to periodically invoke it
46 for each feed (e.g. from cron), passing the
48 option to arrange that innduct silently exits if an instance is
49 already running for that site.
52 .BR \-f | \-\-feedfile= \fIDIR\fR / |\fIPATH\fR
55 to read, and indirectly specifies the paths to
56 be used for various associated files (see FILES, below).
59 it is taken as a directory to use, and the actual feed file used is
67 it is taken to be relative to
73 .BR \-q | \-\-quiet-multiple
74 Makes innduct silently exit (with status 0) if another innduct holds
75 the lock for the site. Without \fB-q\fR, this causes a fatal error to
76 be logged and a nonzero exit.
79 Do not daemonise. innduct runs in the foreground, but otherwise
80 operates normally (logging to syslog, etc.).
83 Do not daemonise. innduct runs in the foreground and all messages
84 (including all debug messages) are written to stderr rather than
85 syslog. A control command line is also available on stdin/stdout.
88 Do not try to use the streaming extensions to NNTP (for use eg if the
89 peer can't cope when we send MODE STREAM).
92 Do not try to use the file change monitoring support to watch for
93 writes by innd to the feed file; poll it instead. (If file monitoring
94 is not compiled in, this option just downgrades the log message which
95 warns about this situation.)
97 .BR \-C | \-\-inndconf= \fIFILE\fR
100 instead of the default
106 at the remote site rather than to the NNTP port (119).
108 .BI \-\-chdir= PATHRUN
111 at startup. The default is
115 .BR \-\-cli= \fICLI-DIR\fR / |\fICLI-PATH\fR| none
116 Listen for control command line connections on
118 (if the value ends with a
122 (if it doesn't). See CONTROLLING INNDUCT, below.
123 Note that there is a fairly short limit on the lengths of AF_UNIX
124 socket pathnames. If specified as
126 the directory will be created with mode 700 if necessary.
129 which means to create that directory in
132 .RB \fIPATHRUN\fR /innduct/ \fIsite\fR.
135 Just print a brief usage message and list of the options to stdout.
137 See TUNING OPTIONS below for more options.
138 .SH CONTROLLING INNDUCT
139 If you tell innd to drop the feed, innduct will (when it notices,
140 which will normally be the next time it decides to flush) finish up the
141 articles it has in hand now, and then exit. It is harmless to cause
142 innd to flush the feed (but innduct won't notice and flushing won't
143 start a new feedfile; you have to leave that to innduct).
145 If you want to stop innduct you can send it SIGTERM or SIGINT, or the
147 control command, in which case it will report statistics so far and
148 quickly exit. If innduct receives SIGKILL nothing will be broken or
149 corrupted; you just won't see some of the article stats.
151 innduct listens on an AF_UNIX socket (by default,
152 .IR pathrun \fB/innduct/\fR site ),
153 and provides a command-line interface which can be used to trigger
154 various events and for debugging. When a connection arrives, innduct
155 writes a prompt, reads commands a line at a time, and writes any
156 output back to the caller. (Everything uses unix line endings.) The
157 cli can most easily be accessed with a program like
161 .RI \fB/var/run/news/innduct/\fR site )
167 The following control commands are supported:
170 Print a list of all the commands understood. This list includes
171 undocumented commands which mess with innduct's internal state and
172 should only be used by a developer in conjuction with the innduct
176 Start a new feed file and trigger a flush of the feed. (Or, cause
178 .I FLUSH-FINISH-PERIOD
179 to expire early, forcibly completing a previously started flush.)
182 Log statistics and exit. (Same effect as SIGTERM or SIGINT.)
185 Log statistics so far and zero the stats counters. Stats are also
186 logged periodically, when an input file is completed and just before
190 Writes information about innduct's state to a plain text file
191 .IR feedfile \fB_dump\fR.
192 This overwrites any previous dump. innduct does not ever delete these
195 gives a summary including general state and a list of connections;
197 also includes information about each article innduct is dealing with.
200 Requests that innduct rescan for new backlog files at the next
202 poll. Normally innduct assumes that any backlog files dropped in by
203 the administrator are not urgent, and it may not get around to
205 .IR BACKLOG-SCAN-PERIOD .
208 Resets the connection startup delay counter so that innduct may
209 consider making a new connection to the peer right away, regardless
211 .IR RECONNECT-PERIOD .
212 A connection attempt will still only be made if innduct feels that it
213 needs one, and innduct may wait up to
215 before actually starting the attempt.
217 You should not normally need to adjust these. Time intervals may
218 specified in seconds, or as a number followed by one of the following
221 .BR "sec min hour day" ,
224 .BI \-\-max-connections= max
225 Restricts the maximum number of simultaneous NNTP connections
228 There is no global limit on the number of connections used by all
229 innducts, as the instances for different sites are entirely
234 .BI \-\-max-queue-per-conn= per-conn-max
235 Restricts the maximum number of outstanding articles queued on any
236 particular connection to
238 (Non-streaming connections can only handle one article at a time.)
242 .BI \-\-max-queue-per-file= max
243 Restricts the maximum number articles read into core from any one
250 .BI \-\-feedfile-flush-size= bytes
251 Specifies that innduct should flush the feed and start a new feedfile
252 when the existing feedfile size exceeds
254 the effect is that the innduct will try to avoid the various
255 batchfiles growing much beyond this size. The default is
258 .BI \-\-period-interval= PERIOD-INTERVAL
259 Specifies wakup interval and period granularity.
260 innduct wakes up every
262 to do various housekeeping checks. Also, many of the timeout and
263 rescan intervals (those specified in this manual as
265 are rounded up to the next multiple of
266 .IR PERIOD-INTERVAL .
270 .BI \-\-connection-timeout= TIME
271 How long to allow for a connection setup attempt before giving up.
275 .BI \-\-stuck-flush-timeout= TIME
276 How long to wait for innd to respond to a flush request before giving
280 .BI \-\-feedfile-poll= TIME
281 How often to poll the feedfile for new articles written by innd
284 or equivalent) is not available. (When file monitoring is available,
285 there is no need for periodic checks and we wake immediately up
286 whenever the feedfile changes.)
290 .BI \-\-no-check-proportion= PERCENT
291 If the moving average of the proportion of articles being accepted
292 (rather than declined) by the peer exceeds this value, innduct uses
293 "no check mode" - ie it just sends the peer the articles with TAKETHIS
294 rather than checking first with CHECK whether the article is wanted.
295 This only affects streaming connections. The default is
299 .BI \-\-no-check-response-time= ARTICLES
300 The moving average mentioned above is an alpha-smoothed value with a
306 .BI \-\-reconnect-interval= RECONNECT-PERIOD
307 Limits initiation of new connections to one each
308 .IR RECONNECT-PERIOD .
309 This applies to reconnections if the peer has been down, and also to
310 ramping up the number of connections we are using after startup or in
311 response to an article flood. The default is
314 .BI \-\-flush-retry-interval= PERIOD
315 If our attempt to flush the feed failed (usually this will be because
316 innd is not running), try again after
321 .BI \-\-earliest-deferred-retry= PERIOD
322 When the peer responds to our offer of an article with a 431 or 436
323 NNTP response code, indicating that the article has already been
324 offered to it by another of its peers, and that we should try again,
327 before offering the article again. The default is
330 .BI \-\-backlog-rescan-interval= BACKLOG-SCAN-PERIOD
331 We scan the directory containing
333 for backlog files at least every
334 .IR BACKLOG-SCAN-PERIOD ,
335 in case the administrator has manually dropped in a file there for
340 .BI \-\-max-flush-interval= PERIOD
341 We flush the feed and start a new feedfile at least every
343 even if the current instance of the feedfile has not reached the size
348 .BI \-\-flush-finish-timeout= FLUSH-FINISH-PERIOD
350 .IR FLUSH-FINISH-PERIOD
351 ago, and are still trying to finish processing articles that were
352 written to the old feed file, we forcibly and violently make sure that
353 we can finish the old feed file: we abandon and defer all the work,
354 which includes unceremoniously dropping any connections on which
355 we've sent some of those articles but not yet had replies, as they're
356 probably stuck somehow. The default is
359 .BI \-\-idle-timeout= PERIOD
360 Connections which have had no activity for
362 will be closed. This includes connections where we have sent commands
363 or articles but have not yet had the responses, so this same value
364 doubles as the timeout after which we conclude that the peer is
365 unresponsive or the connection has become broken.
369 .BI \-\-stats-log-interval= PERIOD
370 Log statistics at least every
375 .BI \-\-low-volume-thresh= "WIN-THRESH " \-\-low-volume-window= "PERIOD "
376 If innduct has only one connection to the peer, and has processed
381 and also no articles in the last
383 it will close the connection quickly. That is, innduct switches to a
384 mode where it opens a connection for each article (or, perhaps, each
385 handful of articles arriving together).
386 The default is to close if fewer than
391 .BI \-\-max-bad-input-data-ratio= PERCENT
392 We tolerate up to this proportion of badly-formatted lines in the
393 feedfile and other input files. Every badly-formatted line is logged,
394 but if there are too many we conclude that the corruption to our
395 on-disk data is too severe, and crash; to successfully restart,
396 administrator intervention will be required. This avoids flooding the
397 logs with warnings and also arranges to abort earlyish if an attempt
398 is made to process a file in the wrong format. We need to tolerate a
399 small proportion of broken lines, if for no other reason than that a
400 crash might leave a half-blanked-out entry. The default is
404 .BI \-\-max-bad-input-data-init= LINES
405 Additionally, we tolerate this number of additional badly-formatted
406 lines, so that if the badly-formatted lines are a few but at the start
407 of the file, we don't crash immediately.
410 (which would suffice to ignore one whole corrupt 4096-byte disk block
411 filled with random data, or one corrupt 1024-byte disk block filled
412 with an inappropriate text file with a mean line length of at least
414 .SH INNDUCT VS INNFEED/NNTPSEND/INNXMIT
417 does roughly the same thing as innduct. However, the way it receives
418 information from innd can result in articles being lost (not offered
419 to peers) if innfeed crashes for any reason. This is an inherent
420 defect in the innd channel feed protocol. innduct uses a file feed,
421 constantly "tailing" the feed file, and where implemented uses
423 to reduce the latency which would come from having to constantly poll
424 the feed file. innduct is much smaller and simpler, at <5kloc to
425 innfeed's ~25kloc. innfeed needs a separate helper script or similar
426 infrastructure (of which there is an example in its manpage), whereas
427 innduct can be run directly and doesn't need help from shell scripts.
428 However, innfeed is capable of feeding multiple peers from a single
429 innfeed instance, whereas each innduct process handles exactly one
433 processes feed files in batch mode. That is, you have to periodically
434 invoke nntpsend, and when you do, the feed is flushed and articles
435 which arrived before the flush are sent to the peer. This introduces
436 a batching delay, and also means that the NNTP connection to the peer
437 needs to be remade at each batch. nntpsend (which uses innxmit)
438 cannot make use of multiple connections to a single peer site.
439 However, nntpsend automatically find which sites need feeding by
442 whereas the administrator needs to arrange to invoke innduct
443 separately for each peer.
446 is the actual NNTP feeder program used by nntpsend.
450 \fBinnfeed\fR \fBinnduct\fR \fBnntpsend/innxmit\fR
451 realtime feed Yes Yes No
453 source code size 24kloc 4.6kloc 1.9kloc
454 invoke once for all sites Yes No Yes
455 number of processes one 1/site 2/site, intermittently
460 An instance of innduct is already running for this
467 The feed has been dropped by innd, and we (or previous innducts) have
468 successfully offered all the old articles to the peer site. Our work
472 innduct was invoked with bad options or command line arguments. The
473 error message will be printed to stderr, and also (if any options or
474 arguments were passed at all) to syslog with severity
478 Things are going wrong, hopefully shortage of memory, system file
479 table entries; disk IO problems; disk full; etc. The specifics of the
480 error will be logged to syslog with severity
482 (if syslog is working!)
485 Things are going badly wrong in an unexpected way: system calls which
486 are not expected to fail are doing so, or the protocol for
487 communicating with innd is being violated, or some such. Details will
488 be logged with severity
490 (if syslog is working!)
493 These exit statuses are used by children forked by innduct to
494 communicate to the parent. You should not see them. If you do, it is
497 innduct dances a somewhat complicated dance with innd to make sure
498 that everything goes smoothly and that there are no races. (See the
499 two ascii-art diagrams in README.states for details of the protocol.) Do
500 not mess with the feedfile and other associated files, other than as
504 .IX Item "default directory"
505 Default current working directory for innduct, and also default
506 grandparent directory for the command line socket.
507 .IP \fIpathoutgoing\fR/\fIsite\fR
508 .IX Item "default feedfile"
513 Main feed file as specified in
515 This and other batchfiles used by innduct contains lines each of which
517 \& \fItoken\fR \fImessageid\fR
518 where \fItoken\fR is the inn storage API token. Such lines can be
519 written by \fBTf,Wnm\fR in a \fInewsfeeds\fR(5) entry. During
520 processing, innduct overwrites lines in the batch files which
521 correspond to articles it has processed: each such line is replaced
522 with one containing only spaces. Only innd should create
524 and only innduct should remove it.
525 .IP \fIfeedfile\fR_lock
527 Lockfile, preventing multiple innduct invocations for the same
528 feed. A process holds this lock after it has opened the lockfile,
529 made an fcntl F_SETLK call, and then checked with stat and fstat that
530 the file it now has open and has locked still has the name
531 \fIfeedfile\fR_lock. (Only) the lockholder may delete the lockfile.
532 For your convenience, after the lockfile is locked,
539 are all written to the lockfile. NB that stale lockfiles may contain
540 stale data so this information should not be relied on other than for
542 .IP \fIfeedfile\fR_flushing
543 .IX Item "flushing file"
544 Batch file: the main feedfile is renamed to this filename by innduct
545 before it asks inn to flush the feed. Only innduct should create,
546 modify or remove this file.
547 .IP \fIfeedfile\fR_defer
548 .IX Item "flushing file"
549 Batch file containing details of articles whose transmission has very
550 recently been deferred at the request of the recipient site. Created,
551 written, read and removed (only) by innduct.
552 .IP \fIfeedfile\fR_backlog.\fItime_t\fR.\fIinum\fR
553 .IX Item "backlog file"
554 Batch file containing details of articles whose transmission has less
555 recently been deferred at the request of the recipient site. Created
556 by innduct, and will also be read, updated and removed by innduct.
557 However you (the administrator) may also safely remove backlog files.
558 .IP \fIfeedfile\fR_backlog\fIsomething\fR
559 .IX Item "manual backlog file"
560 Batch file manually provided by the administrator. innduct will
561 automatically find, read and process any file matching this pattern
562 (blanking out entries for processed articles) and eventually remove
563 it. \fIsomething\fR may not contain \fB#\fR \fB~\fR or \fB/\fR.
565 Be sure to have finished writing the file before you rename it to
566 match the pattern \fIfeedfile\fR\fB_backlog\fR*, as otherwise innduct
567 may find and process the file, and even think it has finished it,
568 before you have written the complete file. You may also safely remove
570 .IP \fIpathrun\fR\fB/innduct/\fB\fIsite\fR
571 .IX Item "control command line socket"
572 Default AF_UNIX listening socket for the control command line. See
573 CONTROLLING INNDUCT, above.
574 .IP \fIfeedfile\fR_dump
575 .IX Item "debug dump file"
576 On request via a control connection innduct dumps a summary of its
577 state to this text file. This is mostly useful for debugging.
578 .IP /etc/news/inn.conf
584 and associated paths),
588 and hence effective default
592 for finding how to communicate with innd, and also for
597 Written by Ian Jackson <ijackson@chiark.greenend.org.uk>