cvs commit: apache-apr/apr/time/unix Makefile.in
rbb 99/07/23 07:41:52 Modified:apr Makefile.in acconfig.h configure.in apr/file_io/beos Makefile.in apr/file_io/os2 Makefile.in apr/file_io/unix Makefile.in apr/include apr_config.h.in apr/lib Makefile.in apr/locks/beos Makefile.in apr/locks/os2 Makefile.in apr/locks/unix Makefile.in apr/misc/beos Makefile.in apr/misc/os2 Makefile.in apr/misc/unix Makefile.in start.c apr/network_io/beos Makefile.in apr/network_io/os2 Makefile.in apr/network_io/unix Makefile.in apr/shmem/unix Makefile.in apr/signal/unix Makefile.in apr/test Makefile.in apr/threadproc/beos Makefile.in apr/threadproc/os2 Makefile.in apr/threadproc/unix Makefile.in apr/time/beos Makefile.in apr/time/os2 Makefile.in apr/time/unix Makefile.in Added: apr aclocal.m4 Log: I had some time this morning, so here are the next set of changes for autoconf. Somebody should probably check this on a platform other than Linux. Revision ChangesPath 1.15 +5 -4 apache-apr/apr/Makefile.in Index: Makefile.in === RCS file: /home/cvs/apache-apr/apr/Makefile.in,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- Makefile.in 1999/07/14 15:31:39 1.14 +++ Makefile.in 1999/07/23 14:41:34 1.15 @@ -9,9 +9,9 @@ @SET_MAKE@ [EMAIL PROTECTED]@ [EMAIL PROTECTED]@ [EMAIL PROTECTED]@ @CFLAGS@ @OPTIM@ [EMAIL PROTECTED]@ [EMAIL PROTECTED]@ $(LDLIBS) [EMAIL PROTECTED]@ @OPTIM@ [EMAIL PROTECTED]@ [EMAIL PROTECTED]@ $(LIBS) [EMAIL PROTECTED]@ # # Macros for supporting directories @@ -25,7 +25,8 @@ # MODULES=lib file_io network_io threadproc locks misc time SUBDIRS=lib file_io/@OSDIR@ network_io/@OSDIR@ threadproc/@OSDIR@ \ -locks/@OSDIR@ misc/@OSDIR@ time/@OSDIR@ signal/@OSDIR@ shmem/@OSDIR@ +locks/@OSDIR@ misc/@OSDIR@ time/@OSDIR@ signal/@OSDIR@ +#shmem/@OSDIR@ # # Rules for turning inputs into outputs 1.2 +12 -0 apache-apr/apr/acconfig.h Index: acconfig.h === RCS file: /home/cvs/apache-apr/apr/acconfig.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- acconfig.h1999/07/13 19:51:20 1.1 +++ acconfig.h1999/07/23 14:41:34 1.2 @@ -2,7 +2,19 @@ #define APR_CONFIG_H @TOP@ +/* Various #defines we need to know about */ #undef HAVE_STRUCT_UNION_SEMUN +#undef HAVE_LOCK_EX +#undef HAVE_F_SETLK +#undef HAVE_PTHREAD_PROCESS_SHARED + +/* Cross process serialization techniques */ +#undef USE_FLOCK_SERIALIZE +#undef USE_SYSVSEM_SERIALIZE +#undef USE_FCNTL_SERIALIZE +#undef USE_PROC_PTHREAD_SERIALIZE +#undef USE_PTHREAD_SERIALIZE + #undef NEED_RLIM_T #undef USEBCOPY 1.30 +37 -66apache-apr/apr/configure.in Index: configure.in === RCS file: /home/cvs/apache-apr/apr/configure.in,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- configure.in 1999/07/15 12:46:39 1.29 +++ configure.in 1999/07/23 14:41:35 1.30 @@ -1,9 +1,9 @@ AC_CONFIG_AUX_DIR(./helpers) -PLATFORM=`config.guess` -PLATFORM=`config.sub $PLATFORM` +OS=`config.guess` +OS=`config.sub $OS` echo Configuring APR library -echo Platform: ${PLATFORM} +echo Platform: ${OS} dnl Process this file with autoconf to produce a configure script. AC_INIT(configure.in) @@ -25,7 +25,7 @@ dnl # this is the place to put specific options for platform/compiler dnl # combinations -case $PLATFORM:$CC in +case $OS:$CC in *-hp-hpux*:cc ) CFAGS=$CFLAGS -Ae +DAportable ;; esac @@ -55,33 +55,42 @@ fi AC_CHECK_PROG(SH, sh, sh) +AC_CHECK_DEFINE(LOCK_EX, sys/file.h) +AC_CHECK_DEFINE(F_SETLK, fcntl.h) +AC_CHECK_DEFINE(PTHREAD_PROCESS_SHARED, pthread.h) + dnl Checks for libraries. +AC_BEGIN_DECISION([lock implementation method]) +AC_IFALLYES(header:sys/file.h define:LOCK_EX, +AC_DECIDE(USE_FLOCK_SERIALIZE, [4.2BSD-style flock()])) +AC_IFALLYES(header:sys/ipc.h header:sys/sem.h header:sys/file.h dnl +func:semget func:semctl, +AC_DECIDE(USE_SYSVSEM_SERIALIZE, [SysV IPC semget()])) +AC_IFALLYES(header:fcntl.h define:F_SETLK, +AC_DECIDE(USE_FCNTL_SERIALIZE, [SVR4-style fcntl()])) +AC_IFALLYES(header:pthread.h define:PTHREAD_PROCESS_SHARED dnl +
cvs commit: apache-1.3/src/main http_main.c
stoddard99/07/23 08:31:26 Modified:src CHANGES src/main http_main.c Log: Complete apache -k restart work. Now, restarts are honored immediately without loosing connections in the listen queue. Revision ChangesPath 1.1398+10 -1 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1397 retrieving revision 1.1398 diff -u -r1.1397 -r1.1398 --- CHANGES 1999/07/19 10:15:53 1.1397 +++ CHANGES 1999/07/23 15:31:21 1.1398 @@ -1,5 +1,14 @@ Changes with Apache 1.3.7 + *) Win32: More apache -k restart work. Restarts are now honored + immediately and connections in the listen queue are -not- lost. + This is made possible by the use of the WSADuplicateSocket() + call. The listeners are opened in the parent, duplicated, then + the duplicates are passed to the child. The original listen sockets + are not closed by the parent across a restart, thus the listen queue + is preserved. + [Bill Stoddard [EMAIL PROTECTED]] + *) Fix handling of case when a client has sent Expect: 100-continue and we are going to respond with an error, but get stuck waiting to discard the body in the pointless hope of preserving the connection. @@ -70,7 +79,7 @@ could take hours. Now, a restart is honored almost immediately. All connections in Apache's queues are handled but connections in the stack's listen queue are discarded. Restart triggered by - MaxRequestPerChild is unchanged. + MaxRequestPerChild is unchanged. [Bill Stoddard [EMAIL PROTECTED]] *) Win32: Eliminated unnecessary call to wait_for_multiple_objects in 1.458 +200 -81 apache-1.3/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-1.3/src/main/http_main.c,v retrieving revision 1.457 retrieving revision 1.458 diff -u -r1.457 -r1.458 --- http_main.c 1999/07/21 12:23:19 1.457 +++ http_main.c 1999/07/23 15:31:25 1.458 @@ -5363,6 +5363,71 @@ APD2(signal prefix %s, signal_name_prefix); } +static void setup_inherited_listeners(pool *p) +{ +HANDLE pipe; +listen_rec *lr; +int fd; +WSAPROTOCOL_INFO WSAProtocolInfo; +DWORD BytesRead; + +/* Open the pipe to the parent process to receive the inherited socket + * data. The sockets have been set to listening in the parent process. + */ +pipe = GetStdHandle(STD_INPUT_HANDLE); + +/* Setup the listeners */ +listenmaxfd = -1; +FD_ZERO(listenfds); +lr = ap_listeners; + +FD_ZERO(listenfds); + +for (;;) { + fd = find_listener(lr); + if (fd 0) { +if (!ReadFile(pipe, + WSAProtocolInfo, sizeof(WSAPROTOCOL_INFO), + BytesRead, + (LPOVERLAPPED) NULL)){ +ap_log_error(APLOG_MARK, APLOG_WIN32ERROR|APLOG_CRIT, server_conf, + setup_inherited_listeners: Unable to read socket data from parent); +exit(1); +} +fd = WSASocket(FROM_PROTOCOL_INFO, + FROM_PROTOCOL_INFO, + FROM_PROTOCOL_INFO, + WSAProtocolInfo, + 0, + 0); +if (fd == INVALID_SOCKET) { +ap_log_error(APLOG_MARK, APLOG_WIN32ERROR|APLOG_CRIT, server_conf, + setup_inherited_listeners: WSASocket failed to get inherit the socket.); +exit(1); +} +APD2(setup_inherited_listeners: WSASocket() returned socket %d, fd); + } + else { + ap_note_cleanups_for_socket(p, fd); + } + if (fd = 0) { + FD_SET(fd, listenfds); + if (fd listenmaxfd) + listenmaxfd = fd; + } + lr-fd = fd; + if (lr-next == NULL) + break; + lr = lr-next; +} +/* turn the list into a ring */ +lr-next = ap_listeners; +head_listener = ap_listeners; +close_unused_listeners(); +CloseHandle(pipe); +return; +} + /* * worker_main() is main loop for the child process. The loop in * this function becomes the controlling thread for the actually working @@ -5443,8 +5508,13 @@ exit(0); } /* start_mutex obtained, continue into the select() loop */ +if (one_process) { +setup_listeners(pconf); +} else { +/* Get listeners from the parent process */ +setup_inherited_listeners(pconf); +} -
cvs commit: apache-2.0/mpm/src/main http_connection.c
ben 99/07/23 11:14:45 Modified:mpm/src/main http_connection.c Log: Actually, we should always close the connection when it is finished. Revision ChangesPath 1.12 +22 -22apache-2.0/mpm/src/main/http_connection.c Index: http_connection.c === RCS file: /export/home/cvs/apache-2.0/mpm/src/main/http_connection.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- http_connection.c 1999/07/22 19:17:21 1.11 +++ http_connection.c 1999/07/23 18:14:44 1.12 @@ -197,6 +197,28 @@ ap_run_pre_connection(c); ap_run_process_connection(c); + +/* + * Close the connection, being careful to send out whatever is still + * in our buffers. If possible, try to avoid a hard close until the + * client has ACKed our FIN and/or has stopped sending us data. + */ + +#ifdef NO_LINGCLOSE +ap_bclose(c-client);/* just close it */ +#else +if (r r-connection + !r-connection-aborted + r-connection-client + (r-connection-client-fd = 0)) { + + lingering_close(r); +} +else { + ap_bsetflag(c-client, B_EOUT, 1); + ap_bclose(c-client); +} +#endif } int ap_process_http_connection(conn_rec *c) @@ -226,28 +248,6 @@ return OK; } } - -/* - * Close the connection, being careful to send out whatever is still - * in our buffers. If possible, try to avoid a hard close until the - * client has ACKed our FIN and/or has stopped sending us data. - */ - -#ifdef NO_LINGCLOSE -ap_bclose(c-client);/* just close it */ -#else -if (r r-connection - !r-connection-aborted - r-connection-client - (r-connection-client-fd = 0)) { - - lingering_close(r); -} -else { - ap_bsetflag(c-client, B_EOUT, 1); - ap_bclose(c-client); -} -#endif return OK; }
cvs commit: apache-2.0/mpm/src/modules/standard mod_echo.c
ben 99/07/23 11:52:29 Modified:mpm/src Configuration.tmpl Added: mpm/src/modules/standard mod_echo.c Log: Support for echo protocol, to show how multiprotocol support works. Revision ChangesPath 1.5 +4 -0 apache-2.0/mpm/src/Configuration.tmpl Index: Configuration.tmpl === RCS file: /export/home/cvs/apache-2.0/mpm/src/Configuration.tmpl,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- Configuration.tmpl1999/07/10 18:20:16 1.4 +++ Configuration.tmpl1999/07/23 18:52:28 1.5 @@ -414,3 +414,7 @@ AddModule modules/standard/mod_setenvif.o +## Demonstration module for the TCP echo protocol, just to show how +## multiprotocol support works. + +AddModule modules/standard/mod_echo.o 1.1 apache-2.0/mpm/src/modules/standard/mod_echo.c Index: mod_echo.c === #include httpd.h #include http_config.h #include http_connection.h API_VAR_EXPORT module echo_module; typedef struct { int bEnabled; } EchoConfig; static void *create_echo_server_config(pool *p,server_rec *s) { EchoConfig *pConfig=ap_pcalloc(p,sizeof *pConfig); pConfig-bEnabled=0; return pConfig; } static const char *echo_on(cmd_parms *cmd, void *dummy, char *arg) { EchoConfig *pConfig=ap_get_module_config(cmd-server-module_config, echo_module); pConfig-bEnabled=1; return NULL; } static int process_echo_connection(conn_rec *c) { char buf[1024]; EchoConfig *pConfig=ap_get_module_config(c-base_server-module_config, echo_module); if(!pConfig-bEnabled) return DECLINED; for( ; ; ) { int w; int r=ap_bread(c-client,buf,sizeof buf); if(r = 0) break; w=ap_bwrite(c-client,buf,r); if(w != r) break; ap_bflush(c-client); } return OK; } static const command_rec echo_cmds[] = { { ProtocolEcho, echo_on, NULL, RSRC_CONF, RAW_ARGS, Run an echo server on this host }, { NULL } }; static void register_hooks() { ap_hook_process_connection(process_echo_connection,NULL,NULL,HOOK_MIDDLE); } API_VAR_EXPORT module echo_module = { STANDARD20_MODULE_STUFF, NULL, /* pre_command_line */ NULL, /* pre_config */ NULL, /* post_config */ NULL, /* open_logs */ NULL, /* child_init */ NULL, /* create per-directory config structure */ NULL, /* merge per-directory config structures */ create_echo_server_config,/* create per-server config structure */ NULL, /* merge per-server config structures */ echo_cmds,/* command table */ NULL, /* handlers */ NULL, /* check auth */ NULL, /* check access */ NULL, /* type_checker */ NULL, /* pre-run fixups */ register_hooks/* register hooks */ };
cvs commit: apache-1.3/src/main http_main.c
stoddard99/07/23 12:33:12 Modified:src/main http_main.c Log: Exit the child process immediately upon MaxRequestPerChild being hit. Revision ChangesPath 1.459 +7 -26 apache-1.3/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-1.3/src/main/http_main.c,v retrieving revision 1.458 retrieving revision 1.459 diff -u -r1.458 -r1.459 --- http_main.c 1999/07/23 15:31:25 1.458 +++ http_main.c 1999/07/23 19:33:10 1.459 @@ -5449,8 +5449,6 @@ int i; struct timeval tv; int wait_time = 1; -int start_exit = 0; -int start_mutex_released = 0; int max_jobs_per_exe; int max_jobs_after_exit_request; HANDLE hObjects[2]; @@ -5495,7 +5493,7 @@ rv = WaitForMultipleObjects(2, hObjects, FALSE, INFINITE); if (rv == WAIT_FAILED) { ap_log_error(APLOG_MARK,APLOG_ERR|APLOG_WIN32ERROR, server_conf, - Waiting for start_mutex or exit_event -- process will exit); + Waiting for start_mutex or exit_event -- process will exit); ap_destroy_pool(pchild); cleanup_scoreboard(); @@ -5557,29 +,17 @@ } while (1) { -#if SEVERELY_VERBOSE - APD4(child PID %d: thread_main total_jobs=%d start_exit=%d, - my_pid, total_jobs, start_exit); -#endif - if ((max_jobs_per_exe (total_jobs max_jobs_per_exe) !start_exit)) { -/* When MaxRequestsPerChild is hit, handle everything on the stack's - * listen queue before exiting. This may take a while if the server - * is really busy. +if (max_jobs_per_exe (total_jobs max_jobs_per_exe)) { +/* MaxRequestsPerChild hit... */ - start_exit = 1; - wait_time = 1; - ap_release_mutex(start_mutex); - start_mutex_released = 1; - APD2(process PID %d: start mutex released\n, my_pid); +break; } -/* Always check for the exit event being signaled. Honor the exit event, - * even if it means loosing connections in the stack's listen queue. +/* Always check for the exit event being signaled. */ rv = WaitForSingleObject(exit_event, 0); ap_assert((rv == WAIT_TIMEOUT) || (rv == WAIT_OBJECT_0)); if (rv == WAIT_OBJECT_0) { APD1(child: exit event signalled, exiting); -start_exit = 1; break; } @@ -5615,10 +5601,7 @@ } count_select_errors = 0;/* reset count of errors */ if (srv == 0) { - if (start_exit) - break; - else - continue; +continue; } { @@ -5661,9 +5644,7 @@ /* Get ready to shutdown and exit */ allowed_globals.exit_now = 1; -if (!start_mutex_released) { - ap_release_mutex(start_mutex); -} +ap_release_mutex(start_mutex); #ifdef UNGRACEFUL_RESTART SetEvent(allowed_globals.thread_exit_event);
cvs commit: apache-1.3/src/main http_main.c
stoddard99/07/23 12:52:06 Modified:src/main http_main.c Log: Win32: Add a few error messages. Revision ChangesPath 1.460 +5 -1 apache-1.3/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-1.3/src/main/http_main.c,v retrieving revision 1.459 retrieving revision 1.460 diff -u -r1.459 -r1.460 --- http_main.c 1999/07/23 19:33:10 1.459 +++ http_main.c 1999/07/23 19:52:04 1.460 @@ -5829,6 +5829,9 @@ return -1; } else { +ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_INFO, server_conf, + Parent: Created child process %d, pi.dwProcessId); + /* Assume the child process lives. Update the process and event tables */ handles[*processes] = pi.hProcess; events[*processes] = kill_event; @@ -5840,7 +5843,8 @@ lr = ap_listeners; while (lr != NULL) { lpWSAProtocolInfo = ap_pcalloc(p, sizeof(WSAPROTOCOL_INFO)); -APD2(Parent: Duplicating socket %d and sending it to the child process., lr-fd); +ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_INFO, server_conf, + Parent: Duplicating socket %d and sending it to child process %d, lr-fd, pi.dwProcessId); if (WSADuplicateSocket(lr-fd, pi.dwProcessId, lpWSAProtocolInfo) == SOCKET_ERROR) {
cvs commit: apache-2.0/mpm/src/modules/mpm/dexter dexter.c dexter.h
manoj 99/07/23 15:15:18 Modified:mpm/src/modules/mpm/dexter dexter.c dexter.h Log: Add support for dynamically creating and destroying threads based on a Min/MaxSpareThreads algorithm, and clean up a couple of stray pieces of gunk from the days of scoreboardhood. Revision ChangesPath 1.4 +138 -65 apache-2.0/mpm/src/modules/mpm/dexter/dexter.c Index: dexter.c === RCS file: /home/cvs/apache-2.0/mpm/src/modules/mpm/dexter/dexter.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -u -r1.3 -r1.4 --- dexter.c 1999/07/21 22:18:30 1.3 +++ dexter.c 1999/07/23 22:15:10 1.4 @@ -78,12 +78,12 @@ * Actual definitions of config globals */ -int ap_threads_per_child=0; /* Worker threads per child */ -int ap_max_requests_per_child=0; +static int threads_to_start=0; /* Worker threads per child */ +static int min_spare_threads=0; +static int max_spare_threads=HARD_THREAD_LIMIT; +static int max_requests_per_child=0; static char *ap_pid_fname=NULL; -static int ap_num_daemons=0; -static time_t ap_restart_time=0; -API_VAR_EXPORT int ap_extended_status = 0; +static int num_daemons=0; static int workers_may_exit = 0; static int requests_this_child; static int num_listenfds = 0; @@ -145,12 +145,22 @@ static pool *pconf; /* Pool for config stuff */ static pool *pchild; /* Pool for httpd child stuff */ +typedef struct { +pool *pool; +pthread_mutex_t mutex; +pthread_attr_t attr; +} worker_thread_info; + static int my_pid; /* Linux getpid() doesn't work except in main thread. Use this instead */ /* Keep track of the number of worker threads currently active */ static int worker_thread_count; static pthread_mutex_t worker_thread_count_mutex; +/* Keep track of the number of idle worker threads */ +static int idle_thread_count; +static pthread_mutex_t idle_thread_count_mutex; + /* Global, alas, so http_core can talk to us */ enum server_token_type ap_server_tokens = SrvTk_FULL; @@ -830,11 +840,30 @@ ap_process_connection(current_conn); } -static void * worker_thread(void *thread_pool) +static void *worker_thread(void *); + +static void start_thread(worker_thread_info *thread_info) { -pool *tpool = thread_pool; +pthread_t thread; + +if (pthread_create(thread, (thread_info-attr), worker_thread, thread_info)) { +ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf, + pthread_create: unable to create worker thread); +/* In case system resources are maxxed out, we don't want + Apache running away with the CPU trying to fork over and + over and over again if we exit. */ +sleep(10); +workers_may_exit = 1; +} +} + +/* idle_thread_count should be incremented before starting a worker_thread */ + +static void *worker_thread(void *arg) +{ struct sockaddr sa_client; int csd = -1; +pool *tpool; /* Pool for this thread */ pool *ptrans;/* Pool for per-transaction stuff */ int sd = -1; int srv; @@ -842,7 +871,12 @@ char pipe_read_char; int curr_pollfd, last_pollfd = 0; size_t len = sizeof(struct sockaddr); +worker_thread_info *thread_info = arg; +int thread_just_started = 1; +pthread_mutex_lock(thread_info-mutex); +tpool = ap_make_sub_pool(thread_info-pool); +pthread_mutex_unlock(thread_info-mutex); ptrans = ap_make_sub_pool(tpool); pthread_mutex_lock(worker_thread_count_mutex); @@ -852,9 +886,22 @@ /* TODO: Switch to a system where threads reuse the results from earlier poll calls - manoj */ while (!workers_may_exit) { -workers_may_exit |= (ap_max_requests_per_child != 0) (requests_this_child = 0); +workers_may_exit |= (max_requests_per_child != 0) (requests_this_child = 0); if (workers_may_exit) break; - +if (!thread_just_started) { +pthread_mutex_lock(idle_thread_count_mutex); +if (idle_thread_count max_spare_threads) { +idle_thread_count++; +pthread_mutex_unlock(idle_thread_count_mutex); +} +else { +pthread_mutex_unlock(idle_thread_count_mutex); +break; +} +} +else { +thread_just_started = 0; +} SAFE_ACCEPT(intra_mutex_on(0)); if (workers_may_exit) { SAFE_ACCEPT(intra_mutex_off(0)); @@ -863,6 +910,7 @@ SAFE_ACCEPT(accept_mutex_on(0)); while (!workers_may_exit) { srv = poll(listenfds, num_listenfds + 1, -1); +
cvs commit: apache-2.0/mpm/src/modules/mpm/dexter dexter.c
manoj 99/07/23 15:20:22 Modified:mpm/src/modules/mpm/dexter dexter.c Log: Add a little naming consistency, and put in an error condition for MaxSpareThreads being too high. Revision ChangesPath 1.5 +10 -5 apache-2.0/mpm/src/modules/mpm/dexter/dexter.c Index: dexter.c === RCS file: /home/cvs/apache-2.0/mpm/src/modules/mpm/dexter/dexter.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -u -r1.4 -r1.5 --- dexter.c 1999/07/23 22:15:10 1.4 +++ dexter.c 1999/07/23 22:20:20 1.5 @@ -79,7 +79,7 @@ */ static int threads_to_start=0; /* Worker threads per child */ -static int min_spare_threads=0; +static int min_spare_threads=1; static int max_spare_threads=HARD_THREAD_LIMIT; static int max_requests_per_child=0; static char *ap_pid_fname=NULL; @@ -1520,7 +1520,7 @@ return NULL; } -static const char *set_min_free_threads(cmd_parms *cmd, void *dummy, char *arg) +static const char *set_min_spare_threads(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) { @@ -1538,7 +1538,7 @@ return NULL; } -static const char *set_max_free_threads(cmd_parms *cmd, void *dummy, char *arg) +static const char *set_max_spare_threads(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) { @@ -1546,6 +1546,11 @@ } max_spare_threads = atoi(arg); +if (max_spare_threads = HARD_THREAD_LIMIT) { + fprintf(stderr, WARNING: detected MinSpareThreads set higher than\n); + fprintf(stderr, HARD_THREAD_LIMIT. Resetting to %d\n, HARD_THREAD_LIMIT); + max_spare_threads = HARD_THREAD_LIMIT; +} return NULL; } @@ -1624,9 +1629,9 @@ Number of children alive at the same time }, { StartThreads, set_threads_to_start, NULL, RSRC_CONF, TAKE1, Number of threads each child creates }, -{ MinSpareThreads, set_min_free_threads, NULL, RSRC_CONF, TAKE1, +{ MinSpareThreads, set_min_spare_threads, NULL, RSRC_CONF, TAKE1, Minimum number of idle threads per child, to handle request spikes }, -{ MaxSpareThreads, set_max_free_threads, NULL, RSRC_CONF, TAKE1, +{ MaxSpareThreads, set_max_spare_threads, NULL, RSRC_CONF, TAKE1, Maximum number of idle threads per child }, { MaxRequestsPerChild, set_max_requests, NULL, RSRC_CONF, TAKE1, Maximum number of requests a particular child serves before dying. },
cvs commit: apache-2.0/mpm/src/modules/mpm/dexter dexter.c mpm_default.h
manoj 99/07/23 15:43:48 Modified:mpm/src/modules/mpm/dexter dexter.c mpm_default.h Log: Clean up and properly specify defaults for the new directives. Revision ChangesPath 1.6 +8 -6 apache-2.0/mpm/src/modules/mpm/dexter/dexter.c Index: dexter.c === RCS file: /home/cvs/apache-2.0/mpm/src/modules/mpm/dexter/dexter.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -u -r1.5 -r1.6 --- dexter.c 1999/07/23 22:20:20 1.5 +++ dexter.c 1999/07/23 22:43:47 1.6 @@ -78,10 +78,10 @@ * Actual definitions of config globals */ -static int threads_to_start=0; /* Worker threads per child */ -static int min_spare_threads=1; -static int max_spare_threads=HARD_THREAD_LIMIT; -static int max_requests_per_child=0; +static int threads_to_start = 0; /* Worker threads per child */ +static int min_spare_threads = 0; +static int max_spare_threads = 0; +static int max_requests_per_child = 0; static char *ap_pid_fname=NULL; static int num_daemons=0; static int workers_may_exit = 0; @@ -1440,8 +1440,10 @@ unixd_pre_config(); ap_listen_pre_config(); -num_daemons = HARD_SERVER_LIMIT; -threads_to_start = DEFAULT_THREADS_PER_CHILD; +num_daemons = DEFAULT_NUM_DAEMON; +threads_to_start = DEFAULT_START_THREAD; +min_spare_threads = DEFAULT_MIN_SPARE_THREAD; +max_spare_threads = DEFAULT_MAX_SPARE_THREAD; ap_pid_fname = DEFAULT_PIDLOG; ap_lock_fname = DEFAULT_LOCKFILE; max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD; 1.2 +25 -23apache-2.0/mpm/src/modules/mpm/dexter/mpm_default.h Index: mpm_default.h === RCS file: /home/cvs/apache-2.0/mpm/src/modules/mpm/dexter/mpm_default.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -u -r1.1 -r1.2 --- mpm_default.h 1999/07/21 19:07:06 1.1 +++ mpm_default.h 1999/07/23 22:43:47 1.2 @@ -58,25 +58,42 @@ #ifndef APACHE_MPM_DEFAULT_H #define APACHE_MPM_DEFAULT_H -/* Number of servers to spawn off by default --- also, if fewer than +/* Number of threads to spawn off by default --- also, if fewer than * this free when the caretaker checks, it will spawn more. */ -#ifndef DEFAULT_START_DAEMON -#define DEFAULT_START_DAEMON 5 +#ifndef DEFAULT_START_THREAD +#define DEFAULT_START_THREAD 5 #endif -/* Maximum number of *free* server processes --- more than this, and +/* Maximum number of *free* server threads --- more than this, and * they will die off. */ -#ifndef DEFAULT_MAX_FREE_DAEMON -#define DEFAULT_MAX_FREE_DAEMON 10 +#ifndef DEFAULT_MAX_SPARE_THREAD +#define DEFAULT_MAX_SPARE_THREAD 10 #endif /* Minimum --- fewer than this, and more will be created */ -#ifndef DEFAULT_MIN_FREE_DAEMON -#define DEFAULT_MIN_FREE_DAEMON 5 +#ifndef DEFAULT_MIN_SPARE_THREAD +#define DEFAULT_MIN_SPARE_THREAD 5 +#endif + +/* Limit on the threads per process. Clients will be locked out if more than + * this * HARD_SERVER_LIMIT are needed. + * + * We keep this for one reason it keeps the size of the scoreboard file small + * enough that we can read the whole thing without worrying too much about + * the overhead. + */ +#ifndef HARD_THREAD_LIMIT +#define HARD_THREAD_LIMIT 64 +#endif + +/* Number of servers to spawn off by default + */ +#ifndef DEFAULT_NUM_DAEMON +#define DEFAULT_NUM_DAEMON 2 #endif /* Limit on the total --- clients will be locked out if more servers than @@ -92,21 +109,6 @@ */ #ifndef HARD_SERVER_LIMIT #define HARD_SERVER_LIMIT 8 -#endif - -/* Limit on the threads per process. Clients will be locked out if more than - * this * HARD_SERVER_LIMIT are needed. - * - * We keep this for one reason it keeps the size of the scoreboard file small - * enough that we can read the whole thing without worrying too much about - * the overhead. - */ -#ifndef HARD_THREAD_LIMIT -#define HARD_THREAD_LIMIT 64 -#endif - -#ifndef DEFAULT_THREADS_PER_CHILD -#define DEFAULT_THREADS_PER_CHILD 50 #endif #endif /* AP_MPM_DEFAULT_H */