Changes with Apache 1.3.23
+ *) Win32: Emit error message when the server bumps up against the
+ ThreadsPerChild configuration limit. This will be useful for
+ admins to detect when their server is running out of threads
+ to handle requests. [Bill Stoddard]
*) Test all directories listed with the UserDir directive for validity.
Also resolves the Win32/Netware bug of unparsable quoted paths.
* Actual definitions of config globals... here because this is
* for the most part the only code that acts on 'em. (Hmmm... mod_main.c?)
*/
-
#ifdef NETWARE
-int ap_thread_count = 0;
BOOL ap_main_finished = FALSE;
unsigned int ap_thread_stack_size = 65536;
#endif
+int ap_thread_count = 0;
API_VAR_EXPORT int ap_standalone=0;
int ap_configtestonly=0;
int ap_docrootcheck=1;
ap_release_mutex(allowed_globals.jobmutex);
}
-int remove_job(void)
+int remove_job(int csd)
{
+ static reported = 0;
+ static active_threads = 0;
joblist *job;
int sock;
+ /* Decline decrementing active_threads count on the first call
+ * to remove_job. csd == -1 implies that this is the thread's
+ * first call to remove_job.
+ */
+ if (csd != -1) {
+ active_threads--;
+ }
+
#ifdef UNGRACEFUL_RESTART
HANDLE hObjects[2];
int rv;
ap_release_mutex(allowed_globals.jobmutex);
return (-1);
}
+
job = allowed_globals.jobhead;
ap_assert(job);
allowed_globals.jobhead = job->next;
if (allowed_globals.jobhead == NULL)
allowed_globals.jobtail = NULL;
+
ap_release_mutex(allowed_globals.jobmutex);
sock = job->sock;
free(job);
+
+ active_threads++;
+ if (!reported && (active_threads == ap_threads_per_child)) {
+ reported = 1;
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, server_conf,
+ "server reached ThreadsPerChild setting, consider"
+ " raising the ThreadsPerChild setting");
+ }
return (sock);
}
tsd = (TSD*) Thread_Data_Area;
ThreadSwitchWithDelay();
}
-
init_name_space();
- ap_thread_count++;
#endif
-
+ ap_thread_count++;
ptrans = ap_make_sub_pool(pconf);
(void) ap_update_child_status(child_num, SERVER_READY, (request_rec *) NULL);
/* Get job from the job list. This will block until a job is ready.
* If -1 is returned then the main thread wants us to exit.
*/
- csd = remove_job();
+ csd = remove_job(csd);
if (csd == -1)
break; /* time to exit */
-
+
requests_this_child++;
ap_note_cleanups_for_socket(ptrans, csd);
ap_destroy_pool(ptrans);
(void) ap_update_child_status(child_num, SERVER_DEAD, NULL);
-#ifdef NETWARE
ap_thread_count--;
-#endif
}