INN commit: branches/2.6 (backends/nntpsend.in doc/pod/news.pod)

INN Commit rra at isc.org
Thu Dec 10 20:28:37 UTC 2015


    Date: Thursday, December 10, 2015 @ 12:28:37
  Author: iulius
Revision: 9969

nntpsend:  correctly exit after all of the child processes exit

The documentation for nntpsend claims that it waits until all of the
child innxmit processes exit before it does, but it doesn't.

The reason it does not is because it starts the innxmit processes,
or more accurately the subshells that start the innxmit processes,
in a while loop that is itself in a child process of the main shell,
because of this line:

    cat ${INPUT} | while read SITE HOST SIZE_ARG FLAGS; do

Since the while loop is in a pipe, it's executed in a child process. As
a result, its child processes, i.e., the ones running innxmit, are not
direct children of the nntpsend shell script's process, so it doesn't
wait for them.

Note that this bug causes nntpsend to fail to work properly on systems
that use systemd, because when nntpsend exits prematurely, systemd
kills all of the processes it launched, including the innxmit processes.

Thanks to Jonathan Kamens for the patch.

Modified:
  branches/2.6/backends/nntpsend.in
  branches/2.6/doc/pod/news.pod

----------------------+
 backends/nntpsend.in |    4 ++--
 doc/pod/news.pod     |    8 ++++++++
 2 files changed, 10 insertions(+), 2 deletions(-)

Modified: backends/nntpsend.in
===================================================================
--- backends/nntpsend.in	2015-12-10 20:27:39 UTC (rev 9968)
+++ backends/nntpsend.in	2015-12-10 20:28:37 UTC (rev 9969)
@@ -201,7 +201,7 @@
 export BATCH PROGNAME PARENTPID INNFLAGS
 
 ##  Loop over all sites.
-cat ${INPUT} | while read SITE HOST SIZE_ARG FLAGS; do
+while read SITE HOST SIZE_ARG FLAGS; do
     ## Parse the input parameters.
     if [ -z "${SITE}" -o -z "${HOST}" ] ; then
 	echo "Ignoring bad line: ${SITE} ${HOST} ${SIZE_ARG} ${FLAGS}" 1>&2
@@ -445,7 +445,7 @@
 	fi
 	rm -f ${LOCK}
     ' &
-done
+done < ${INPUT}
 
 ##  Release the nntpsend lock and clean up before we wait on child processes.
 if [ -z "${NOLOCK}" ]; then

Modified: doc/pod/news.pod
===================================================================
--- doc/pod/news.pod	2015-12-10 20:27:39 UTC (rev 9968)
+++ doc/pod/news.pod	2015-12-10 20:28:37 UTC (rev 9969)
@@ -12,6 +12,14 @@
 were taking benefit from that parameter.  Thanks to Steve Crook for
 the bug report.
 
+=item *
+
+B<nntpsend> now correctly waits until all of the child B<innxmit>
+processes exit before it does.  It was causing B<nntpsend> to fail
+to work properly on systems that use systemd, because when it exits
+prematurely, systemd kills all of the processes it launched, including
+the B<innxmit> processes.  Thanks to Jonathan Kamens for the patch.
+
 =back
 
 =head1 Upgrading from 2.5 to 2.6



More information about the inn-committers mailing list