You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2018/04/06 15:57:40 UTC

[Bug 62268] New: Using the -p option on rotatelogs causes it to fail in apr_poll()

https://bz.apache.org/bugzilla/show_bug.cgi?id=62268

            Bug ID: 62268
           Summary: Using the -p option on rotatelogs causes it to fail in
                    apr_poll()
           Product: Apache httpd-2
           Version: 2.4.33
          Hardware: PC
                OS: NetBSD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: support
          Assignee: bugs@httpd.apache.org
          Reporter: john@iastate.edu
  Target Milestone: ---

Using the "-p program" option causes rotatelogs to fail in its call to
apr_poll() when the program exits and the underlying poll() system errors with
EINTR due to the SIGCHLD.   This is logged in Apache's error_log as:

piped log program '/usr/local/etc/rotatelogs -c -f -l -p /usr/local/etc/zipit
-L /var/log/httpd/dnsrpz_log /var/log/httpd/dnsrpz_log.%Y-%m 86400' failed
unexpectedly
Unable to poll stdin

Removing the "-p program" option is an unsatisfactory workaround.

The code in question:

                pollret = apr_poll(&pollfd, 1, &pollret,
apr_time_from_sec(polltimeout));
            }
        }
        if (pollret == APR_SUCCESS) {
            rv = apr_file_read(f_stdin, buf, &nRead);
            if (APR_STATUS_IS_EOF(rv)) {
                break;
            }
            else if (rv != APR_SUCCESS) {
                exit(3);
            }
        }
        else if (pollret == APR_TIMEUP) {
            *buf = 0;   
            nRead = 0;
        }
        else {
            fprintf(stderr, "Unable to poll stdin\n");
            exit(5);
        }

before the final "else" should be a check for EINTR and a "continue;" used to
cause the call to apr_poll() to just be retried in that case:

        else if (pollret == APR_TIMEUP) {
            *buf = 0;   
            nRead = 0;
        }
        else if (pollret == APR_EINTR) {   /* <========== */
            continue;
        }
        else {
            fprintf(stderr, "Unable to poll stdin\n");
            exit(5);
        }

There may be other approaches (eg ignore SIGCHLD).

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 62268] Using the -p option on rotatelogs causes it to fail in apr_poll()

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62268

Joe Orton <jo...@redhat.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

--- Comment #1 from Joe Orton <jo...@redhat.com> ---
We should ignore SIGCHLD already - can you get strace output or similar?

        case 'p':
            config.postrotate_prog = opt_arg;
#ifdef SIGCHLD
            /* Prevent creation of zombies (on modern Unix systems). */
            apr_signal(SIGCHLD, SIG_IGN);
#endif
            break;

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org