1
0
mirror of https://github.com/apache/httpd.git synced 2026-01-06 09:01:14 +03:00

WinNT MPM: Store pid and generation for each thread in scoreboard

to allow tracking of threads from exiting children via mod_status
or other such mechanisms.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1374780 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jeff Trawick
2012-08-19 16:00:57 +00:00
parent 5f9b104629
commit aa9b7b4cc5
4 changed files with 19 additions and 1 deletions

View File

@@ -1,6 +1,10 @@
-*- coding: utf-8 -*-
Changes with Apache 2.5.0
*) WinNT MPM: Store pid and generation for each thread in scoreboard
to allow tracking of threads from exiting children via mod_status
or other such mechanisms. [Jeff Trawick]
*) Windows: Fix output of -M, -L, and similar command-line options
which display information about the server configuration.
[Jeff Trawick]

View File

@@ -1016,10 +1016,18 @@ void child_main(apr_pool_t *pconf)
apr_thread_mutex_create(&child_lock, APR_THREAD_MUTEX_DEFAULT, pchild);
while (1) {
int from_previous_generation = 0, starting_up = 0;
for (i = 0; i < ap_threads_per_child; i++) {
int *score_idx;
int status = ap_scoreboard_image->servers[0][i].status;
if (status != SERVER_GRACEFUL && status != SERVER_DEAD) {
if (ap_scoreboard_image->servers[0][i].generation != my_generation) {
++from_previous_generation;
}
else if (status == SERVER_STARTING) {
++starting_up;
}
continue;
}
ap_update_child_status_from_indexes(0, i, SERVER_STARTING, NULL);
@@ -1038,6 +1046,8 @@ void child_main(apr_pool_t *pconf)
ap_signal_parent(SIGNAL_PARENT_SHUTDOWN);
goto shutdown;
}
ap_scoreboard_image->servers[0][i].pid = my_pid;
ap_scoreboard_image->servers[0][i].generation = my_generation;
threads_created++;
/* Save the score board index in ht keyed to the thread handle.
* We need this when cleaning up threads down below...
@@ -1063,6 +1073,9 @@ void child_main(apr_pool_t *pconf)
}
/* wait for previous generation to clean up an entry in the scoreboard
*/
ap_log_error(APLOG_MARK, APLOG_TRACE2, 0, ap_server_conf,
"Child: %d threads starting up, %d remain from a prior generation",
starting_up, from_previous_generation);
apr_sleep(1 * APR_USEC_PER_SEC);
}

View File

@@ -64,7 +64,7 @@
extern apr_shm_t *ap_scoreboard_shm;
/* my_generation is returned to the scoreboard code */
static volatile ap_generation_t my_generation=0;
volatile ap_generation_t my_generation=0;
/* Definitions of WINNT MPM specific config globals */
static HANDLE shutdown_event; /* used to signal the parent to shutdown */

View File

@@ -71,6 +71,7 @@ extern module AP_MODULE_DECLARE_DATA mpm_winnt_module;
extern int ap_threads_per_child;
extern DWORD my_pid;
extern volatile ap_generation_t my_generation;
extern apr_proc_mutex_t *start_mutex;
extern HANDLE exit_event;