Bug 44034 - mpm_winnt doesn't call monitor hook
Summary: mpm_winnt doesn't call monitor hook
Status: ASSIGNED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mpm_winnt (show other bugs)
Version: 2.5-HEAD
Hardware: PC Windows XP
: P4 enhancement (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-12-06 06:32 UTC by Takashi Sato
Modified: 2008-01-03 05:19 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Takashi Sato 2007-12-06 06:32:58 UTC
http://httpd.apache.org/docs/2.2/new_features_2_2.html

Doc says:
 Monitor hook added 
 Monitor hook enables modules to run regular/scheduled jobs in the parent 
(root) process. 


but mpm_winnt doesn't call monitor hook.
Comment 1 William A. Rowe Jr. 2007-12-30 21:11:28 UTC
Win32 doesn't have the same process separation model as unix, so this one
isn't trivial to solve.

It would seem trivial to execute this monitor in the 'parent'.  However,
the parent actually isn't interrelated to the children in the same way
as on unix.  On Windows, there is a process loop in the child itself which
does all of the work, and the parent simply pauses until the child dies,
or until the server is told to shut down (and it signals the child as such).

So... the answer would appear to be, add the monitor hook to the parent.
But we need to be aware that things like the error log, listening sockets
etc, are actually being controlled by the child at that point.

So more information on your use case would be very interesting, since it's
really the users that dictate how we should fix this.
Comment 2 William A. Rowe Jr. 2007-12-30 22:04:54 UTC
Interestingly, neither do BeOS, OS2 or the Event MPM's, because that hook
is entirely predicated on AP_MPM_WANT_WAIT_OR_TIMEOUT.

It appears that a minimal parent-process implementation would add

/* number of calls to wait_or_timeout between writable probes,
 * which means nothing other than monitor hook callbacks on win32
 */
#ifndef INTERVAL_OF_WRITABLE_PROBES
#define INTERVAL_OF_WRITABLE_PROBES 10
#endif

and replace

    rv = WaitForMultipleObjects(NUM_WAIT_HANDLES, (HANDLE *) event_handles,
FALSE, INFINITE);

with

    do {
        rv = WaitForMultipleObjects(NUM_WAIT_HANDLES, (HANDLE *) event_handles, 
                                    FALSE, SCOREBOARD_MAINTENANCE_INTERVAL 
                                             / INTERVAL_OF_WRITABLE_PROBES 
                                                 / 1000);

        ap_run_monitor(p);
    } while (rv == WAIT_TIMEOUT);

where mpm_winnt already defines SCOREBOARD_MAINTENANCE_INTERVAL as 1000000.
Comment 3 William A. Rowe Jr. 2008-01-01 21:41:57 UTC
As far as I can determine, monitor_hook is not a documented feature and
isn't implied to be supported except as it's needed by a specific MPM.
This is true of many functions defined in mpm_common.h, an internal header.

But I'll leave this as an enhancement bug; and if that hook is ever defined,
we'll know better if it should run under the parent process, child process
or both.
Comment 4 Takashi Sato 2008-01-03 05:19:30 UTC
Thanks to reply

(In reply to comment #1)
> So more information on your use case would be very interesting, since it's
> really the users that dictate how we should fix this.

I make a link list on normal memory (on Windows) or shared memory (on Unix).
On each request an element is allocated from it and input/output filter write 
a status on the element.
After the request an element is left as "used" in, e.g., three minutes.
I want to run Gabage Collecter on monitor hook.

(In reply to comment #3)
> This is true of many functions defined in mpm_common.h, an internal header.

mpm_common.h is internal?
Installed apache2/include contains mpm_common.h so I thought it was public 
header.