[ntp:bugs] [Bug 3050] New: Fix for bug #2960 causes sntp to print a spurious error message

bugzilla-daemon at ntp.org bugzilla-daemon at ntp.org
Wed May 11 10:08:15 UTC 2016


             Bug #: 3050
           Summary: Fix for bug #2960 causes sntp to print a spurious
                    error message
           Product: ntp
           Version: 4.2.8
          Platform: PC
        OS/Version: Linux
            Status: CONFIRMED
          Severity: enhancement
          Priority: P5
         Component: ntpd
        AssignedTo: stenn at ntp.org
        ReportedBy: max at suse.com
                CC: bugs at ntp.org
    Classification: Unclassified

The fix for bug #2960 causes sntp to print an error message under Linux in
addition to its normal operation:
--- snip ---
error waiting on child 29607: No child processes
--- snap ---

This is because fork_blocking_child() in libntp/work_fork.c ignores SIGCHLD,
which makes waipid() in harvest_child_status() fail with ECHILD.

This is what the Linux wait(2) manpage says about this situation:
--- snip ---
       POSIX.1-2001  specifies  that  if  the disposition of SIGCHLD is set to
       SIG_IGN or the SA_NOCLDWAIT flag is set for SIGCHLD (see sigaction(2)),
       then children that terminate do not become zombies and a call to wait()
       or waitpid() will block until all children have  terminated,  and  then
       fail  with  errno set to ECHILD.  (The original POSIX standard left the
       behavior of setting SIGCHLD to SIG_IGN  unspecified.   Note  that  even
       though  the default disposition of SIGCHLD is "ignore", explicitly set-
       ting the disposition to SIG_IGN results in different treatment of  zom-
       bie process children.)

       Linux  2.6 conforms to the POSIX requirements.  However, Linux 2.4 (and
       earlier) does not: if a wait() or waitpid() call is made while  SIGCHLD
       is  being  ignored,  the  call  behaves just as though SIGCHLD were not
       being ignored, that is, the call blocks until the next child terminates
       and then returns the process ID and status of that child.
--- snap ---

Given that explicitly setting SIGCHLD to SIG_IGN results in either unwanted or
undefined behaviour, I think the respective call should be removed:

--- snip ---
--- ntp-4.2.8p7.orig/libntp/work_fork.c
+++ ntp-4.2.8p7/libntp/work_fork.c
@@ -461,8 +461,6 @@

-       signal_no_reset(SIGCHLD, SIG_IGN);
        childpid = fork();
        if (-1 == childpid) {
                msyslog(LOG_ERR, "unable to fork worker: %m");
--- snap ---

Configure bugmail: http://bugs.ntp.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the bugs-announce mailing list