From dev-return-35931-apmail-httpd-dev-archive=httpd.apache.org@httpd.apache.org Thu Jan 30 19:31:15 2003
Return-Path:
Delivered-To: apmail-httpd-dev-archive@httpd.apache.org
Received: (qmail 99460 invoked by uid 500); 30 Jan 2003 19:31:14 -0000
Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm
Precedence: bulk
Reply-To: dev@httpd.apache.org
list-help:
list-unsubscribe:
list-post:
Delivered-To: mailing list dev@httpd.apache.org
Received: (qmail 99279 invoked from network); 30 Jan 2003 19:31:11 -0000
Message-ID: <3E397D5D.2090003@wstoddard.com>
Date: Thu, 30 Jan 2003 14:30:37 -0500
From: Bill Stoddard
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2.1) Gecko/20021130
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: "William A. Rowe, Jr." , dev@apr.apache.org,
dev@httpd.apache.org
Subject: Re: Altogether Broken OtherChild logic
References: <5.2.0.9.2.20030124110322.03045588@pop3.rowe-clan.net>
In-Reply-To: <5.2.0.9.2.20030124110322.03045588@pop3.rowe-clan.net>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N
William A. Rowe, Jr. wrote:
>I belive I've deciphered the "RotateLogs doesn't work for access logs
>on Windows" Apache 2.0.44 bug. It's actually many bugs in conformance.
>
>First, rbb's reorg of the WinNT pipe logic (apr/file_io/win32/pipe.c rev 1.46)
>causes server/log.c ap_open_piped_log() to create an async (nonblocking)
>pipe. This was very cool for internal pipes. However, console apps that are
>unprepared for Overlapped IO (read: all of them) will die given an Overlapped
>pipe handle. Even APR doesn't assume (and shouldn't) that a pipe handle
>passed as stdin/stdout is an Async handle. However, Async handles are
>the only way to do timeouts.
>
>Unix ap_file_pipe_create() always creates the pipes blocking. In fixing the
>bug, by creating blocking handles (that can't be timed out) for Win32, I also
>discovered our nonblocking pipe logic was reversed for parent/child handles
>of the child stdin process. I've just committed all those fixes, so this aspect
>was patched as well. If you look at the new apr_create_nt_pipe() API, it
>might be worth renaming and exporting it as apr_file_pipe_create_ex().
>It's similar to apr_file_pipe_create() with the added blocking mode argument
>(APR_FULL_BLOCK, APR_FULL_NONBLOCK, APR_READ_BLOCK and
>APR_WRITE_BLOCK). APR_PARENT/CHILD_BLOCK only makes sense
>to a function like apr_procattr_io_set. In fact, for safety, that creation call
>should never create NONBLOCK child pipes, but that's another discussion.
>
>So part one was fixed, now we create the access log's rotatelogs process
>with a good stdin stream. It survives to log an entry, but only until we call
>apr_proc_other_child_check within the WinNT MPM's *maintenence* loop.
>
>It seems that apr_proc_other_child_check is only being used during teardown
>of the Unix children. It also seems that the 'correct' flag passed to the maint
>function for your registered otherchild is APR_OC_REASON_RESTART when
>the process is still running.
>
>Now mod_log_config kills the child process on APR_OC_REASON_RESTART.
>Because Win32 doesn't call the function in maintenance like unix, but in a one
>second health-check loop, we are blowing away our access logger process.
>
>Finally, it looks like apr_proc_other_child_read is the function we *really* wanted
>to use within the health check. But it seems all of these apr_proc_other_child
>functions are really misdocumented within APR. Would someone step up and
>spell out exactly what they are *supposed* to be doing within unix, and then we
>can discuss how to make them portable to Win32? It seems we have too much
>bubblegum and bailing wire holding them together, and the fixes that I made to
>do *exactly* what Unix was doing has killed the WinNT mpm.
>
>Bill
>
What we want to do in the winnt MPM maintenance loop is peridically
check to see of the process is still alive. It it is dead, it needs to
be restarted (ie, reliable piped logs). apr_proc_other_child_read was
used in the Unix side of the house to do a periodic read of the pipe to
an OC. On Unix, you can tell if the process on the other end is still
alive by doing a read on the pipe. Cannot do that with pipes on Windows,
so we use apr_proc_other_child_check instead. I think we need one
function (call it what you will but apr_proc_other_child_check seems
okay to me) that checks the status of an OC and performs an action
(specified on the call to apr_proc_other_child_check) based on the
status. I am guessing that the windows MPM is whacking the piped logger
because ocr->proc->hproc is somehow hosed.
Bill