cvs commit: apache-1.3/src/os/win32 modules.c
manoj 98/07/20 17:07:00 Modified:src/os/win32 modules.c Log: Correcting misleading comment about manually editing this file Revision ChangesPath 1.9 +3 -2 apache-1.3/src/os/win32/modules.c Index: modules.c === RCS file: /export/home/cvs/apache-1.3/src/os/win32/modules.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- modules.c 1998/04/11 12:01:06 1.8 +++ modules.c 1998/07/21 00:06:59 1.9 @@ -1,5 +1,6 @@ -/* modules.c --- automatically generated by Apache - * configuration script. DO NOT HAND EDIT! +/* modules.c --- major modules compiled into Apache for Win32. + * Only insert an entry for a module if it must be compiled into + * the core server */ #include httpd.h
cvs commit: apache-1.3/src/support suexec.c
manoj 98/09/16 13:51:09 Modified:src/support suexec.c Log: Fix a missing semicolon Revision ChangesPath 1.46 +1 -1 apache-1.3/src/support/suexec.c Index: suexec.c === RCS file: /export/home/cvs/apache-1.3/src/support/suexec.c,v retrieving revision 1.45 retrieving revision 1.46 diff -u -r1.45 -r1.46 --- suexec.c 1998/09/10 09:23:59 1.45 +++ suexec.c 1998/09/16 20:51:08 1.46 @@ -211,7 +211,7 @@ sprintf(pathbuf, PATH=%s, SAFE_PATH); cleanenv[cidx] = strdup(pathbuf); -cidx++ +cidx++; for (ep = environ; *ep cidx AP_ENVBUF-1; ep++) { if (!strncmp(*ep, HTTP_, 5)) {
cvs commit: apache-1.3/src/modules/standard mod_speling.c
manoj 98/09/23 15:42:06 Modified:src CHANGES src/modules/standard mod_speling.c Log: PR: 3052 Reviewed by: Ken Coar [EMAIL PROTECTED] Fix mod_speling's handling of multiple matched URLs. Revision ChangesPath 1.1073+3 -0 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1072 retrieving revision 1.1073 diff -u -r1.1072 -r1.1073 --- CHANGES 1998/09/22 09:19:51 1.1072 +++ CHANGES 1998/09/23 22:42:03 1.1073 @@ -1,5 +1,8 @@ Changes with Apache 1.3.3 + *) Fix mod_speling's handling of multiple matched URLs. + [Manoj Kasichainula] + *) Correct comment in mod_log_config.c about its internals. [Elf Sternberg [EMAIL PROTECTED]] 1.27 +4 -0 apache-1.3/src/modules/standard/mod_speling.c Index: mod_speling.c === RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_speling.c,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- mod_speling.c 1998/09/19 12:16:38 1.26 +++ mod_speling.c 1998/09/23 22:42:05 1.27 @@ -506,6 +506,10 @@ : Spelling fix: %s: %d candidates, r-uri, candidates-nelts, ref); +/* The log entry above will be sent to the client instead of the + * page we've constructed unless we take it out of error-notes */ +ap_table_unset(r-notes, error-notes); + return HTTP_MULTIPLE_CHOICES; } }
cvs commit: apache-1.3 STATUS
manoj 98/10/27 16:13:31 Modified:.STATUS Log: Add Win32 strftime patch, and remove old scoreboard patch which has been replaced. Revision ChangesPath 1.522 +5 -13 apache-1.3/STATUS Index: STATUS === RCS file: /export/home/cvs/apache-1.3/STATUS,v retrieving revision 1.521 retrieving revision 1.522 diff -u -u -r1.521 -r1.522 --- STATUS1998/10/27 15:19:11 1.521 +++ STATUS1998/10/28 00:13:30 1.522 @@ -69,6 +69,11 @@ Available Patches: +* Manoj and Ken Parzygnat's PATCH to support %-expandos from Unix + on Win32 +Message-ID: [EMAIL PROTECTED] +Status: + * Harrie Hazewinkle's PATCH scoreboard to include server_rec * Message-ID: [EMAIL PROTECTED] Status: Ralf +1 @@ -93,19 +98,6 @@ Mesage-ID: PR#3246, also available at http://www.physics.mcgill.ca/~juan/mod_include.patch Status: Ken -0 for 1.3/+0 for 2.0 - -* Harrie Hazewinkel's PATCH scoreboard - This is a patch that changes the 'vhost'-name (type char [32]) - in the scoreboard into a 'vhost'-number (type int), and then uses a - lookup table to display the server name. -Message-ID: [EMAIL PROTECTED] -Status: Roy (untested +1) - Dean -1: I see no need to add a new virtual host number to the - server guts... although I can understand why it's nice for - SNMP. However I'd be totally for a patch which places - server_rec * into the scoreboard in place of the name - -- because the pointers are valid across parent and - children... why waste the time doing number lookups and such. * Manoj's [PATCH] mime.types update Message-ID: [EMAIL PROTECTED]
cvs commit: apache-1.3/conf httpd.conf-dist
manoj 98/10/28 14:04:10 Modified:conf httpd.conf-dist Log: ExtendedStatus cannot be enabled until the status module is loaded, so move the commented directive after DSO modules are loaded. Revision ChangesPath 1.33 +7 -7 apache-1.3/conf/httpd.conf-dist Index: httpd.conf-dist === RCS file: /export/home/cvs/apache-1.3/conf/httpd.conf-dist,v retrieving revision 1.32 retrieving revision 1.33 diff -u -u -r1.32 -r1.33 --- httpd.conf-dist 1998/10/22 20:56:51 1.32 +++ httpd.conf-dist 1998/10/28 22:04:09 1.33 @@ -98,13 +98,6 @@ #AccessConfig conf/access.conf # -# ExtendedStatus controls whether Apache will generate full status -# information (ExtendedStatus On) or just basic information (ExtendedStatus -# Off) when the server-status handler is called. The default is Off. -# -#ExtendedStatus On - -# # Timeout: The number of seconds before receives and sends time out. # Timeout 300 @@ -202,6 +195,13 @@ # # Example: # LoadModule foo_module libexec/mod_foo.so + +# +# ExtendedStatus controls whether Apache will generate full status +# information (ExtendedStatus On) or just basic information (ExtendedStatus +# Off) when the server-status handler is called. The default is Off. +# +#ExtendedStatus On ### Section 2: 'Main' server configuration #
cvs commit: apache-1.3/htdocs/manual handler.html
manoj 98/10/29 12:27:14 Modified:htdocs/manual handler.html Log: PR: 2706 Changed references to /status to /server-status. This isn't really necessary, but a user was confused by the difference between the docs and the configuration file, and consistency is a good thing. Revision ChangesPath 1.16 +2 -2 apache-1.3/htdocs/manual/handler.html Index: handler.html === RCS file: /export/home/cvs/apache-1.3/htdocs/manual/handler.html,v retrieving revision 1.15 retrieving revision 1.16 diff -u -u -r1.15 -r1.16 --- handler.html 1998/10/21 05:57:58 1.15 +++ handler.html 1998/10/29 20:27:13 1.16 @@ -137,10 +137,10 @@ SetHandler imap-file /PRE PAnother example: if you wanted to have the server display a status -report whenever a URL of CODEhttp://servername/status/CODE was +report whenever a URL of CODEhttp://servername/server-status/CODE was called, you might put the following into access.conf: PRE -lt;Location /statusgt; +lt;Location /server-statusgt; SetHandler server-status lt;/Locationgt; /PRE
cvs commit: apache-1.3/src/os/tpf - New directory
manoj 98/11/03 13:50:29 apache-1.3/src/os/tpf - New directory
cvs commit: apache-1.3/src/os/tpf/samples - New directory
manoj 98/11/03 13:50:30 apache-1.3/src/os/tpf/samples - New directory
cvs commit: apache-1.3/src/os/tpf/samples linkdll.jcl loadset.jcl
manoj 98/11/03 14:06:32 Added: htdocs/manual install-tpf.html readme-tpf.html src Makefile.tpf src/main Makefile.tpf src/os/tpf Makefile.tmpl TPFExport ebcdic.c ebcdic.h os-inline.c os.c os.h test_char.h uri_delims.h src/os/tpf/samples linkdll.jcl loadset.jcl Log: Submitted by: Joe Moenich and others at IBM Newly created files from the TPF port Revision ChangesPath 1.1 apache-1.3/htdocs/manual/install-tpf.html Index: install-tpf.html === !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 3.2 Final//EN html head titleInstalling Apache on TPF/title /head a name=top/a h1 align=centerInstalling the Apache 1.3 HTTP Server on TPF/h1 hr center[nbspa href=#setupSetup/a nbsp|nbspa href=#compilationCompilation/a nbsp|nbspa href=#installationInstallation/a nbsp|nbspa href=#visualageVisualAge/anbsp] /center hr br p This document outlines the steps needed to install Apache onto a TPF system. brbr You should first read src/os/tpf/a href=readme.tpf.htmlreadme.tpf.html/a for basic information on the port of Apache to TPF including required PUT level and supported functions amp; modules. /p a name=setupnbsp;/a h2 align=centerSetup/h2 p Due to the use of EBCDIC on MVS OS/390 Open Edition (later referred to simply as Open Edition), we've found that the most reliable method for loading Apache onto your system is to unzip and tar the distribution file on your PC, and then copy the extracted files to Open Edition via an NFS client capable of transferring the data in EBCDIC format. brbr Before moving the distribution to an Open Edition environment, verify that the NFS drive will transfer the filenames with upper/lower case preserved. brbr Since Open Edition is not the ultimate destination of the files, the only required files and subdirectories that need to be moved to Open Edition are in /src. brbr font strong color=redWARNING/font: If you are using a product such as WinZip on your PC, verify that the iTAR File Smart CR/LF Conversion/i option is NOT checked. You can find this in WinZip under Options, Configuration. Since you had to tar and unzip the file to read this document, you need to re-tar and -unzip if the CR/LF option was checked. This will save you lots of headaches later on. brbr font strong color=redWARNING/font: Editing files on a PC before moving them to Open Edition may result in the loss/addition of unprintable characters. Files of concern include shell scripts and src/Configuration. The most common problems are with tab characters and CR/LF characters. Most editors will handle the CR/LF problem correctly but none seem to handle tab characters. If you need to edit files, edit them in a UNIX editor such as vi or emacs. /p a name=compilationnbsp;/a h2 align=centerCompilation/h2 p Apache supports the notion of optional modules. However, the server has to know which modules are compiled into it. In order for those modules to be effective, it is necessary to generate a short bit of code (modules.c) which simply has a list of them. If you are using the make and Configure utility, modules.c will be created for you. brbr The provided scripts assume a c89 compiler and have only been tested on an Open Edition environment. If you are using a platform other that Open Edition you may need to modify src/os/tpf/TPFExport and src/Configure to match your environment. brbr Note that UNIX/Open Edition commands in this section are shown in ttstrongbold/strong/tt, are case sensitive, and must be made from the src directory. brbr ol liOverlay src/Configuration with src/Configuration.tmpl: ttstrongcpnbsp;Configuration.tmplnbsp;Configuration/strong/tt brbr liEdit src/Configuration. It contains the list and settings of various Rules and an additional section at the bottom that determines which modules to compile: brbr ol type=a liAdjust the Rules and ttEXTRA_CFLAGS|LIBS|LDFLAGS|INCLUDES/tt if you feel so inclined. brbr liComment out (by preceding the line with a #) lines corresponding to those modules you DOnbsp;NOT wish to include. At present the following modules MUST be commented out as they are not yet supported on TPF: mod_actions, mod_auth, mod_cgi, mod_env, mod_include, mod_status. brbr liUncomment (by removing the initial #, if present) lines corresponding to those optional modules you wish to include or add new lines corresponding to any custom modules you have written. The src/os/tpf/a href=readme.tpf.htmlreadme.tpf.html/a document lists the modules that have been tested on TPF
cvs commit: apache-1.3 STATUS
manoj 98/11/03 15:33:40 Modified:.STATUS Log: Add TPF port to STATUS Revision ChangesPath 1.527 +4 -0 apache-1.3/STATUS Index: STATUS === RCS file: /export/home/cvs/apache-1.3/STATUS,v retrieving revision 1.526 retrieving revision 1.527 diff -u -u -r1.526 -r1.527 --- STATUS1998/11/03 01:26:53 1.526 +++ STATUS1998/11/03 23:33:38 1.527 @@ -70,6 +70,10 @@ Available Patches: +* [PATCH] TPF port +Message-ID: [EMAIL PROTECTED] +Status: Jim +1 (with minor nits) + * Ralf's Build outside of source tree (take 2: alternative solution) (overrules Wilfredo Sanchez's [PATCH] Build outside of source tree) Message-ID: [EMAIL PROTECTED]
cvs commit: apache-1.3/htdocs/manual install-tpf.html readme-tpf.html
manoj 98/11/04 11:31:53 Modified:htdocs/manual install-tpf.html readme-tpf.html Log: Fix some bad links in TPF documentation Revision ChangesPath 1.2 +2 -2 apache-1.3/htdocs/manual/install-tpf.html Index: install-tpf.html === RCS file: /export/home/cvs/apache-1.3/htdocs/manual/install-tpf.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -u -r1.1 -r1.2 --- install-tpf.html 1998/11/03 22:06:29 1.1 +++ install-tpf.html 1998/11/04 19:31:50 1.2 @@ -18,7 +18,7 @@ p This document outlines the steps needed to install Apache onto a TPF system. brbr -You should first read src/os/tpf/a href=readme.tpf.htmlreadme.tpf.html/a +You should first read htdocs/manual/a href=readme-tpf.htmlreadme-tpf.html/a for basic information on the port of Apache to TPF including required PUT level and supported functions amp; modules. /p @@ -97,7 +97,7 @@ corresponding to those optional modules you wish to include or add new lines corresponding to any custom modules you have written. -The src/os/tpf/a href=readme.tpf.htmlreadme.tpf.html/a +The htdocs/manual/a href=readme-tpf.htmlreadme-tpf.html/a document lists the modules that have been tested on TPF. /ol br 1.2 +2 -3 apache-1.3/htdocs/manual/readme-tpf.html Index: readme-tpf.html === RCS file: /export/home/cvs/apache-1.3/htdocs/manual/readme-tpf.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -u -r1.1 -r1.2 --- readme-tpf.html 1998/11/03 22:06:29 1.1 +++ readme-tpf.html 1998/11/04 19:31:50 1.2 @@ -22,14 +22,13 @@ (Transaction Processing Facility) operating system. Unless otherwise noted TPF version 4.1 PUT08 and APAR PJ25589 are required. brbr - Refer to src/os/tpf/a href=install.tpf.htmlinstall.tpf.html/a + Refer to htdocs/manual/a href=install-tpf.htmlinstall-tpf.html/a for step-by-step installation instructions. brbr As this is the first cut at making Apache run on TPF, performance tuning has not been done. brbr - This port builds upon the - a href=http://www.apache.org/docs/ebcdic.html;EBCDIC changes/a + This port builds upon the a href=ebcdic.htmlEBCDIC changes/a previously made to Apache. br /p
cvs commit: apache-1.3 STATUS
manoj 98/11/04 11:43:28 Modified:.STATUS Log: Put back TPF. The whole port was not committed, just the new files. Revision ChangesPath 1.529 +4 -0 apache-1.3/STATUS Index: STATUS === RCS file: /export/home/cvs/apache-1.3/STATUS,v retrieving revision 1.528 retrieving revision 1.529 diff -u -u -r1.528 -r1.529 --- STATUS1998/11/04 09:38:22 1.528 +++ STATUS1998/11/04 19:43:27 1.529 @@ -72,6 +72,10 @@ Available Patches: +* [PATCH] TPF port +Message-ID: [EMAIL PROTECTED] +Status: Jim +1 (with minor nits) + * Ralf's Build outside of source tree (take 2: alternative solution) (overrules Wilfredo Sanchez's [PATCH] Build outside of source tree) Message-ID: [EMAIL PROTECTED]
cvs commit: apache-1.3/src/include ap_config.h
manoj 98/11/04 14:23:46 Modified:src CHANGES src/include ap_config.h Log: PR: 3177 Move a typedef to fix compile problems with 1.x kernels. Revision ChangesPath 1.1133+3 -0 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1132 retrieving revision 1.1133 diff -u -u -r1.1132 -r1.1133 --- CHANGES 1998/11/04 12:38:32 1.1132 +++ CHANGES 1998/11/04 22:23:42 1.1133 @@ -1,5 +1,8 @@ Changes with Apache 1.3.4 + *) Move a typedef to fix compile problems on Linux with 1.x kernels. + [Manoj Kasichainula] PR#3177 + *) PORT: Add a port to the Concurrent PowerMAX OS. [Tom Horsley [EMAIL PROTECTED]] 1.242 +5 -5 apache-1.3/src/include/ap_config.h Index: ap_config.h === RCS file: /export/home/cvs/apache-1.3/src/include/ap_config.h,v retrieving revision 1.241 retrieving revision 1.242 diff -u -u -r1.241 -r1.242 --- ap_config.h 1998/10/19 02:16:27 1.241 +++ ap_config.h 1998/11/04 22:23:45 1.242 @@ -436,11 +436,6 @@ #define HAVE_MMAP 1 #define USE_MMAP_FILES -/* glibc 2.1 and later finally define rlim_t */ -#if !defined(__GLIBC__) || __GLIBC__ 2 || (__GLIBC__ == 2 __GLIBC_MINOR__ 1) -typedef int rlim_t; -#endif - /* flock is faster ... but hasn't been tested on 1.x systems */ #define USE_FLOCK_SERIALIZED_ACCEPT @@ -456,6 +451,11 @@ #undef NEED_STRDUP #include sys/time.h #define HAVE_SYSLOG 1 + +/* glibc 2.1 and later finally define rlim_t */ +#if !defined(__GLIBC__) || __GLIBC__ 2 || (__GLIBC__ == 2 __GLIBC_MINOR__ 1) +typedef int rlim_t; +#endif #elif defined(SCO) #undef HAVE_GMTOFF
cvs commit: apache-1.3/src/os/win32 os.h util_win32.c
manoj 98/11/05 11:20:18 Modified:src CHANGES src/include ap_config.h src/os/win32 os.h util_win32.c Log: Work around incomplete implementation of strftime on Win32. Revision ChangesPath 1.1134+3 -0 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1133 retrieving revision 1.1134 diff -u -u -r1.1133 -r1.1134 --- CHANGES 1998/11/04 22:23:42 1.1133 +++ CHANGES 1998/11/05 19:20:14 1.1134 @@ -1,5 +1,8 @@ Changes with Apache 1.3.4 + *) Work around incomplete implementation of strftime on Win32. + [Manoj Kasichainula, Ken Parzygnat [EMAIL PROTECTED]] + *) Move a typedef to fix compile problems on Linux with 1.x kernels. [Manoj Kasichainula] PR#3177 1.243 +3 -0 apache-1.3/src/include/ap_config.h Index: ap_config.h === RCS file: /export/home/cvs/apache-1.3/src/include/ap_config.h,v retrieving revision 1.242 retrieving revision 1.243 diff -u -u -r1.242 -r1.243 --- ap_config.h 1998/11/04 22:23:45 1.242 +++ ap_config.h 1998/11/05 19:20:16 1.243 @@ -938,6 +938,9 @@ #endif /* ndef WIN32 */ #include time.h/* for ctime */ +#ifdef WIN32 +#define strftime(s,max,format,tm) os_strftime(s,max,format,tm) +#endif #include signal.h #include errno.h #if !defined(QNX) !defined(CONVEXOS11) !defined(NEXT) 1.25 +2 -0 apache-1.3/src/os/win32/os.h Index: os.h === RCS file: /export/home/cvs/apache-1.3/src/os/win32/os.h,v retrieving revision 1.24 retrieving revision 1.25 diff -u -u -r1.24 -r1.25 --- os.h 1998/09/19 12:27:25 1.24 +++ os.h 1998/11/05 19:20:17 1.25 @@ -93,6 +93,8 @@ #define stat(f,ps) os_stat(f,ps) API_EXPORT(int) os_stat(const char *szPath,struct stat *pStat); +API_EXPORT(int) os_strftime(char *s, size_t max, const char *format, const struct tm *tm); + #define _spawnv(mode,cmdname,argv) os_spawnv(mode,cmdname,argv) #define spawnv(mode,cmdname,argv)os_spawnv(mode,cmdname,argv) API_EXPORT(int) os_spawnv(int mode,const char *cmdname,const char *const *argv); 1.27 +69 -0 apache-1.3/src/os/win32/util_win32.c Index: util_win32.c === RCS file: /export/home/cvs/apache-1.3/src/os/win32/util_win32.c,v retrieving revision 1.26 retrieving revision 1.27 diff -u -u -r1.26 -r1.27 --- util_win32.c 1998/10/01 04:52:32 1.26 +++ util_win32.c 1998/11/05 19:20:17 1.27 @@ -1,6 +1,8 @@ #include windows.h #include sys/stat.h #include stdarg.h +#include time.h +#include stdlib.h #include httpd.h #include http_log.h @@ -415,4 +417,71 @@ va_end(vlist); return _spawnve(mode, szCmd, aszArgs, aszEnv); +} + +#undef strftime + +/* Partial replacement for strftime. This adds certain expandos to the + * Windows version + */ + +API_EXPORT(int) os_strftime(char *s, size_t max, const char *format, +const struct tm *tm) { + /* If the new format string is bigger than max, the result string probably +* won't fit anyway. When %-expandos are added, made sure the padding below +* is enough. +*/ +char *new_format = (char *) _alloca(max + 11); +size_t i, j, format_length = strlen(format); +int return_value; +int length_written; + +for (i = 0, j = 0; (i format_length j max)) { +if (format[i] != '%') { +new_format[j++] = format[i++]; +continue; +} +switch (format[i+1]) { +case 'D': +/* Is this locale dependent? Shouldn't be... + Also note the year 2000 exposure here */ +memcpy(new_format + j, %m/%d/%y, 8); +i += 2; +j += 8; +break; +case 'r': +memcpy(new_format + j, %I:%M:%S %p, 11); +i += 2; +j += 11; +break; +case 'T': +memcpy(new_format + j, %H:%M:%S, 8); +i += 2; +j += 8; +break; +case 'e': +length_written = ap_snprintf(new_format + j, max - j, %2d, +tm-tm_mday); +j = (length_written == -1) ? max : (j + length_written); +i += 2; +break; +/* Handle %% to avoid dying on strftime(out, 600, 1200 %'s) */ +case
cvs commit: apache-1.3 STATUS
manoj 98/11/06 14:42:46 Modified:src Configure CHANGES src/helpers GuessOS src/include alloc.h ap_config.h scoreboard.h src/main buff.c http_main.c util.c .STATUS Log: Submitted by: Joe Moenich [EMAIL PROTECTED] and others at IBM The rest of the port to TPF, consisting of changes to existing files. Revision ChangesPath 1.305 +15 -2 apache-1.3/src/Configure Index: Configure === RCS file: /export/home/cvs/apache-1.3/src/Configure,v retrieving revision 1.304 retrieving revision 1.305 diff -u -u -r1.304 -r1.305 --- Configure 1998/11/04 12:38:32 1.304 +++ Configure 1998/11/06 22:42:37 1.305 @@ -616,6 +616,14 @@ DEF_WANTHSREGEX=yes LIBS=$LIBS -lsocket -lnsl -lc ;; +TPF) + OS='TPF' + OSDIR='os/tpf' + CC='c89' + CFLAGS=$CFLAGS -DTPF -DCHARSET_EBCDIC -D_POSIX_SOURCE + DEF_WANTHSREGEX=yes + LIBS=$LIBS + ;; *-sni-sysv4*) OS='SVR4' CFLAGS=$CFLAGS -DSVR4 -D_XPG_IV -DHAS_DLFCN -DUSE_MMAP_FILES -DUSE_SYSVSEM_SERIALIZED_ACCEPT -DNEED_UNION_SEMUN @@ -1815,10 +1823,14 @@ ## Use TestCompile to see if $(CC) is ANSI and as a final sanity ## check ## -echo + doing sanity check on compiler and options -if ./helpers/TestCompile sanity; then + +if [ $OS = TPF ] ; then : else + echo + doing sanity check on compiler and options + if ./helpers/TestCompile sanity; then + : + else echo ** A test compilation with your Makefile configuration echo ** failed. This is most likely because your C compiler echo ** is not ANSI. Apache requires an ANSI C Compiler, such @@ -1827,6 +1839,7 @@ echo Aborting! exitcode=1 exit 1 + fi fi 1.1138+3 -0 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1137 retrieving revision 1.1138 diff -u -u -r1.1137 -r1.1138 --- CHANGES 1998/11/06 12:24:35 1.1137 +++ CHANGES 1998/11/06 22:42:38 1.1138 @@ -1,5 +1,8 @@ Changes with Apache 1.3.4 + *) PORT: Add a port to the TPF OS. [Joe Moenich [EMAIL PROTECTED] and + others at IBM] + *) Fix internal handling of registered cleanups in alloc.c by making sure that NULL-specified callback functions (we don't do this in the official set of modules, but third-party modules do) for ap_register_cleanup() 1.52 +7 -0 apache-1.3/src/helpers/GuessOS Index: GuessOS === RCS file: /export/home/cvs/apache-1.3/src/helpers/GuessOS,v retrieving revision 1.51 retrieving revision 1.52 diff -u -u -r1.51 -r1.52 --- GuessOS 1998/11/04 12:38:34 1.51 +++ GuessOS 1998/11/06 22:42:40 1.52 @@ -275,6 +275,13 @@ exit 0 fi +# Apache is not compiled on the TPF platform +# therefore an environment variable is used +if [ $TPF = YES ]; then +echo TPF +exit 0 +fi + # Now NeXT ISNEXT=`hostinfo 2/dev/null` case $ISNEXT in 1.64 +5 -0 apache-1.3/src/include/alloc.h Index: alloc.h === RCS file: /export/home/cvs/apache-1.3/src/include/alloc.h,v retrieving revision 1.63 retrieving revision 1.64 diff -u -u -r1.63 -r1.64 --- alloc.h 1998/08/14 02:49:45 1.63 +++ alloc.h 1998/11/06 22:42:41 1.64 @@ -269,8 +269,13 @@ * up with timeout handling in general... */ +#ifdef TPF +#define ap_block_alarms() (0) +#define ap_unblock_alarms() (0) +#else API_EXPORT(void) ap_block_alarms(void); API_EXPORT(void) ap_unblock_alarms(void); +#endif /* TPF */ /* Common cases which want utility support.. * the note_cleanups_for_foo routines are for 1.244 +38 -4 apache-1.3/src/include/ap_config.h Index: ap_config.h === RCS file: /export/home/cvs/apache-1.3/src/include/ap_config.h,v retrieving revision 1.243 retrieving revision 1.244 diff -u -u -r1.243 -r1.244 --- ap_config.h 1998/11/05 19:20:16 1.243 +++ ap_config.h 1998/11/06 22:42:41 1.244 @@ -92,7 +92,7 @@ #include os.h #endif -#if !defined(QNX) !defined(MPE) !defined(WIN32) +#if !defined(QNX) !defined(MPE) !defined(WIN32) !defined(TPF) #include sys/param.h #endif @@ -801,6 +801,36 @@ /* All windows stuff is now in os/win32/os.h */ +#elif defined(TPF) /* IBM Transaction Processing Facility operating system
cvs commit: apache-1.3/src/os/tpf TPFExport os.h
manoj 99/01/06 13:57:08 Modified:htdocs/manual install-tpf.html readme-tpf.html src Configure Makefile.tmpl src/os/tpf TPFExport os.h Log: Submitted by: Joe Moenich [EMAIL PROTECTED] Reviewed by: Manoj Kasichainula [EMAIL PROTECTED] Various TPF tweaks, simplifying installation, etc. Revision ChangesPath 1.3 +0 -6 apache-1.3/htdocs/manual/install-tpf.html Index: install-tpf.html === RCS file: /home/cvs/apache-1.3/htdocs/manual/install-tpf.html,v retrieving revision 1.2 retrieving revision 1.3 diff -u -u -r1.2 -r1.3 --- install-tpf.html 1998/11/04 19:31:50 1.2 +++ install-tpf.html 1999/01/06 21:56:57 1.3 @@ -101,12 +101,6 @@ document lists the modules that have been tested on TPF. /ol br -liOverlay src/Makefile.tmpl with src/Makefile.tpf: -ttstrongcpnbsp;Makefile.tpfnbsp;Makefile.tmpl/strong/tt -brbr -liOverlay src/main/Makefile.tmpl with src/main/Makefile.tpf: - ttstrongcpnbsp;main/Makefile.tpfnbsp;main/Makefile.tmpl/strong/tt -brbr liSet the TPF environment variables: ttstrong.nbsp;os/tpf/TPFExport/strong/tt br 1.3 +0 -15 apache-1.3/htdocs/manual/readme-tpf.html Index: readme-tpf.html === RCS file: /home/cvs/apache-1.3/htdocs/manual/readme-tpf.html,v retrieving revision 1.2 retrieving revision 1.3 diff -u -u -r1.2 -r1.3 --- readme-tpf.html 1998/11/04 19:31:50 1.2 +++ readme-tpf.html 1999/01/06 21:56:57 1.3 @@ -49,21 +49,6 @@ /ul /p -a name=auto_generated_filesnbsp;/a -h2 align=centerAutomatically Generated Files/h2 -p - Some files that are automatically generated by Makefile on other platforms - are included in the src/os/tpf directory... - ul - litest_char.h - liuri_delims.h - /ul - - These files could not be automatically created for TPF because the - Makefile platform is not the same as the run-time platform. - (That is, you don't run Makefile on TPF itself.) -/p - a name=whats_availablenbsp;/a h2 align=centerWhat's Available in this Version/h2 1.320 +1 -0 apache-1.3/src/Configure Index: Configure === RCS file: /home/cvs/apache-1.3/src/Configure,v retrieving revision 1.319 retrieving revision 1.320 diff -u -u -r1.319 -r1.320 --- Configure 1999/01/04 04:11:38 1.319 +++ Configure 1999/01/06 21:57:01 1.320 @@ -609,6 +609,7 @@ CFLAGS=$CFLAGS -DTPF -DCHARSET_EBCDIC -D_POSIX_SOURCE DEF_WANTHSREGEX=yes LIBS=$LIBS + SUBTARGET=target_compile_only ;; *-sni-sysv4*) OS='SVR4' 1.108 +3 -0 apache-1.3/src/Makefile.tmpl Index: Makefile.tmpl === RCS file: /home/cvs/apache-1.3/src/Makefile.tmpl,v retrieving revision 1.107 retrieving revision 1.108 diff -u -u -r1.107 -r1.108 --- Makefile.tmpl 1998/12/01 23:59:54 1.107 +++ Makefile.tmpl 1999/01/06 21:57:02 1.108 @@ -30,6 +30,9 @@ $(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_SHLIB_EXPORT) \ -o $(TARGET) buildmark.o $(OBJS) $(REGLIB) $(LIBS) +target_compile_only: subdirs modules.o + $(CC) -c $(INCLUDES) $(CFLAGS) buildmark.c + target_shared: lib$(TARGET).ep $(CC) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_SHLIB_EXPORT) \ -o $(TARGET) -DSHARED_CORE_BOOTSTRAP main/http_main.c 1.2 +3 -22 apache-1.3/src/os/tpf/TPFExport Index: TPFExport === RCS file: /home/cvs/apache-1.3/src/os/tpf/TPFExport,v retrieving revision 1.1 retrieving revision 1.2 diff -u -u -r1.1 -r1.2 --- TPFExport 1998/11/03 22:06:30 1.1 +++ TPFExport 1999/01/06 21:57:04 1.2 @@ -1,26 +1,7 @@ #!/bin/sh echo Setting TPF/c89 environment variables -TZ=EST5EDT -PATH=$PATH:/usr/sbin:/usr/share/lib/terminfo/:.:/etc:$HOME -NLSPATH=/usr/lpp/tcpip/usr/lib/nls/msg/%L:/usr/lib/nls/msg/%L/%N -LIBPATH=/usr/lib -LANG=C -export TZ PATH NLSPATH LANG -# Commands Reference -# umask g=rx,o=x -umask 022 -export _C89_CCMODE=1 -export _C89_CVERSION=0x2104 -export _C89_PVERSION=0x1108 -export _C89_CNAME=CBCDRVR -export _C89_PNAME=EDCPRLK -export _C89_PMSGS=EDCPMSGE -export _C89_CLIB_PREFIX=TSCTEST.OSV2R4M0 -export _C89_PLIB_PREFIX=SHARE.CEE180 -export _C89_INCDIRS=/u/tpf41/currentmaint/include /u/tpf41/currentmaint/include/oco //DD:SYSLIB //'SHARE.CEE180.SCEEH.NET.H' //'SHARE.CEE180.SCEEH.H' //'SHARE.CEE180.SCEEH.NETINET.H' -export _C89_SSYSLIB=SHARE.CEE180
cvs commit: apache-1.3/src/os/tpf test_char.h uri_delims.h
manoj 99/01/07 10:28:38 Removed: src Makefile.tpf src/main Makefile.tpf src/os/tpf test_char.h uri_delims.h Log: Submitted by: Joe Moenich [EMAIL PROTECTED] Remove TPF-only files obsoleted by latest TPF patch.
cvs commit: apache-apr/pthreads STATUS
manoj 99/01/26 13:37:48 Removed: pthreads STATUS Log: This STATUS file doesn't apply to this code tree; whack it.
cvs commit: apache-apr/pthreads/src/modules/standard mod_mime_magic.c
manoj 99/02/02 23:49:02 Modified:pthreads/src/modules/standard mod_mime_magic.c Log: Compilation fix. Revision ChangesPath 1.3 +1 -1 apache-apr/pthreads/src/modules/standard/mod_mime_magic.c Index: mod_mime_magic.c === RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/mod_mime_magic.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -u -r1.2 -r1.3 --- mod_mime_magic.c 1999/01/27 16:15:47 1.2 +++ mod_mime_magic.c 1999/02/03 07:49:02 1.3 @@ -1,4 +1,4 @@ -2/* +/* * Copyright (c) 1995-1998 The Apache Group. All rights reserved. * * Redistribution and use in source and binary forms, with or without
cvs commit: apache-apr/pthreads/src Configure
manoj 99/02/03 16:26:00 Modified:pthreads/src Configure Log: Make this compile out of the box on Linux. Revision ChangesPath 1.2 +1 -1 apache-apr/pthreads/src/Configure Index: Configure === RCS file: /home/cvs/apache-apr/pthreads/src/Configure,v retrieving revision 1.1 retrieving revision 1.2 diff -u -u -r1.1 -r1.2 --- Configure 1999/01/21 23:08:31 1.1 +++ Configure 1999/02/04 00:25:56 1.2 @@ -430,7 +430,7 @@ DEF_WANTHSREGEX=yes OS='Linux' CFLAGS=$CFLAGS -DLINUX=2 - LIBS=$LIBS -lm + LIBS=$LIBS -lm -lpthread ;; *-linux1) DEF_WANTHSREGEX=yes
cvs commit: apache-apr/pthreads/src/main http_config.c http_protocol.c
manoj 99/02/03 22:52:41 Modified:pthreads/src/main http_config.c http_protocol.c Log: Temporarily fix bug where server threads would lock up after a single request under Linux. LinuxThreads uses SIGUSR1 (and SIGUSR2) so they aren't available to us. We need to find an alternate means to get graceful restarts kicked off if we want to support Linux 2.0 kernel threads. Revision ChangesPath 1.3 +5 -0 apache-apr/pthreads/src/main/http_config.c Index: http_config.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_config.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -u -r1.2 -r1.3 --- http_config.c 1999/01/22 16:10:55 1.2 +++ http_config.c 1999/02/04 06:52:38 1.3 @@ -1503,9 +1503,14 @@ #ifdef SIGHUP signal(SIGHUP, SIG_IGN); #endif +/* XXX - LinuxThreads uses SIGUSR1, so we can't muck with it. Bummer. We + * need to find another way to do graceful restarts if we want to support + * kernel threads with Linux 2.0 (2.2 is supposed to fix this) - mvsk */ +#ifndef LINUX #ifdef SIGUSR1 signal(SIGUSR1, SIG_IGN); #endif +#endif /* ndef LINUX */ for (m = top_module; m; m = m-next) if (m-child_exit) 1.2 +6 -0 apache-apr/pthreads/src/main/http_protocol.c Index: http_protocol.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_protocol.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -u -r1.1 -r1.2 --- http_protocol.c 1999/01/21 23:08:33 1.1 +++ http_protocol.c 1999/02/04 06:52:39 1.2 @@ -675,9 +675,15 @@ } } /* we've probably got something to do, ignore graceful restart requests */ + +/* XXX - LinuxThreads uses SIGUSR1, so we can't muck with it. Bummer. We + * need to find another way to do graceful restarts if we want to support + * kernel threads with Linux 2.0 (2.2 is supposed to fix this) - mvsk */ +#ifndef LINUX #ifdef SIGUSR1 signal(SIGUSR1, SIG_IGN); #endif +#endif /* ndef LINUX */ ap_bsetflag(conn-client, B_SAFEREAD, 0);
cvs commit: apache-apr/pthreads/src/os/win32 os.h
manoj 99/02/04 12:31:27 Modified:pthreads/src/include multithread.h pthreads/src/modules/standard mod_mime_magic.c pthreads/src/os/unix multithread.c os-inline.c os.h pthreads/src/os/win32 os.h Log: Minor cleanup of spawnvp operations. No functionality change. Revision ChangesPath 1.3 +0 -1 apache-apr/pthreads/src/include/multithread.h Index: multithread.h === RCS file: /home/cvs/apache-apr/pthreads/src/include/multithread.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -u -r1.2 -r1.3 --- multithread.h 1999/01/27 16:15:46 1.2 +++ multithread.h 1999/02/04 20:31:19 1.3 @@ -55,7 +55,6 @@ API_EXPORT(int) ap_acquire_mutex(mutex *mutex_id); API_EXPORT(int) ap_release_mutex(mutex *mutex_id); API_EXPORT(void) ap_destroy_mutex(mutex *mutex_id); -API_EXPORT(int) ap_spawnvp(const char *, char *const []); #endif /* ndef MULTITHREAD */ #ifdef __cplusplus 1.4 +1 -5 apache-apr/pthreads/src/modules/standard/mod_mime_magic.c Index: mod_mime_magic.c === RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/mod_mime_magic.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -u -r1.3 -r1.4 --- mod_mime_magic.c 1999/02/03 07:49:02 1.3 +++ mod_mime_magic.c 1999/02/04 20:31:20 1.4 @@ -2145,12 +2145,8 @@ close(STDERR_FILENO); } -#if defined(WIN32) -child_pid = spawnvp(compr[parm-method].argv[0], +child_pid = ap_spawnvp(compr[parm-method].argv[0], compr[parm-method].argv); -#else -child_pid = ap_spawnvp(compr[parm-method].argv[0], compr[parm-method].argv); -#endif if (child_pid == -1) ap_log_rerror(APLOG_MARK, APLOG_ERR, parm-r, MODNAME : could not execute `%s'., 1.4 +0 -13 apache-apr/pthreads/src/os/unix/multithread.c Index: multithread.c === RCS file: /home/cvs/apache-apr/pthreads/src/os/unix/multithread.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -u -r1.3 -r1.4 --- multithread.c 1999/02/03 17:50:14 1.3 +++ multithread.c 1999/02/04 20:31:22 1.4 @@ -30,16 +30,3 @@ pthread_mutex_destroy((pthread_mutex_t *) mutex_id); } -API_EXPORT(int) ap_spawnvp(const char *file, char *const argv[]) -{ -int pid; - -if ((pid = fork()) == -1) { -return pid; -} else if (pid == 0) { -if (execvp(file, argv) == -1) - return -1; -} else -return pid; -} - 1.2 +14 -0 apache-apr/pthreads/src/os/unix/os-inline.c Index: os-inline.c === RCS file: /home/cvs/apache-apr/pthreads/src/os/unix/os-inline.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -u -r1.1 -r1.2 --- os-inline.c 1999/01/21 23:08:40 1.1 +++ os-inline.c 1999/02/04 20:31:23 1.2 @@ -29,3 +29,17 @@ { return file[0] == '/'; } + +INLINE int ap_spawnvp(const char *file, char *const argv[]) +{ +int pid; + +if ((pid = fork()) == -1) { +return pid; +} else if (pid == 0) { +if (execvp(file, argv) == -1) +return -1; +} else +return pid; +} + 1.2 +6 -0 apache-apr/pthreads/src/os/unix/os.h Index: os.h === RCS file: /home/cvs/apache-apr/pthreads/src/os/unix/os.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -u -r1.1 -r1.2 --- os.h 1999/01/21 23:08:40 1.1 +++ os.h 1999/02/04 20:31:23 1.2 @@ -94,6 +94,12 @@ #endif /* + * spawn = fork + exec on unix + */ + +extern int ap_spawnvp(const char *, char *const []); + +/* * Do not use native AIX DSO support */ #ifdef AIX 1.2 +3 -0 apache-apr/pthreads/src/os/win32/os.h Index: os.h === RCS file: /home/cvs/apache-apr/pthreads/src/os/win32/os.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -u -r1.1 -r1.2 --- os.h 1999/01/21 23:08:41 1.1 +++ os.h 1999/02/04 20:31:25 1.2 @@ -13,6 +13,9 @@ /* char *crypt(const char *pw, const char *salt); */ #define crypt(buf,salt) (buf) +/* Use the Windows built-in spawnvp */ +#define ap_spawnvp(file, argv) (spawnvp(file, argv)) + /* Although DIR_TYPE is dirent (see nt/readdir.h) we need direct.h for chdir() */ #include direct.h
cvs commit: apache-apr/pthreads/src/main http_protocol.c
manoj 99/02/04 23:55:25 Modified:pthreads/src/main http_protocol.c Log: Fix (I think) a bug where pipes could be closed even if there is still data to send, so only part of a CGI's output would sometimes be sent. Revision ChangesPath 1.3 +2 -2 apache-apr/pthreads/src/main/http_protocol.c Index: http_protocol.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_protocol.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -u -r1.2 -r1.3 --- http_protocol.c 1999/02/04 06:52:39 1.2 +++ http_protocol.c 1999/02/05 07:55:24 1.3 @@ -1876,7 +1876,7 @@ #endif if (ap_is_aborted(r-connection)) break; -if (n 0 /* errno != EAGAIN ZZZ rethink for threaded impl */) +if (n 0 errno != EAGAIN /* ZZZ rethink for threaded impl */) break; /* we need to block, so flush the output first */ ap_bflush(r-connection-client); @@ -1909,7 +1909,7 @@ else if (w 0) { if (ap_is_aborted(r-connection)) break; -#if 0 /*rethink for threaded impl */ +#if 1 /*rethink for threaded impl */ else if (errno == EAGAIN) continue; #endif
cvs commit: apache-apr STATUS
manoj 99/02/06 00:01:17 Modified:.STATUS Log: No Scooby-Doo on TV tonight. Revision ChangesPath 1.4 +10 -5 apache-apr/STATUS Index: STATUS === RCS file: /home/cvs/apache-apr/STATUS,v retrieving revision 1.3 retrieving revision 1.4 diff -u -u -r1.3 -r1.4 --- STATUS1999/02/05 14:58:46 1.3 +++ STATUS1999/02/06 08:01:16 1.4 @@ -1,5 +1,5 @@ Apache Portable Runtime STATUS: -Last modified at [$Date: 1999/02/05 14:58:46 $] +Last modified at [$Date: 1999/02/06 08:01:16 $] Release: @@ -25,13 +25,16 @@ the process when we encounter SIGPIPE, obviously bad. Modules -Ensure thread safety. Does not include mod_proxy. +Ensure thread safety. Does not include mod_proxy, yet. Scoreboard - Update the scoreboard for each thread, not per process. + Resign the scoreboard appropriately for a hybrid process web + server. This includes adding a tid field to the scoreboard. -Hybrid server - Use the updated server to determine when to launch new processes. +Process/thread management +Put (back) in the logic to manage the number of processes. + Managing threads per process other than with a configuration + constant is in doubt. Everything @@ -43,6 +46,8 @@ * What the status codes should look like * Various modules aren't pthreads-ready (mod_cgi) * Bringing in the libap stuff + * Bringing this code up-to-date with the changes in the 1.3 branch. +The trees appear to have diverged in November(?!) * Mod_proxy * Timeouts. (only soft timeouts)
cvs commit: apache-apr/pthreads/icons/small - New directory
manoj 99/02/06 22:19:44 apache-apr/pthreads/icons/small - New directory
cvs commit: apache-apr/pthreads/src/support Makefile.tmpl ab.1 ab.c apachectl apachectl.1 apxs.8 apxs.pl dbmmanage dbmmanage.1 htdigest.1 htdigest.c htpasswd.1 htpasswd.c httpd.8 httpd.exp log_server_status logresolve.8 logresolve.pl rotatelogs.8 split-logfile suexec.8 suexec.c suexec.h
manoj 99/02/06 22:30:26 Modified:pthreads Announcement INSTALL KEYS LICENSE Makefile.tmpl README.configure configure pthreads/conf httpd.conf-dist httpd.conf-dist-win mime.types pthreads/icons README pthreads/src ApacheCore.def ApacheCore.dsp BUILD.NOTES CHANGES Configuration.tmpl Configure Makefile.nt Makefile.tmpl buildmark.c pthreads/src/ap Makefile.tmpl ap.dsp ap.mak ap_cpystrn.c ap_execve.c ap_signal.c ap_slack.c ap_snprintf.c pthreads/src/helpers GuessOS PrintPath TestCompile buildinfo.sh checkheader.sh findcpp.sh fmn.sh fp2rp install.sh mkshadow.sh ppl.sh slo.sh pthreads/src/include alloc.h ap.h ap_compat.h ap_config.h ap_ctype.h ap_md5.h ap_mmn.h buff.h http_conf_globals.h http_config.h http_core.h http_log.h http_main.h http_protocol.h http_request.h http_vhost.h httpd.h rfc1413.h scoreboard.h util_date.h util_md5.h util_script.h util_uri.h pthreads/src/main Makefile.tmpl alloc.c buff.c gen_test_char.c http_config.c http_core.c http_log.c http_main.c http_protocol.c http_request.c http_vhost.c rfc1413.c util.c util_date.c util_md5.c util_script.c util_uri.c pthreads/src/modules/example mod_example.c pthreads/src/modules/experimental mod_mmap_static.c pthreads/src/modules/proxy mod_proxy.c mod_proxy.h proxy_cache.c proxy_connect.c proxy_ftp.c proxy_http.c proxy_util.c pthreads/src/modules/standard mod_access.c mod_actions.c mod_alias.c mod_asis.c mod_auth.c mod_auth_anon.c mod_auth_db.c mod_auth_dbm.c mod_autoindex.c mod_cern_meta.c mod_cgi.c mod_digest.c mod_dir.c mod_env.c mod_expires.c mod_headers.c mod_imap.c mod_include.c mod_info.c mod_log_agent.c mod_log_config.c mod_log_referer.c mod_mime.c mod_mime_magic.c mod_negotiation.c mod_rewrite.c mod_rewrite.h mod_setenvif.c mod_so.c mod_speling.c mod_status.c mod_unique_id.c mod_userdir.c mod_usertrack.c pthreads/src/modules/test mod_rndchunk.c mod_test_util_uri.c pthreads/src/os/bs2000 bs2login.c ebcdic.c os.c os.h pthreads/src/os/os2 os.h pthreads/src/os/tpf TPFExport ebcdic.c os.c os.h pthreads/src/os/unix os-aix-dso.c os.h pthreads/src/os/win32 mod_dll.c mod_isapi.c os.h registry.c util_win32.c pthreads/src/os/win32/installer apache.iwz pthreads/src/support Makefile.tmpl ab.1 ab.c apachectl apachectl.1 apxs.8 apxs.pl dbmmanage dbmmanage.1 htdigest.1 htdigest.c htpasswd.1 htpasswd.c httpd.8 httpd.exp log_server_status logresolve.8 logresolve.pl rotatelogs.8 split-logfile suexec.8 suexec.c suexec.h Added: pthreads config.layout pthreads/icons/small README.txt back.gif binary.gif binhex.gif blank.gif broken.gif burst.gif comp1.gif comp2.gif compressed.gif continued.gif dir.gif dir2.gif doc.gif forward.gif generic.gif generic2.gif generic3.gif image.gif image2.gif index.gif key.gif movie.gif patch.gif ps.gif rainbow.gif sound.gif sound2.gif tar.gif text.gif transfer.gif unknown.gif uu.gif pthreads/src Makefile_win32.txt Makefile_win32_debug.txt pthreads/src/ap ap_md5c.c pthreads/src/helpers binbuild.sh Removed: pthreads/src Makefile.tpf pthreads/src/main Makefile.tpf md5c.c pthreads/src/os/tpf test_char.h uri_delims.h Log: Update apache-apr to (almost) the current apache-1.3 state. apache-apr was previously based on an extract from early November. Revision ChangesPath 1.2 +24 -17apache-apr/pthreads/Announcement Index: Announcement === RCS file: /home/cvs/apache-apr/pthreads/Announcement,v retrieving revision 1.1 retrieving revision 1.2 diff -u -u -r1.1 -r1.2 --- Announcement 1999/01/21 23:08:29 1.1 +++ Announcement 1999/02/07 06:28:58 1.2 @@ -1,26 +1,33
cvs commit: apache-apr STATUS
manoj 99/02/07 22:32:11 Modified:.STATUS Log: I want winter back. Revision ChangesPath 1.5 +5 -5 apache-apr/STATUS Index: STATUS === RCS file: /home/cvs/apache-apr/STATUS,v retrieving revision 1.4 retrieving revision 1.5 diff -u -u -r1.4 -r1.5 --- STATUS1999/02/06 08:01:16 1.4 +++ STATUS1999/02/08 06:32:10 1.5 @@ -1,5 +1,5 @@ Apache Portable Runtime STATUS: -Last modified at [$Date: 1999/02/06 08:01:16 $] +Last modified at [$Date: 1999/02/08 06:32:10 $] Release: @@ -46,12 +46,11 @@ * What the status codes should look like * Various modules aren't pthreads-ready (mod_cgi) * Bringing in the libap stuff - * Bringing this code up-to-date with the changes in the 1.3 branch. -The trees appear to have diverged in November(?!) * Mod_proxy * Timeouts. (only soft timeouts) - * Check misc thread safety. Make sure UNIX code path mirrors NT path. + * Check misc thread safety. Make sure UNIX code path mirrors NT path where +appropriate * Optimize Optimize Optimize FEATURE SET FOR APR @@ -65,5 +64,6 @@ put monitor process back into place. Was removed for initial port, it's time we make sure the server is running, and if not, start it again. - +Bringing this code up-to-date with the changes in the 1.3 branch. +It's now up-to-date as of the morning of Feb 6th, 1999.
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/02/07 22:47:43 Modified:pthreads/src/main http_main.c Log: Put back -t and -S functionality (config test and virtual host config dump) Revision ChangesPath 1.10 +9 -1 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -u -r1.9 -r1.10 --- http_main.c 1999/02/07 06:29:30 1.9 +++ http_main.c 1999/02/08 06:47:42 1.10 @@ -2144,7 +2144,7 @@ { int c; int rc; /* */ -int configtestonly; +int configtestonly = 0; char *s; MONCONTROL(0); @@ -2239,6 +2239,14 @@ ap_suexec_enabled = init_suexec(); server_conf = ap_read_config(pconf, ptemp, ap_server_confname); + +if (configtestonly) { +fprintf(stderr, Syntax OK\n); +exit(0); +} +if (ap_dump_settings) { +exit(0); +} if (!ap_standalone) { fprintf(stderr, inetd mode not supported\n);
cvs commit: apache-apr/pthreads/src/main fdqueue.c
manoj 99/02/09 14:04:16 Modified:pthreads/src/main fdqueue.c Log: Optimization: don't pthread_cond_signal every time something is added to the queue, but only when there is a state change (empty - not empty, full - not full). Revision ChangesPath 1.2 +8 -3 apache-apr/pthreads/src/main/fdqueue.c Index: fdqueue.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/fdqueue.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -u -r1.1 -r1.2 --- fdqueue.c 1999/02/03 17:50:09 1.1 +++ fdqueue.c 1999/02/09 22:04:14 1.2 @@ -33,12 +33,14 @@ } queue-data[queue-tail].fd = fd; queue-data[queue-tail].addr = *addr; +/* If the queue was empty, signal that it no longer is */ +if (queue-head == queue-tail) { +pthread_cond_signal(queue-not_empty); +} queue-tail = (queue-tail + 1) % queue-bounds; if (pthread_mutex_unlock(queue-one_big_mutex) != 0) { return FD_QUEUE_FAILURE; } -if (pthread_cond_signal(queue-not_empty) != 0) -perror(signal didn't work :(); return FD_QUEUE_SUCCESS; } @@ -52,11 +54,14 @@ } fd = queue-data[queue-head].fd; *addr = queue-data[queue-head].addr; +/* If the queue was full, signal that it no longer is */ +if (queue-head == ((queue-tail + 1) % queue-bounds)) { +pthread_cond_signal(queue-not_full); +} queue-head = (queue-head + 1) % queue-bounds; if (pthread_mutex_unlock(queue-one_big_mutex) != 0) { return FD_QUEUE_FAILURE; } -pthread_cond_signal(queue-not_full); return fd; }
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/02/09 23:24:34 Modified:pthreads/src/main http_main.c Log: Put back ap_sync_scoreboard_image. A no-op in most cases, but it'll be needed. Revision ChangesPath 1.13 +9 -0 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -u -r1.12 -r1.13 --- http_main.c 1999/02/09 21:39:56 1.12 +++ http_main.c 1999/02/10 07:24:34 1.13 @@ -423,7 +423,15 @@ static void reopen_scoreboard(pool *p) { } +#endif /* USE_SHMGET_SCOREBOARD */ + +void ap_sync_scoreboard_image(void) +{ +#ifdef SCOREBOARD_FILE +lseek(scoreboard_fd, 0L, 0); +force_read(scoreboard_fd, ap_scoreboard_image, sizeof(*ap_scoreboard_image)); #endif +} API_EXPORT(void) ap_add_version_component(const char *component) { @@ -1965,6 +1973,7 @@ last_non_dead = -1; total_non_dead = 0; +ap_sync_scoreboard_image(); for (i = 0; i ap_daemons_limit; ++i) { int status; idle_thread_count = 0;
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/02/09 23:59:40 Modified:pthreads/src/main http_main.c Log: Two pieces that are closely intertwined (or at least seem to be at 3AM). First, there is now a means for the parent to kill off a child process at will. One thread is assigned the duty of listening to signals and responding to them. Second, the beginnings of proper signal handling. SIGTERM is mostly working. The others shouldn't be too far off, hopefully. Revision ChangesPath 1.14 +495 -18 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -u -r1.13 -r1.14 --- http_main.c 1999/02/10 07:24:34 1.13 +++ http_main.c 1999/02/10 07:59:39 1.14 @@ -487,6 +487,7 @@ ap_destroy_pool(pchild); } /*longjump(tls()-thread_exit, 1); */ +exit(code); } static void usage(char *bin) @@ -940,10 +941,342 @@ return -1; } +static void reclaim_child_processes(int terminate) +{ +int i, status; +long int waittime = 1024 * 16; /* in usecs */ +struct timeval tv; +int waitret, tries; +int not_dead_yet; +#ifndef NO_OTHER_CHILD +other_child_rec *ocr, *nocr; +#endif + +ap_sync_scoreboard_image(); + +for (tries = terminate ? 4 : 1; tries = 9; ++tries) { + /* don't want to hold up progress any more than + * necessary, but we need to allow children a few moments to exit. + * Set delay with an exponential backoff. + */ + tv.tv_sec = waittime / 100; + tv.tv_usec = waittime % 100; + waittime = waittime * 4; + ap_select(0, NULL, NULL, NULL, tv); + + /* now see who is done */ + not_dead_yet = 0; + for (i = 0; i max_daemons_limit; ++i) { + int pid = ap_scoreboard_image-parent[i].pid; + + if (pid == my_pid || pid == 0) + continue; + + waitret = waitpid(pid, status, WNOHANG); + if (waitret == pid || waitret == -1) { + ap_scoreboard_image-parent[i].pid = 0; + continue; + } + ++not_dead_yet; + switch (tries) { + case 1: /* 16ms */ + case 2: /* 82ms */ + break; + case 3: /* 344ms */ + /* perhaps it missed the SIGHUP, lets try again */ + ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, + server_conf, + child process %d did not exit, sending another SIGHUP, + pid); + kill(pid, SIGHUP); + waittime = 1024 * 16; + break; + case 4: /* 16ms */ + case 5: /* 82ms */ + case 6: /* 344ms */ + break; + case 7: /* 1.4sec */ + /* ok, now it's being annoying */ + ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, + server_conf, +child process %d still did not exit, sending a SIGTERM, + pid); + kill(pid, SIGTERM); + break; + case 8: /* 6 sec */ + /* die child scum */ + ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, server_conf, +child process %d still did not exit, sending a SIGKILL, + pid); + kill(pid, SIGKILL); + break; + case 9: /* 14 sec */ + /* gave it our best shot, but alas... If this really + * is a child we are trying to kill and it really hasn't + * exited, we will likely fail to bind to the port + * after the restart. + */ + ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, server_conf, + could not make child process %d exit, + attempting to continue anyway, pid); + break; + } + } +#ifndef NO_OTHER_CHILD + for (ocr = other_children; ocr; ocr = nocr) { + nocr = ocr-next; + if (ocr-pid == -1) + continue; + + waitret = waitpid(ocr-pid, status, WNOHANG); + if (waitret == ocr-pid) { + ocr-pid = -1; + (*ocr-maintenance) (OC_REASON_DEATH, ocr-data, status); + } + else if (waitret == 0) { + (*ocr-maintenance) (OC_REASON_RESTART, ocr-data, -1); + ++not_dead_yet; + } + else if (waitret == -1) { + /* uh what the heck? they didn't call unregister? */ + ocr-pid = -1; + (*ocr-maintenance) (OC_REASON_LOST, ocr-data, -1
cvs commit: apache-apr/pthreads/src/support apachectl
manoj 99/02/14 23:01:58 Modified:pthreads/src/main http_main.c pthreads/src/support apachectl Log: More minor fixes to go with the SIGWINCH change. Even if we switch to a different signal, making everything consistent will make a switchover easier. Revision ChangesPath 1.21 +1 -1 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -u -r1.20 -r1.21 --- http_main.c 1999/02/15 03:12:01 1.20 +++ http_main.c 1999/02/15 07:01:57 1.21 @@ -2737,7 +2737,7 @@ /* kill off the idle ones */ if (ap_killpg(pgrp, SIGWINCH) 0) { - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, killpg SIGHUP); + ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, killpg SIGWINCH); } /* This is mostly for debugging... so that we know what is still 1.3 +2 -2 apache-apr/pthreads/src/support/apachectl Index: apachectl === RCS file: /home/cvs/apache-apr/pthreads/src/support/apachectl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -u -r1.2 -r1.3 --- apachectl 1999/02/07 06:30:18 1.2 +++ apachectl 1999/02/15 07:01:58 1.3 @@ -122,7 +122,7 @@ fi else if $HTTPD -t /dev/null 21; then - if kill -USR1 $PID ; then + if kill -WINCH $PID ; then echo $0 $ARG: httpd gracefully restarted else echo $0 $ARG: httpd could not be restarted @@ -158,7 +158,7 @@ not running fullstatus - dump a full status screen; requires lynx and mod_status enabled status - dump a short status screen; requires lynx and mod_status enabled -graceful - do a graceful restart by sending a SIGUSR1 or start if not running +graceful - do a graceful restart by sending a SIGWINCH or start if not running configtest - do a configuration syntax test help - this screen
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/02/14 23:48:37 Modified:pthreads/src/main http_main.c Log: Fix a buglet. Worker threads didn't note in the scoreboard when they were back in SERVER_READY state. Revision ChangesPath 1.22 +4 -3 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -u -r1.21 -r1.22 --- http_main.c 1999/02/15 07:01:57 1.21 +++ http_main.c 1999/02/15 07:48:36 1.22 @@ -2071,14 +2071,15 @@ int my_pid = ti-pid; int my_tid = ti-tid; struct sockaddr sa_client; +int csd; free(ti); -(void) ap_update_child_status(my_pid, my_tid, SERVER_READY, +while (0 requests_this_child) { +(void) ap_update_child_status(my_pid, my_tid, SERVER_READY, (request_rec *) NULL); -while (0 requests_this_child) { -int csd = queue_pop(csd_queue, sa_client); +csd = queue_pop(csd_queue, sa_client); if (csd = 0) { process_socket(pchild, sa_client, csd, my_pid, my_tid); }
cvs commit: apache-apr/pthreads/src/main http_config.c http_main.c
manoj 99/02/15 22:07:10 Modified:pthreads/src/main http_config.c http_main.c Log: The code used to assume that a 0 fd is an error, which is not the case. Now, -1 is used as the error state instead (as in apache-1.3). Revision ChangesPath 1.8 +1 -1 apache-apr/pthreads/src/main/http_config.c Index: http_config.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_config.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -u -r1.7 -r1.8 --- http_config.c 1999/02/11 16:33:04 1.7 +++ http_config.c 1999/02/16 06:07:09 1.8 @@ -1449,7 +1449,7 @@ new-local_addr.sin_family = AF_INET; new-local_addr.sin_addr = ap_bind_address; new-local_addr.sin_port = htons(s-port ? s-port : DEFAULT_HTTP_PORT); -new-fd = NULL; +new-fd = -1; new-index = 0; new-next = NULL; ap_listeners = new; 1.27 +3 -3 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.26 retrieving revision 1.27 diff -u -u -r1.26 -r1.27 --- http_main.c 1999/02/15 21:04:21 1.26 +++ http_main.c 1999/02/16 06:07:09 1.27 @@ -1447,7 +1447,7 @@ return or-fd; } } -return 0; +return -1; } @@ -1476,13 +1476,13 @@ num_listenfds = 0; for (;;) { fd = find_listener(lr); - if (fd == 0) { + if (fd 0) { fd = make_sock(p, lr-local_addr); } else { ap_note_cleanups_for_fd(p, fd); } - if (fd) { + if (fd = 0) { ++num_listenfds; } lr-fd = fd;
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/02/15 23:10:29 Modified:pthreads/src/main http_main.c Log: Clean up a nasty memory leak. Now apache-apr uses a per-connection pool (ptrans) just like Apache 1.3. Previously, pchild was used, and in my tests, there was anywhere from 12-24k of memory lost per request. Revision ChangesPath 1.29 +9 -5 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.28 retrieving revision 1.29 diff -u -u -r1.28 -r1.29 --- http_main.c 1999/02/16 06:09:46 1.28 +++ http_main.c 1999/02/16 07:10:27 1.29 @@ -290,6 +290,7 @@ static pool *pperm; /* Pool for permananent stuff */ static pool *pconf; /* Pool for config stuff */ +static pool *ptrans; /* Pool for per-transaction stuff */ static pool *ptemp; /* Pool for temporart config stuff */ static pool *pcommands; /* Pool for -C and -c switches */ @@ -1666,7 +1667,7 @@ /* ZZZ doesn't really make sense in a threaded server. */ } -static void process_socket(pool *ptrans, struct sockaddr *sa_client, int csd, int my_child_num, int my_thread_num) +static void process_socket(pool *p, struct sockaddr *sa_client, int csd, int my_child_num, int my_thread_num) { struct sockaddr sa_server; /* */ size_t len = sizeof(struct sockaddr); @@ -1674,7 +1675,7 @@ request_rec *r; conn_rec *current_conn; -ap_note_cleanups_for_fd(ptrans, csd); +ap_note_cleanups_for_fd(p, csd); /* ZZZ change to AP func */ if (getsockname(csd, sa_server, len) 0) { @@ -1683,10 +1684,10 @@ } (void) ap_update_child_status(my_child_num, my_thread_num, SERVER_BUSY_READ, (request_rec *) NULL); -conn_io = ap_bcreate(ptrans, B_RDWR | B_SOCKET); +conn_io = ap_bcreate(p, B_RDWR | B_SOCKET); ap_bpushfd(conn_io, csd, csd); -current_conn = new_connection(ptrans, server_conf, conn_io, +current_conn = new_connection(p, server_conf, conn_io, (const struct sockaddr_in *) sa_client, (const struct sockaddr_in *) sa_server, my_child_num, my_thread_num); @@ -1793,15 +1794,18 @@ free(ti); +ptrans = ap_make_sub_pool(pconf); while (0 requests_this_child) { (void) ap_update_child_status(my_pid, my_tid, SERVER_READY, (request_rec *) NULL); csd = queue_pop(csd_queue, sa_client); if (csd = 0) { - process_socket(pchild, sa_client, csd, my_pid, my_tid); + process_socket(ptrans, sa_client, csd, my_pid, my_tid); } + ap_clear_pool(ptrans); } +ap_destroy_pool(ptrans); ap_update_child_status(my_pid, my_tid, SERVER_DEAD, (request_rec *) NULL); pthread_once(firstcall, graceful_killer);
cvs commit: apache-apr/pthreads/src/modules/standard mod_status.c
manoj 99/02/15 23:41:10 Modified:pthreads/src/modules/standard mod_status.c Log: Add some description of new scoreboard modes of operation. Revision ChangesPath 1.6 +2 -0 apache-apr/pthreads/src/modules/standard/mod_status.c Index: mod_status.c === RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/mod_status.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -u -r1.5 -r1.6 --- mod_status.c 1999/02/15 20:40:30 1.5 +++ mod_status.c 1999/02/16 07:41:09 1.6 @@ -457,6 +457,8 @@ ap_rputs(\BcodeD/code/B\ DNS Lookup,BR\n, r); ap_rputs(\BcodeL/code/B\ Logging, \n, r); ap_rputs(\BcodeG/code/B\ Gracefully finishing, \n, r); + ap_rputs(\BcodeA/code/B\ Accepting on port,BR\n, r); + ap_rputs(\BcodeQ/code/B\ Queueing connection, \n, r); ap_rputs(\Bcode./code/B\ Open slot with no current processP\n, r); ap_rputs(P\n, r); if (!ap_extended_status) {
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/02/16 16:01:54 Modified:pthreads/src/main http_main.c Log: Eep. ptrans existed in the process scope. Now there is one ptrans per thread, and it is sub-pooled off the correct super-pool now. This fixes some very confusing coredumps, which were confusing because there were still coredumps before the original ptrans patch, they were just caused by the lack of ptrans. Revision ChangesPath 1.35 +2 -2 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.34 retrieving revision 1.35 diff -u -u -r1.34 -r1.35 --- http_main.c 1999/02/16 21:37:32 1.34 +++ http_main.c 1999/02/17 00:01:45 1.35 @@ -288,7 +288,6 @@ static pool *pperm; /* Pool for permananent stuff */ static pool *pconf; /* Pool for config stuff */ -static pool *ptrans; /* Pool for per-transaction stuff */ static pool *ptemp; /* Pool for temporart config stuff */ static pool *pcommands; /* Pool for -C and -c switches */ @@ -2313,10 +2312,11 @@ int my_tid = ti-tid; struct sockaddr sa_client; int csd; +pool *ptrans;/* Pool for per-transaction stuff */ free(ti); -ptrans = ap_make_sub_pool(pconf); +ptrans = ap_make_sub_pool(pchild); while (0 requests_this_child) { (void) ap_update_child_status(my_pid, my_tid, SERVER_READY, (request_rec *) NULL);
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/02/16 16:03:43 Modified:pthreads/src/main http_main.c Log: Get rid of some more debugging messages which were clogging the error log. Revision ChangesPath 1.36 +0 -2 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.35 retrieving revision 1.36 diff -u -u -r1.35 -r1.36 --- http_main.c 1999/02/17 00:01:45 1.35 +++ http_main.c 1999/02/17 00:03:41 1.36 @@ -2219,10 +2219,8 @@ while ((r = ap_read_request(current_conn)) != NULL) { (void) ap_update_child_status(my_child_num, my_thread_num, SERVER_BUSY_WRITE, r); - fprintf(stderr,%d child_main: about to process request\n,my_child_num); if (r-status == HTTP_OK) ap_process_request(r); - fprintf(stderr,%d child_main: request done\n,my_child_num); if (ap_extended_status) increment_counts(my_child_num, my_thread_num, r); if (!current_conn-keepalive || ap_is_aborted(current_conn))
cvs commit: apache-apr STATUS
manoj 99/02/16 17:08:19 Modified:.STATUS Log: I really have to get this song out of my head. Revision ChangesPath 1.8 +2 -4 apache-apr/STATUS Index: STATUS === RCS file: /home/cvs/apache-apr/STATUS,v retrieving revision 1.7 retrieving revision 1.8 diff -u -u -r1.7 -r1.8 --- STATUS1999/02/16 16:04:10 1.7 +++ STATUS1999/02/17 01:08:18 1.8 @@ -1,5 +1,5 @@ Apache Portable Runtime STATUS: -Last modified at [$Date: 1999/02/16 16:04:10 $] +Last modified at [$Date: 1999/02/17 01:08:18 $] Release: @@ -25,14 +25,12 @@ Mod_status Re-write mod_status to use updated scoreboard for hybrid server. +This is pretty close to completion. Accept Serialization across Processes Currently, we use one mutex total, we need to change this to be one mutex per socket. Possibly, we could attach the mutex to the listen_rec, and pass it down to the accept loop. - -Memory leakage - It looks like we are leaking, we need to find out why and where. Timeouts. (only soft timeouts)
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/02/16 21:32:02 Modified:pthreads/src/main http_main.c Log: pthread calls while handling a signal are bad voodoo. This is another way to allow cleanups to run after all threads exit. Revision ChangesPath 1.37 +11 -10apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.36 retrieving revision 1.37 diff -u -u -r1.36 -r1.37 --- http_main.c 1999/02/17 00:03:41 1.36 +++ http_main.c 1999/02/17 05:32:00 1.37 @@ -431,13 +431,6 @@ ap_pclosesocket(pconf, lr-fd); lr= lr-next; } - -for (i = 0; i ss-worker_threads + ss-acceptor_threads; i++) { -if (ap_scoreboard_image-servers[index][i].status != SERVER_DEAD) { - pthread_join(ap_scoreboard_image-servers[index][i].tid, NULL); - } -} -clean_child_exit(0); } /** ZZZ this should probably be abstracted to it's own file. / @@ -2300,7 +2293,7 @@ } ap_update_child_status(my_pid, my_tid, SERVER_DEAD, (request_rec *) NULL); pthread_once(firstcall, graceful_killer); -pthread_exit(NULL); +return NULL; } void * worker_thread(void * dummy) @@ -2328,8 +2321,7 @@ ap_destroy_pool(ptrans); ap_update_child_status(my_pid, my_tid, SERVER_DEAD, (request_rec *) NULL); pthread_once(firstcall, graceful_killer); - -pthread_exit(NULL); +return NULL; } /* @@ -2573,6 +2565,15 @@ lr-used = 1; accept_thread(my_info); + +/* Wait for other threads to die, then clean up. Note: joining oneself is + * a bad thing, so we make sure that i my_info-tid, not = */ +for (i = 0; i my_info-tid; i++) { +if (ap_scoreboard_image-servers[my_child_num][i].status != SERVER_DEAD) { + pthread_join(ap_scoreboard_image-servers[my_child_num][i].tid, NULL); + } +} +clean_child_exit(0); } static int make_child(server_rec *s, int slot, time_t now) /* ZZZ */
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/02/17 00:13:16 Modified:.STATUS pthreads/src/main http_main.c Log: Start to remove pthread calls from clean_child_exit to make it legal for a signal handler. There is still a pthread_cancel loop, which seems to work sometimes for killing hanging threads, but not all the time. The real solution is to fix the hanging threads, which seem to be caused by the (accidental?) usage of a cross-process alloc_mutex. The last commit message was messed up. That patch didn't undo any pthread calls during signal handling, but it is still necessary because it prevents the thread from trying to join itself. I need someone to show me how to change stupid commit messages. Revision ChangesPath 1.9 +3 -1 apache-apr/STATUS Index: STATUS === RCS file: /home/cvs/apache-apr/STATUS,v retrieving revision 1.8 retrieving revision 1.9 diff -u -u -r1.8 -r1.9 --- STATUS1999/02/17 01:08:18 1.8 +++ STATUS1999/02/17 08:13:13 1.9 @@ -1,5 +1,5 @@ Apache Portable Runtime STATUS: -Last modified at [$Date: 1999/02/17 01:08:18 $] +Last modified at [$Date: 1999/02/17 08:13:13 $] Release: @@ -40,6 +40,8 @@ Everything Needs patch: + * A patch to make the alloc_mutex's scope per-process. It seems to be +causing trouble on Linux at least. Open issues: 1.38 +17 -3 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.37 retrieving revision 1.38 diff -u -u -r1.37 -r1.38 --- http_main.c 1999/02/17 05:32:00 1.37 +++ http_main.c 1999/02/17 08:13:15 1.38 @@ -397,14 +397,29 @@ listen_rec *lr; parent_score *ss = ap_scoreboard_image-parent[child_num]; +/* XXX - This should be taken care of by the parent process. When it reaps + * the child, it will also update the scoreboard. We can't do this here, + * because clean_child_exit can be called from a signal handler, and + * ap_update_child_status calls pthread_self */ +#if 0 for (i = 0; i ap_threads_per_child + ap_acceptors_per_child; i++) ap_update_child_status(child_num, i, SERVER_DEAD, (request_rec *) NULL); +#endif if (pchild) { ap_child_exit_modules(pchild, server_conf); ap_destroy_pool(pchild); } +/* XXX - This is not allowed in a signal handler either, and it shouldn't + * be needed. But it's still in here, because without it, we get hanging + * threads on linux. The symptom isn't *too* bad on Linux: a core dump in + * the exit() library call. + * + * The root cause seems to be that alloc's pthread mutex is being used + * across processes, which is not kosher on some platforms (i.e. Linux), + * and a thread whacking a pool will hit an acquire_mutex and hang */ + for (i = 0; i ss-worker_threads + ss-acceptor_threads; i++) { if (ap_scoreboard_image-servers[child_num][i].status != SERVER_DEAD) { pthread_cancel(ap_scoreboard_image-servers[child_num][i].tid); @@ -2811,9 +2826,8 @@ if (pid = 0) { child_slot = find_child_by_pid(0); if (child_slot = 0) { - /*(void) ap_update_child_status(child_slot, SERVER_DEAD, - (request_rec *) NULL); - LOOK INTO THIS */ +for (i = 0; i ap_threads_per_child + ap_acceptors_per_child; i++) +ap_update_child_status(child_slot, i, SERVER_DEAD, (request_rec *) NULL); if (remaining_children_to_start child_slot ap_daemons_limit) {
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/02/17 12:28:57 Modified:pthreads/src/main http_main.c Log: First, fix unbalanced locking and unlocking of the exit_mutex (which will hopefully go away when we switch to a single signal-handling thread). Also get rid of a malloc-free pair. Revision ChangesPath 1.42 +13 -11apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.41 retrieving revision 1.42 diff -u -u -r1.41 -r1.42 --- http_main.c 1999/02/17 18:42:01 1.41 +++ http_main.c 1999/02/17 20:28:56 1.42 @@ -176,7 +176,7 @@ int ap_listenbacklog; int ap_dump_settings = 0; int exiting_now = 0; -pthread_mutex_t *exit_mutex; +pthread_mutex_t exit_mutex = PTHREAD_MUTEX_INITIALIZER; API_VAR_EXPORT int ap_extended_status = 0; @@ -406,7 +406,6 @@ ap_destroy_pool(pchild); } -free(exit_mutex); exit(code); } @@ -2288,13 +2287,16 @@ } } ap_update_child_status(my_pid, my_tid, SERVER_DEAD, (request_rec *) NULL); -pthread_mutex_lock(exit_mutex); +pthread_mutex_lock(exit_mutex); if (exiting_now == 0) { exiting_now++; - pthread_mutex_unlock(exit_mutex); + pthread_mutex_unlock(exit_mutex); graceful_killer(); clean_child_exit(0); -} +} +else { +pthread_mutex_unlock(exit_mutex); +} pthread_exit(NULL); } @@ -2323,13 +2325,16 @@ } ap_destroy_pool(ptrans); ap_update_child_status(my_pid, my_tid, SERVER_DEAD, (request_rec *) NULL); -pthread_mutex_lock(exit_mutex); +pthread_mutex_lock(exit_mutex); if (exiting_now == 0) { exiting_now++; - pthread_mutex_unlock(exit_mutex); + pthread_mutex_unlock(exit_mutex); graceful_killer(); clean_child_exit(0); -} +} +else { +pthread_mutex_unlock(exit_mutex); +} pthread_exit(NULL); } @@ -2470,9 +2475,6 @@ requests_this_child = ap_max_requests_per_child; pchild = ap_make_sub_pool(pconf); - -exit_mutex = (pthread_mutex_t *) malloc(sizeof(pthread_mutex_t)); -pthread_mutex_init(exit_mutex, NULL); /*stuff to do before we switch id's, so we have permissions.*/ reopen_scoreboard(pchild);
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/02/17 21:39:53 Modified:pthreads/src/main http_main.c Log: During graceful restart we close our listeners to kick our threads out of accept(), we seem to be missing the first file descriptor, probably because of an errant cut-and-paste. I think this bug didn't show up on Linux because in the single port case, the only thread doing the accept is the parent thread, which is guaranteed to be hit by a signal and interrupted. Revision ChangesPath 1.44 +2 -2 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.43 retrieving revision 1.44 diff -u -u -r1.43 -r1.44 --- http_main.c 1999/02/17 22:39:43 1.43 +++ http_main.c 1999/02/18 05:39:52 1.44 @@ -418,10 +418,10 @@ pthread_cond_broadcast((csd_queue.not_empty)); -/* Setup acceptor threads */ +/* Kick acceptor threads out of accept */ lr = ap_listeners; -while (lr-next != NULL) { +while (lr != NULL) { ap_pclosesocket(pconf, lr-fd); lr= lr-next; }
cvs commit: apache-apr/pthreads/src Configure
manoj 99/02/21 23:36:00 Modified:pthreads/src Configure Log: AIX needs this flag to build the hybrid server correctly. We only enable it for 4.2 and 4.3 so far, because we haven't even tried this on a 4.1 or earlier box yet. Revision ChangesPath 1.5 +2 -2 apache-apr/pthreads/src/Configure Index: Configure === RCS file: /home/cvs/apache-apr/pthreads/src/Configure,v retrieving revision 1.4 retrieving revision 1.5 diff -u -u -r1.4 -r1.5 --- Configure 1999/02/17 08:29:11 1.4 +++ Configure 1999/02/22 07:36:00 1.5 @@ -302,12 +302,12 @@ ;; *-ibm-aix4.2) OS='IBM AIX 4.2' - CFLAGS=$CFLAGS -DAIX=42 -U__STR__ + CFLAGS=$CFLAGS -DAIX=42 -U__STR__ -lpthread LDFLAGS=$LDFLAGS -lm ;; *-ibm-aix4.3) OS='IBM AIX 4.3' - CFLAGS=$CFLAGS -DAIX=43 -U__STR__ + CFLAGS=$CFLAGS -DAIX=43 -U__STR__ -lpthread LDFLAGS=$LDFLAGS -lm ;; *-ibm-aix*)
cvs commit: apache-apr/pthreads/src/main http_protocol.c
manoj 99/03/03 16:07:00 Modified:pthreads/src/main http_protocol.c Log: Allow the code to compile on AIX. Revision ChangesPath 1.8 +2 -2 apache-apr/pthreads/src/main/http_protocol.c Index: http_protocol.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_protocol.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -u -r1.7 -r1.8 --- http_protocol.c 1999/02/26 16:37:20 1.7 +++ http_protocol.c 1999/03/04 00:06:58 1.8 @@ -956,8 +956,8 @@ else if (rv == -1) { ap_bclose(r-connection-client); ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - Timeout hasn't occured, but something is wrong, - closing the connection.); + Timeout hasn't occured, but something is wrong, + closing the connection.); } else { if (filedes-revents = POLLIN) {
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/03/16 13:26:27 Modified:pthreads/src/main http_main.c Log: Allow the server to exit in single-process (-X) mode when we hit Ctrl-C. This involves making the server respond to SIGINT like it does with SIGTERM in the signal-handling thread. Revision ChangesPath 1.59 +4 -0 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.58 retrieving revision 1.59 diff -u -u -r1.58 -r1.59 --- http_main.c 1999/03/15 15:34:50 1.58 +++ http_main.c 1999/03/16 21:26:26 1.59 @@ -2103,6 +2103,7 @@ sigemptyset(sig_mask); sigaddset(sig_mask, SIGWINCH); sigaddset(sig_mask, SIGTERM); +sigaddset(sig_mask, SIGINT); sigwait(sig_mask, signal_received); /* XXX - Do the appropriate thing for each signal */ switch (signal_received) { @@ -2114,6 +2115,9 @@ case SIGTERM: just_die(SIGTERM); break; +case SIGINT: +just_die(SIGINT); +break; default: ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf, received strange signal: %d, signal_received);
cvs commit: apache-apr/pthreads/src/modules/standard mod_so.c
manoj 99/03/16 14:07:58 Modified:pthreads/src/main http_config.c http_log.c http_main.c http_protocol.c pthreads/src/modules/standard mod_so.c Log: More SIGUSR1 - SIGWINCH fixes. This should fix every mention of USR1 for restarts except for the documentation. Revision ChangesPath 1.10 +2 -7 apache-apr/pthreads/src/main/http_config.c Index: http_config.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_config.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -u -r1.9 -r1.10 --- http_config.c 1999/02/16 16:00:48 1.9 +++ http_config.c 1999/03/16 22:07:55 1.10 @@ -1523,14 +1523,9 @@ #ifdef SIGHUP signal(SIGHUP, SIG_IGN); #endif -/* XXX - LinuxThreads uses SIGUSR1, so we can't muck with it. Bummer. We - * need to find another way to do graceful restarts if we want to support - * kernel threads with Linux 2.0 (2.2 is supposed to fix this) - mvsk */ -#ifndef LINUX -#ifdef SIGUSR1 -signal(SIGUSR1, SIG_IGN); +#ifdef SIGWINCH +signal(SIGWINCH, SIG_IGN); #endif -#endif /* ndef LINUX */ for (m = top_module; m; m = m-next) if (m-child_exit) 1.3 +1 -1 apache-apr/pthreads/src/main/http_log.c Index: http_log.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_log.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -u -r1.2 -r1.3 --- http_log.c1999/02/07 06:29:30 1.2 +++ http_log.c1999/03/16 22:07:55 1.3 @@ -482,7 +482,7 @@ fname = ap_server_root_relative(p, fname); mypid = getpid(); if (mypid != saved_pid stat(fname, finfo) == 0) { - /* USR1 and HUP call this on each restart. + /* WINCH and HUP call this on each restart. * Only warn on first time through for this pid. * * XXX: Could just write first time through too, although 1.60 +0 -7 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.59 retrieving revision 1.60 diff -u -u -r1.59 -r1.60 --- http_main.c 1999/03/16 21:26:26 1.59 +++ http_main.c 1999/03/16 22:07:55 1.60 @@ -2079,13 +2079,6 @@ /* All threads should mask signals out, accoring to sigwait(2) man page */ sigemptyset(sig_mask); -/* Linux 2.0 and its annoying use of SIGUSR{1,2} */ -#ifdef LINUX -/* -sigaddset(sig_mask, SIGUSR1); -sigaddset(sig_mask, SIGUSR2); -*/ -#endif if (pthread_sigmask(SIG_SETMASK, sig_mask, NULL) != 0) { ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf, pthread_sigmask); 1.10 +2 -7 apache-apr/pthreads/src/main/http_protocol.c Index: http_protocol.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_protocol.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -u -r1.9 -r1.10 --- http_protocol.c 1999/03/15 14:26:50 1.9 +++ http_protocol.c 1999/03/16 22:07:55 1.10 @@ -789,14 +789,9 @@ } /* we've probably got something to do, ignore graceful restart requests */ -/* XXX - LinuxThreads uses SIGUSR1, so we can't muck with it. Bummer. We - * need to find another way to do graceful restarts if we want to support - * kernel threads with Linux 2.0 (2.2 is supposed to fix this) - mvsk */ -#ifndef LINUX -#ifdef SIGUSR1 -signal(SIGUSR1, SIG_IGN); +#ifdef SIGWINCH +signal(SIGWINCH, SIG_IGN); #endif -#endif /* ndef LINUX */ ap_bsetflag(conn-client, B_SAFEREAD, 0); 1.3 +2 -2 apache-apr/pthreads/src/modules/standard/mod_so.c Index: mod_so.c === RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/mod_so.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -u -r1.2 -r1.3 --- mod_so.c 1999/02/07 06:29:55 1.2 +++ mod_so.c 1999/03/16 22:07:58 1.3 @@ -58,7 +58,7 @@ /* * This module is used to load Apache modules at runtime. This means that the * server functionality can be extended without recompiling and even without - * taking the server down at all. Only a HUP or USR1 signal needs to be send + * taking the server down at all. Only a HUP or WINCH signal needs to be send * to the server to reload the dynamically loaded modules. * * To use, you'll first need to build your module as a shared library, then @@ -97,7 +97,7 @@ * directive to get these log messages
cvs commit: apache-apr/pthreads/src/support ab.1 ab.c apachectl apachectl.1 apxs.pl dbmmanage.1 htpasswd.c httpd.exp suexec.c
manoj 99/03/17 09:02:13 Modified:pthreads ABOUT_APACHE INSTALL Makefile.tmpl README.configure config.layout configure pthreads/conf httpd.conf-dist httpd.conf-dist-win mime.types pthreads/htdocs/manual content-negotiation.html handler.html index.html sections.html pthreads/htdocs/manual/misc API.html FAQ.html pthreads/htdocs/manual/mod core.html directives.html mod_alias.html mod_negotiation.html mod_so.html pthreads/htdocs/manual/vhosts details.html name-based.html pthreads/src ApacheCore.def CHANGES Configure Makefile.tmpl Makefile_win32.txt Makefile_win32_debug.txt pthreads/src/ap ap_execve.c pthreads/src/helpers GuessOS PrintPath TestCompile binbuild.sh buildinfo.sh find-dbm-lib install.sh slo.sh pthreads/src/include alloc.h ap_config.h ap_ctype.h ap_mmn.h http_config.h http_request.h httpd.h pthreads/src/main alloc.c buff.c gen_test_char.c http_config.c http_core.c http_log.c http_main.c http_protocol.c http_request.c scoreboard.c util.c util_date.c util_script.c pthreads/src/modules/proxy mod_proxy.c mod_proxy.h proxy_cache.c proxy_connect.c proxy_ftp.c proxy_http.c proxy_util.c pthreads/src/modules/standard mod_cgi.c mod_include.c mod_negotiation.c mod_rewrite.c mod_rewrite.h mod_so.c mod_userdir.c pthreads/src/os/bs2000 os.h pthreads/src/os/os2 os.h util_os2.c pthreads/src/os/win32 os.h util_win32.c pthreads/src/os/win32/installer/installdll install.c install.dsp install.mak pthreads/src/os/win32/installer/installdll/test resource.h test.c test.mak test.rc pthreads/src/support ab.1 ab.c apachectl apachectl.1 apxs.pl dbmmanage.1 htpasswd.c httpd.exp suexec.c Log: Update apache-pthreads to the current state of Apache 1.3 as of around 9PM PST, Mar 16. Revision ChangesPath 1.2 +17 -14apache-apr/pthreads/ABOUT_APACHE Index: ABOUT_APACHE === RCS file: /home/cvs/apache-apr/pthreads/ABOUT_APACHE,v retrieving revision 1.1 retrieving revision 1.2 diff -u -u -r1.1 -r1.2 --- ABOUT_APACHE 1999/01/21 23:08:29 1.1 +++ ABOUT_APACHE 1999/03/17 16:59:14 1.2 @@ -3,7 +3,7 @@ http://www.apache.org/ - September 1998 + February 1999 The Apache Project is a collaborative software development effort aimed at creating a robust, commercial-grade, featureful, and freely-available @@ -65,17 +65,20 @@ Less than a year after the group was formed, the Apache server passed NCSA's httpd as the #1 server on the Internet. +The survey by Netcraft (http://www.netcraft.com/survey/) shows that Apache +is today more widely used than all other web servers combined. + -Current Apache Group in alphabetical order as of 23 September 1998: +Current Apache Group in alphabetical order as of 14 February 1999: - Brian Behlendorf Organic Online, California + Brian Behlendorf O'Reilly and Associates, California Ken Coar IBM Corporation, Research Triangle Park, NC, USA Mark J. CoxC2Net Europe, UK - Lars EilebrechtKreuztal, Germany + Lars EilebrechtCable Wireless ECRC, Munich, Germany Ralf S. EngelschallMunich, Germany. Roy T. FieldingUC Irvine, California - Dean GaudetTransmeta Corporation, California + Dean GaudetCritical Path, California Rob HartillInternet Movie DB, UK Ben Hyde Gensym, Massachusetts Jim Jagielski jaguNET ISP, Maryland @@ -85,11 +88,11 @@ Doug MacEachernFreelance Consultant, Summer Seasons, Earth Aram W. Mirzadeh Qosina Corporation, New York Sameer Parekh C2Net, California - Marc SlemkoCanada Cliff Skolnick Freelance, California + Marc SlemkoCanada Bill Stoddard IBM Corp., Research Triangle Park, NC Paul SuttonC2Net Europe, UK - Randy Terbush Zyzzyva ISP, Nebraska + Randy Terbush Covalent Technologies, Nebraska Dirk-Willem van Gulik Freelance Consultant
cvs commit: apache-1.3/src/main http_main.c
manoj 99/03/17 15:05:47 Modified:src/main http_main.c Log: Small bugfix. A child process used to exit after MaxRequestsPerChild - 1 requests. This patch puts the increment of requests_this_child after the ap_max_requests_per_child check so the server will process that one last request before dying. Revision ChangesPath 1.427 +1 -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.426 retrieving revision 1.427 diff -u -u -r1.426 -r1.427 --- http_main.c 1999/03/10 11:06:10 1.426 +++ http_main.c 1999/03/17 23:05:43 1.427 @@ -3621,7 +3621,7 @@ #ifndef WIN32 if ((ap_max_requests_per_child 0 - ++requests_this_child = ap_max_requests_per_child)) { + requests_this_child++ = ap_max_requests_per_child)) { clean_child_exit(0); } #else
cvs commit: apache-apr/pthreads/src/test test_find.c test_parser.c
manoj 99/03/17 21:37:51 Added: pthreads/src/test test_find.c test_parser.c Log: New files from Apache 1.3 as part of the latest sync-up. Revision ChangesPath 1.1 apache-apr/pthreads/src/test/test_find.c Index: test_find.c === /* This program tests the ap_find_list_item routine in ../main/util.c. * * The defines in this sample compile line are specific to Roy's system. * They should match whatever was used to compile Apache first. * gcc -g -O2 -I../os/unix -I../include -o test_find \ -DSOLARIS2=250 -Wall -DALLOC_DEBUG -DPOOL_DEBUG \ ../main/alloc.o ../main/buff.o ../main/util.o \ ../ap/libap.a -lsocket -lnsl test_find.c * * Roy Fielding, 1999 */ #include stdio.h #include stdlib.h #include httpd.h #include alloc.h /* * Dummy a bunch of stuff just to get a compile */ uid_t ap_user_id; gid_t ap_group_id; void *ap_dummy_mutex = ap_dummy_mutex; char *ap_server_argv0; API_EXPORT(void) ap_block_alarms(void) { ; } API_EXPORT(void) ap_unblock_alarms(void) { ; } API_EXPORT(void) ap_log_error(const char *file, int line, int level, const request_rec *r, const char *fmt, ...) { ; } int main (void) { ap_pool *p; char line[512]; char tok[512]; p = ap_init_alloc(); printf(Enter field value to find items within:\n); if (!gets(line)) exit(0); printf(Enter search item:\n); while (gets(tok)) { printf( [%s] == %s\n, tok, ap_find_list_item(p, line, tok) ? Yes : No); printf(Enter search item:\n); } exit(0); } 1.1 apache-apr/pthreads/src/test/test_parser.c Index: test_parser.c === /* This program tests the ap_get_list_item routine in ../main/util.c. * * The defines in this sample compile line are specific to Roy's system. * They should match whatever was used to compile Apache first. * gcc -g -O2 -I../os/unix -I../include -o test_parser \ -DSOLARIS2=250 -Wall -DALLOC_DEBUG -DPOOL_DEBUG \ ../main/alloc.o ../main/buff.o ../main/util.o \ ../ap/libap.a -lsocket -lnsl test_parser.c * * Roy Fielding, 1999 */ #include stdio.h #include stdlib.h #include httpd.h #include alloc.h /* * Dummy a bunch of stuff just to get a compile */ uid_t ap_user_id; gid_t ap_group_id; void *ap_dummy_mutex = ap_dummy_mutex; char *ap_server_argv0; API_EXPORT(void) ap_block_alarms(void) { ; } API_EXPORT(void) ap_unblock_alarms(void) { ; } API_EXPORT(void) ap_log_error(const char *file, int line, int level, const request_rec *r, const char *fmt, ...) { ; } int main (void) { ap_pool *p; const char *field; char *newstr; char instr[512]; p = ap_init_alloc(); while (gets(instr)) { printf( [%s] ==\n, instr); field = instr; while ((newstr = ap_get_list_item(p, field)) != NULL) printf( %s ..\n, newstr); } exit(0); }
cvs commit: apache-apr/pthreads/src/main http_main.c http_protocol.c
manoj 99/03/21 02:51:46 Modified:pthreads/src/main http_main.c http_protocol.c Log: Add a comment related to the previous patch, and rewrap another one. Revision ChangesPath 1.64 +2 -0 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.63 retrieving revision 1.64 diff -u -u -r1.63 -r1.64 --- http_main.c 1999/03/21 10:42:34 1.63 +++ http_main.c 1999/03/21 10:51:43 1.64 @@ -2157,6 +2157,8 @@ if (one_process) { set_signals(); + /* Needed even in the one process case because lookup of the process + * pid sometimes must go through the scoreboard */ ap_scoreboard_image-parent[slot].pid = getpid(); child_main(slot); } 1.14 +3 -3 apache-apr/pthreads/src/main/http_protocol.c Index: http_protocol.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_protocol.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -u -r1.13 -r1.14 --- http_protocol.c 1999/03/21 10:42:34 1.13 +++ http_protocol.c 1999/03/21 10:51:44 1.14 @@ -808,9 +808,9 @@ /* XXX - sigwait doesn't work if the signal has been SIG_IGNed (under * linux 2.0 w/ glibc 2.0, anyway), and this step isn't necessary when - * we're running a sigwait thread anyway. If/when unthreaded mode is put - * back in, we should make sure to ignore this signal iff a sigwait thread - * isn't used. - mvsk + * we're running a sigwait thread anyway. If/when unthreaded mode is + * put back in, we should make sure to ignore this signal iff a sigwait + * thread isn't used. - mvsk #ifdef SIGWINCH signal(SIGWINCH, SIG_IGN);
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/03/22 12:38:04 Modified:pthreads/src/main http_main.c Log: Revision ChangesPath 1.66 +22 -12apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.65 retrieving revision 1.66 diff -u -u -r1.65 -r1.66 --- http_main.c 1999/03/22 20:10:41 1.65 +++ http_main.c 1999/03/22 20:38:03 1.66 @@ -218,6 +218,10 @@ /* The queue of sockets we've accepted */ static FDQueue csd_queue; +/* Indicates that all acceptor threads are dead after SIGWINCH and the worker + * threads can now exit */ +static int workers_may_exit = 0; + /* stuff that needs thread local store in main */ typedef struct { jmp_buf thread_exit; @@ -417,7 +421,14 @@ void kill_workers(void) { +int i; +int index = find_child_by_pid(getpid()); +parent_score *ss = ap_scoreboard_image-parent[index]; + pthread_cond_broadcast((csd_queue.not_empty)); +for (i = 0; i ss-worker_threads; i++) { + pthread_join(ap_scoreboard_image-servers[index][i].tid, NULL); +} } /* Kill off any acceptor threads by kicking them out of what they are doing @@ -428,6 +439,11 @@ void kill_acceptors(void) { listen_rec *lr; +int i; +int index = find_child_by_pid(getpid()); +parent_score *ss = ap_scoreboard_image-parent[index]; + + /* Kick acceptor threads out of accept */ lr = ap_listeners; @@ -438,23 +454,18 @@ /* Kick any acceptor out of blocking on a full queue */ pthread_cond_broadcast((csd_queue.not_full)); + +for (i = ss-worker_threads; i ss-worker_threads + ss-acceptor_threads; i++) { + pthread_join(ap_scoreboard_image-servers[index][i].tid, NULL); +} } void graceful_killer(void) { -int i; -int index = find_child_by_pid(getpid()); -parent_score *ss = ap_scoreboard_image-parent[index]; - /* The two functions to get all of our other threads to die off. */ kill_acceptors(); +workers_may_exit = 1; kill_workers(); - -for (i = 0; i ss-worker_threads + ss-acceptor_threads; i++) { -if (ap_scoreboard_image-servers[index][i].status != SERVER_DEAD) { - pthread_join(ap_scoreboard_image-servers[index][i].tid, NULL); - } -} } int ap_get_timeout(request_rec *r) @@ -1865,8 +1876,7 @@ free(ti); ptrans = ap_make_sub_pool(pchild); -while ((ap_max_requests_per_child != 0 requests_this_child 0) || - (ap_max_requests_per_child == 0)) { +while (!(workers_may_exit (queue_size(csd_queue) == 0))) { (void) ap_update_child_status(my_pid, my_tid, SERVER_READY, (request_rec *) NULL);
cvs commit: apache-1.3/src Configure
manoj 99/03/30 00:58:34 Modified:src Configure Log: Reviewed by: Ryan Bloom Fix DSO support under AIX 4.3. With using_shlib forced to 0, many of the settings needed in the Makefile to build DSOs don't get set. Revision ChangesPath 1.337 +0 -1 apache-1.3/src/Configure Index: Configure === RCS file: /home/cvs/apache-1.3/src/Configure,v retrieving revision 1.336 retrieving revision 1.337 diff -u -u -r1.336 -r1.337 --- Configure 1999/03/30 06:19:07 1.336 +++ Configure 1999/03/30 08:58:33 1.337 @@ -311,7 +311,6 @@ LDFLAGS=$LDFLAGS -lm RULE_SHARED_CORE=no DEF_SHARED_CORE=no - using_shlib=0 ;; *-ibm-aix*) OS='IBM AIX'
cvs commit: apache-apr/pthreads/src/modules/standard mod_status.c
manoj 99/03/31 22:24:49 Modified:pthreads/src/modules/standard mod_status.c Log: Some tweaks to mod_status. It now correctly reports the number of connections being processed, and notes that they are connections instead of requests. Revision ChangesPath 1.8 +3 -2 apache-apr/pthreads/src/modules/standard/mod_status.c Index: mod_status.c === RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/mod_status.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -u -r1.7 -r1.8 --- mod_status.c 1999/03/23 22:03:20 1.7 +++ mod_status.c 1999/04/01 06:24:48 1.8 @@ -317,7 +317,8 @@ tid_buffer[i][j] = (int) score_record.tid; if (res == SERVER_READY) ready++; - else if (res != SERVER_DEAD) + else if (res != SERVER_DEAD res != SERVER_ACCEPTING + res != SERVER_QUEUEING res != SERVER_STARTING) busy++; if (ap_extended_status) { lres = score_record.access_count; @@ -424,7 +425,7 @@ }/* ap_extended_status */ if (!short_report) - ap_rprintf(r, \n%d requests currently being processed, %d idle servers\n + ap_rprintf(r, \n%d connections currently being processed, %d idle servers\n ,busy, ready); else ap_rprintf(r, BusyServers: %d\nIdleServers: %d\n, busy, ready);
cvs commit: apache-apr STATUS
manoj 99/04/08 01:53:47 Modified:.STATUS Log: Nasty hot weather is here. It's late this year. Revision ChangesPath 1.18 +13 -1 apache-apr/STATUS Index: STATUS === RCS file: /home/cvs/apache-apr/STATUS,v retrieving revision 1.17 retrieving revision 1.18 diff -u -u -r1.17 -r1.18 --- STATUS1999/03/23 22:06:30 1.17 +++ STATUS1999/04/08 08:53:46 1.18 @@ -1,5 +1,5 @@ Apache Portable Runtime STATUS: -Last modified at [$Date: 1999/03/23 22:06:30 $] +Last modified at [$Date: 1999/04/08 08:53:46 $] Release: @@ -36,9 +36,21 @@ mod_log_referer.c -- mod_log_config changes. If yes, I'll test -- them later. +Warning scrubbing +Get rid of all reasonable warnings with the strictest compiler flags, +to help weed out bugs + Everything Needs patch: + +On Red Hat 5.2, with a very low MaxRequestsPerChild (e.g. 10), when the +server is banged on with ApacheBench, occasionally, the main thread of a +process hangs around in pthread_exit_process. The size of that process is +always around 11M. This bug is also exhibited by sending lots of SIGHUPs +to the parent process rapidly (but not SIGWINCHes). The suspicion is that +this is either an error in how pthread calls are used in the server, or a +libc bug (the last refuge of a desperate programer). Open issues:
cvs commit: apache-apr/pthreads/src/modules/standard mod_info.c
manoj 99/04/08 19:07:55 Modified:pthreads/src/modules/standard mod_info.c Log: Submitted by: James Morris [EMAIL PROTECTED] mod_info fix. It actually seems to work now. Revision ChangesPath 1.3 +2 -1 apache-apr/pthreads/src/modules/standard/mod_info.c Index: mod_info.c === RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/mod_info.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -u -r1.2 -r1.3 --- mod_info.c1999/02/07 06:29:53 1.2 +++ mod_info.c1999/04/09 02:07:55 1.3 @@ -425,7 +425,8 @@ ap_rprintf(r, strongMax Requests:/strong ttper child: %d nbsp;nbsp; keep alive: %s nbsp;nbsp; -max per connection: /ttbr\n, +max per connection: %d/ttbr\n, +ap_max_requests_per_child, (serv-keep_alive ? on : off), serv-keep_alive_max); ap_rprintf(r, strongThreads:/strong
cvs commit: apache-apr/pthreads/src/modules/standard mod_info.c
manoj 99/04/08 19:14:25 Modified:pthreads/src/modules/standard mod_info.c Log: Undo my stupid messed up commit temporarily. Revision ChangesPath 1.4 +1 -2 apache-apr/pthreads/src/modules/standard/mod_info.c Index: mod_info.c === RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/mod_info.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -u -r1.3 -r1.4 --- mod_info.c1999/04/09 02:07:55 1.3 +++ mod_info.c1999/04/09 02:14:23 1.4 @@ -425,8 +425,7 @@ ap_rprintf(r, strongMax Requests:/strong ttper child: %d nbsp;nbsp; keep alive: %s nbsp;nbsp; -max per connection: %d/ttbr\n, -ap_max_requests_per_child, +max per connection: /ttbr\n, (serv-keep_alive ? on : off), serv-keep_alive_max); ap_rprintf(r, strongThreads:/strong
cvs commit: apache-apr/pthreads/src/modules/standard mod_info.c
manoj 99/04/08 19:31:24 Modified:.STATUS pthreads/src CHANGES pthreads/src/modules/standard mod_info.c Log: Submitted by: James Morris [EMAIL PROTECTED] Fix to ap_rprintf call that allows mod_info to work properly Revision ChangesPath 1.19 +1 -2 apache-apr/STATUS Index: STATUS === RCS file: /home/cvs/apache-apr/STATUS,v retrieving revision 1.18 retrieving revision 1.19 diff -u -u -r1.18 -r1.19 --- STATUS1999/04/08 08:53:46 1.18 +++ STATUS1999/04/09 02:31:21 1.19 @@ -1,5 +1,5 @@ Apache Portable Runtime STATUS: -Last modified at [$Date: 1999/04/08 08:53:46 $] +Last modified at [$Date: 1999/04/09 02:31:21 $] Release: @@ -29,7 +29,6 @@ Modules that don't work: mod_digest.c --Anybody have a client that can transmit Digest Auth? - mod_info.c --DOES NOT WORK AT ALL! Questionable modules: (Not tested.) mod_log_agent.c -- Are we keeping these in 2.0 after Ken's 1.5 +3 -0 apache-apr/pthreads/src/CHANGES Index: CHANGES === RCS file: /home/cvs/apache-apr/pthreads/src/CHANGES,v retrieving revision 1.4 retrieving revision 1.5 diff -u -u -r1.4 -r1.5 --- CHANGES 1999/04/08 14:37:15 1.4 +++ CHANGES 1999/04/09 02:31:22 1.5 @@ -1,5 +1,8 @@ Changes with Apache apr + *) Fix to ap_rprintf call that allows mod_info to work properly [James + Morris [EMAIL PROTECTED]] + *) user and ap_auth_type fields were moved from connection_rec to request_rec. [Ryan Bloom [EMAIL PROTECTED] 1.5 +2 -1 apache-apr/pthreads/src/modules/standard/mod_info.c Index: mod_info.c === RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/mod_info.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -u -r1.4 -r1.5 --- mod_info.c1999/04/09 02:14:23 1.4 +++ mod_info.c1999/04/09 02:31:24 1.5 @@ -425,7 +425,8 @@ ap_rprintf(r, strongMax Requests:/strong ttper child: %d nbsp;nbsp; keep alive: %s nbsp;nbsp; -max per connection: /ttbr\n, +max per connection: %d/ttbr\n, +ap_max_requests_per_child, (serv-keep_alive ? on : off), serv-keep_alive_max); ap_rprintf(r, strongThreads:/strong
cvs commit: apache-apr/pthreads/src/main acceptlock.c
manoj 99/04/08 20:15:40 Modified:pthreads/src/main acceptlock.c Log: Fix acceptlock bugs found during warning scrubbing. expand_lock_fname is now static. Also, the psprintf in that function had an extra argument (the parent process pid), which wasn't used, and can't be used in child processes, but which is useful. So, we use it by create a new init_lock_fname which is used only in the parent process so that the getpid() call returns the expected result. Revision ChangesPath 1.3 +10 -5 apache-apr/pthreads/src/main/acceptlock.c Index: acceptlock.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/acceptlock.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -u -r1.2 -r1.3 --- acceptlock.c 1999/03/07 00:47:49 1.2 +++ acceptlock.c 1999/04/09 03:15:40 1.3 @@ -81,14 +81,17 @@ #if defined(USE_FCNTL_SERIALIZED_ACCEPT) || defined(USE_FLOCK_SERIALIZED_ACCEPT) -char * expand_lock_fname(pool *p, int i) +static void init_lock_fname(pool *p) { -char *fname; /* possibly bogus cast */ -fname = ap_psprintf(p, %s.%d, - ap_server_root_relative(p, ap_lock_fname), i, (unsigned long)getpid()); -return fname; +ap_lock_fname = ap_psprintf(p, %s.%lu, +ap_server_root_relative(p, ap_lock_fname), (unsigned long)getpid()); } + +static char * expand_lock_fname(pool *p, int i) +{ +return ap_psprintf(p, %s.%d, ap_lock_fname, i); +} #endif #if defined (USE_USLOCK_SERIALIZED_ACCEPT) @@ -423,6 +426,7 @@ unlock_it.l_type = F_UNLCK; /* set exclusive/write lock */ unlock_it.l_pid = 0; /* pid not actually interesting */ +init_lock_fname(p); for (i = 0; i ap_acceptors_per_child; i++) { lock_fname = expand_lock_fname(p, i); lock_fd[i] = ap_popenf(p, lock_fname, @@ -517,6 +521,7 @@ char *lock_fname; lock_fd = (int *)ap_palloc(p, ap_acceptors_per_child * sizeof(int *)); +init_lock_fname(p); for (i = 0; i ap_acceptors_per_child; i++) { lock_fname = expand_lock_fname(p, i); unlink(lock_fname);
cvs commit: apache-apr/pthreads/src/os/unix os.h
manoj 99/04/08 20:33:40 Modified:pthreads/src/os/unix os.h Log: Remove extra ap_spawnvp declaration. Revision ChangesPath 1.5 +1 -6 apache-apr/pthreads/src/os/unix/os.h Index: os.h === RCS file: /home/cvs/apache-apr/pthreads/src/os/unix/os.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -u -r1.4 -r1.5 --- os.h 1999/04/08 22:42:20 1.4 +++ os.h 1999/04/09 03:33:39 1.5 @@ -75,6 +75,7 @@ #define INLINE extern ap_inline INLINE int ap_os_is_path_absolute(const char *file); +/* spawn = fork + exec on unix */ INLINE int ap_spawnvp(const char *file, char *const argv[]); #include os-inline.c @@ -101,12 +102,6 @@ #ifdef HAVE_DL_H #include dl.h #endif - -/* - * spawn = fork + exec on unix - */ - -extern int ap_spawnvp(const char *, char *const []); /* * Do not use native AIX DSO support
cvs commit: apache-apr/pthreads/src/main alloc.c
manoj 99/04/08 20:43:28 Modified:pthreads/src/main alloc.c Log: An attempt to fix Roy's problems with ALLOC_DEBUG. The server will also compile with POOL_DEBUG now. Revision ChangesPath 1.5 +14 -4 apache-apr/pthreads/src/main/alloc.c Index: alloc.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/alloc.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -u -r1.4 -r1.5 --- alloc.c 1999/03/17 17:01:16 1.4 +++ alloc.c 1999/04/09 03:43:28 1.5 @@ -159,6 +159,10 @@ union block_hdr *global_next; struct pool *owning_pool; #endif +#if defined(ALLOC_DEBUG) !defined(ALLOC_USE_MALLOC) +unsigned is_free; +#endif + } h; }; @@ -284,14 +288,14 @@ #define reset_block(b) do { \ test_is_free(b); \ (b)-h.first_avail = (char *) ((b) + 1);\ -debug_fill((b)-h.first_avail, b(b)-h.endp - (b)-h.first_avail); \ +debug_fill((b)-h.first_avail, (b)-h.endp - (b)-h.first_avail); \ (b)-h.owning_pool = FREE_POOL; \ } while(0) #else #define reset_block(b) do { \ test_is_free(b); \ (b)-h.first_avail = (char *) ((b) + 1);\ -debug_fill((b)-h.first_avail, b(b)-h.endp - (b)-h.first_avail); \ +debug_fill((b)-h.first_avail, (b)-h.endp - (b)-h.first_avail); \ } while(0) #endif @@ -359,6 +363,9 @@ blok-h.next = NULL; debug_verify_filled(blok-h.first_avail, blok-h.endp, Ouch! Someone trounced a block on the free list!\n); +#if defined(ALLOC_DEBUG) !defined(ALLOC_USE_MALLOC) +blok-h.is_free = 0; +#endif return blok; } else { @@ -371,6 +378,9 @@ min_size += BLOCK_MINFREE; blok = malloc_block((min_size BLOCK_MINALLOC) ? min_size : BLOCK_MINALLOC); +#if defined(ALLOC_DEBUG) !defined(ALLOC_USE_MALLOC) +blok-h.is_free = 0; +#endif return blok; } @@ -431,7 +441,7 @@ new_pool = (root_pool *) blok-h.first_avail; blok-h.first_avail += ROOT_HDR_BYTES; #ifdef POOL_DEBUG -blok-h.owning_pool = new_pool; +blok-h.owning_pool = (new_pool-p); #endif memset(new_pool, 0, sizeof(*new_pool)); @@ -931,7 +941,7 @@ ps.blok-h.owning_pool = p; #endif #if defined(ALLOC_DEBUG) !defined(ALLOC_USE_MALLOC) - ps.blok-is_free = 0; + ps.blok-h.is_free = 0; #endif }
cvs commit: apache-apr/pthreads/src/modules/standard mod_auth.c mod_auth_anon.c mod_auth_db.c mod_auth_dbm.c mod_digest.c
manoj 99/04/08 21:10:41 Modified:pthreads/src/include alloc.h buff.h http_main.h scoreboard.h pthreads/src/main buff.c fdqueue.c http_accept.c http_main.c http_protocol.c scoreboard.c pthreads/src/modules/standard mod_auth.c mod_auth_anon.c mod_auth_db.c mod_auth_dbm.c mod_digest.c Log: Lots of minor changes that mostly eliminate warnings during a compile with whininess settings turned on. Revision ChangesPath 1.5 +2 -1 apache-apr/pthreads/src/include/alloc.h Index: alloc.h === RCS file: /home/cvs/apache-apr/pthreads/src/include/alloc.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -u -r1.4 -r1.5 --- alloc.h 1999/03/17 17:01:06 1.4 +++ alloc.h 1999/04/09 04:10:34 1.5 @@ -93,7 +93,8 @@ pool * ap_init_alloc(void); /* Set up everything */ void ap_child_init_alloc(void); /* Set up everything */ -API_EXPORT(pool *) ap_make_sub_pool(pool *); /* All pools are subpools of permanent_pool */ +API_EXPORT(pool *) ap_make_sub_pool(pool *); +API_EXPORT(pool *) ap_make_root_pool(void); API_EXPORT(void) ap_destroy_pool(pool *); /* used to guarantee to the pool debugging code that the sub pool will not be 1.4 +4 -0 apache-apr/pthreads/src/include/buff.h Index: buff.h === RCS file: /home/cvs/apache-apr/pthreads/src/include/buff.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -u -r1.3 -r1.4 --- buff.h1999/03/15 14:26:48 1.3 +++ buff.h1999/04/09 04:10:35 1.4 @@ -145,6 +145,10 @@ /* Stream creation and modification */ API_EXPORT(BUFF *) ap_bcreate(pool *p, int flags); API_EXPORT(void) ap_bpushfd(BUFF *fb, int fd_in, int fd_out); + +/* XXX - unused right now - mvsk */ +API_EXPORT(BUFF *) ap_bopenf(pool *a, const char *name, int flg, int mode); + #ifdef WIN32 API_EXPORT(void) ap_bpushh(BUFF *fb, HANDLE hFH); #endif 1.5 +2 -0 apache-apr/pthreads/src/include/http_main.h Index: http_main.h === RCS file: /home/cvs/apache-apr/pthreads/src/include/http_main.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -u -r1.4 -r1.5 --- http_main.h 1999/02/24 20:30:14 1.4 +++ http_main.h 1999/04/09 04:10:35 1.5 @@ -62,6 +62,8 @@ extern C { #endif +void clean_child_exit(int code); + /* * Routines in http_main.c which other code --- in particular modules --- * may want to call. Right now, that's limited to timeout handling. 1.7 +1 -8 apache-apr/pthreads/src/include/scoreboard.h Index: scoreboard.h === RCS file: /home/cvs/apache-apr/pthreads/src/include/scoreboard.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -u -r1.6 -r1.7 --- scoreboard.h 1999/02/15 20:38:57 1.6 +++ scoreboard.h 1999/04/09 04:10:35 1.7 @@ -200,21 +200,14 @@ #elif defined(USE_POSIX_SCOREBOARD) static void cleanup_shared_mem(void *d); #else -static int force_write(int fd, void *buffer, int bufsz); -static int force_read(int fd, void *buffer, int bufsz); -static void cleanup_scoreboard_file(void *foo); void reinit_scoreboard(pool *p); #endif API_EXPORT(void) reopen_scoreboard(pool *p); -static void setup_shared_mem(pool *p); - ap_inline void ap_sync_scoreboard_image(void); -static ap_inline void put_scoreboard_info(int child_num, -thread_score *new_score_rec); -static void update_scoreboard_global(void); void increment_counts(int child_num, int thread_num, request_rec *r); +void update_scoreboard_global(void); API_EXPORT(int) find_child_by_pid(int pid); int ap_update_child_status(int child_num, int thread_num, int status, request_rec *r); void ap_time_process_request(int child_num, int thread_num, int status); 1.7 +4 -4 apache-apr/pthreads/src/main/buff.c Index: buff.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/buff.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -u -r1.6 -r1.7 --- buff.c1999/03/17 17:01:16 1.6 +++ buff.c1999/04/09 04:10:36 1.7 @@ -125,7 +125,7 @@ select() sometimes returns 1 even though the write will block. We must work around this. */ -int sendwithtimeout(int sock, const char *buf, int len, int flags, int sec) +static int sendwithtimeout(int sock, const char *buf, int len, int flags, int sec) { int iostate = 1; fd_set fdset; @@ -184,7 +184,7 @@ } -int
cvs commit: apache-apr/pthreads/src/main http_accept.c
manoj 99/04/12 16:47:27 Modified:pthreads/src/main http_accept.c Log: Ryan was right. We should only decrement requests_this_child after a connection is accepted; otherwise, we will accept too few connections (and once the child death code works properly, too few could mean zero). Revision ChangesPath 1.3 +1 -1 apache-apr/pthreads/src/main/http_accept.c Index: http_accept.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_accept.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -u -r1.2 -r1.3 --- http_accept.c 1999/04/09 04:10:37 1.2 +++ http_accept.c 1999/04/12 23:47:25 1.3 @@ -106,8 +106,8 @@ csd = -1; } else { -requests_this_child--; csd = accept(sd, sa_client, len); +requests_this_child--; SAFE_ACCEPT(accept_mutex_off(my_tid - ap_threads_per_child)); } (void) ap_update_child_status(my_pid, my_tid, SERVER_QUEUEING,
cvs commit: apache-apr/pthreads/src/main acceptlock.c
manoj 99/04/13 23:26:12 Modified:pthreads/src/main acceptlock.c Log: Make USE_PTHREAD_SERIALIZED_ACCEPT functional. A few bugs are fixed, and mmap usage is optimized (I hope). Revision ChangesPath 1.4 +48 -44apache-apr/pthreads/src/main/acceptlock.c Index: acceptlock.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/acceptlock.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -u -r1.3 -r1.4 --- acceptlock.c 1999/04/09 03:15:40 1.3 +++ acceptlock.c 1999/04/14 06:26:12 1.4 @@ -170,7 +170,7 @@ #include pthread.h -static pthread_mutex_t **accept_mutex = (void *)(caddr_t) -1; +static pthread_mutex_t *accept_mutex = (void *)(caddr_t) -1; static int *have_accept_mutex; static sigset_t accept_block_mask; static sigset_t accept_previous_mask; @@ -179,10 +179,11 @@ { int i; -for (i = 0; i ap_acceptors_per_child; i++) { -if (accept_mutex[i] != (void *)(caddr_t)-1 -have_accept_mutex[i]) { - pthread_mutex_unlock(accept_mutex[i]); +if (accept_mutex != (void *)(caddr_t)-1) { +for (i = 0; i ap_acceptors_per_child; i++) { + if (have_accept_mutex[i]) { + pthread_mutex_unlock(accept_mutex[i]); +} } } } @@ -195,13 +196,12 @@ { int i; -for (i = 0; i ap_acceptors_per_child; i++) { -if (accept_mutex[i] != (void *)(caddr_t)-1 -munmap((caddr_t) accept_mutex[i], sizeof(pthread_mutex_t))) { - perror(munmap); - } - accept_mutex[i] = (void *)(caddr_t)-1; +if (accept_mutex != (void *)(caddr_t)-1 + munmap((caddr_t) accept_mutex, + sizeof(pthread_mutex_t) * ap_acceptors_per_child)) { + perror(munmap); } +accept_mutex = (void *)(caddr_t)-1; } void accept_mutex_init(pool *p) @@ -210,56 +210,60 @@ int fd; int i; -accept_mutex = (pthread_mutex_t *)ap_palloc(p, - ap_acceptors_per_child * sizeof(pthread_mutex_t *)); have_accept_mutex = (int *)ap_palloc(p, ap_acceptors_per_child * sizeof(int)); - +fd = open(/dev/zero, O_RDWR); +if (fd == -1) { +perror(open(/dev/zero)); +exit(APEXIT_INIT); +} +accept_mutex = (pthread_mutex_t *) mmap((caddr_t) 0, + sizeof(pthread_mutex_t) * ap_acceptors_per_child, +PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); +if (accept_mutex == (void *) (caddr_t) - 1) { +perror(mmap); +exit(APEXIT_INIT); +} +close(fd); +if ((errno = pthread_mutexattr_init(mattr))) { +perror(pthread_mutexattr_init); +exit(APEXIT_INIT); +} +if ((errno = pthread_mutexattr_setpshared(mattr, + PTHREAD_PROCESS_SHARED))) { +perror(pthread_mutexattr_setpshared); +exit(APEXIT_INIT); +} for (i = 0; i ap_acceptors_per_child; i++) { -fd = open(/dev/zero, O_RDWR); - if (fd == -1) { - perror(open(/dev/zero)); - exit(APEXIT_INIT); - } - accept_mutex[i] = (pthread_mutex_t *) mmap((caddr_t) 0, -sizeof(*accept_mutex), -PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if (accept_mutex[i] == (void *) (caddr_t) - 1) { - perror(mmap); - exit(APEXIT_INIT); - } - close(fd); - if ((errno = pthread_mutexattr_init(mattr))) { - perror(pthread_mutexattr_init); - exit(APEXIT_INIT); - } - if ((errno = pthread_mutexattr_setpshared(mattr, - PTHREAD_PROCESS_SHARED))) { - perror(pthread_mutexattr_setpshared); - exit(APEXIT_INIT); - } - if ((errno = pthread_mutex_init(accept_mutex, mattr))) { + if ((errno = pthread_mutex_init(accept_mutex[i], mattr))) { perror(pthread_mutex_init); exit(APEXIT_INIT); } - sigfillset(accept_block_mask); - sigdelset(accept_block_mask, SIGHUP); - sigdelset(accept_block_mask, SIGTERM); - sigdelset(accept_block_mask, SIGWINCH); - ap_register_cleanup(p, NULL, accept_mutex_cleanup, ap_null_cleanup); } +if ((errno = pthread_mutexattr_destroy(mattr))) { +perror(pthread_mutexattr_destroy); +exit(APEXIT_INIT); +} +sigfillset(accept_block_mask); +sigdelset(accept_block_mask, SIGHUP); +sigdelset(accept_block_mask, SIGTERM); +sigdelset(accept_block_mask, SIGWINCH); +ap_register_cleanup(p, NULL, accept_mutex_cleanup, ap_null_cleanup); } void
cvs commit: apache-apr/pthreads/src/include ap_config.h
manoj 99/04/13 23:30:35 Modified:pthreads/src/include ap_config.h Log: Allow AIX versions that support cross-process pthread mutexes to use them for accept serialization. This should be applicable for apache 1.3, and since this #define is specified by POSIX, it should theoretically be applicable for all platforms. Revision ChangesPath 1.4 +5 -0 apache-apr/pthreads/src/include/ap_config.h Index: ap_config.h === RCS file: /home/cvs/apache-apr/pthreads/src/include/ap_config.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -u -r1.3 -r1.4 --- ap_config.h 1999/03/17 17:01:07 1.3 +++ ap_config.h 1999/04/14 06:30:35 1.4 @@ -272,7 +272,12 @@ #ifdef NEED_RLIM_T typedef int rlim_t; #endif +/* Some versions of AIX support cross-process pthread mutexes; some don't. */ +#if _POSIX_THREAD_PROCESS_SHARED #define USE_FCNTL_SERIALIZED_ACCEPT +#else +#define USE_PTHREAD_SERIALIZED_ACCEPT +#endif #ifdef USEBCOPY #define memmove(a,b,c) bcopy(b,a,c) #endif
cvs commit: apache-apr/pthreads/src/main http_accept.c http_main.c
manoj 99/04/14 14:38:30 Modified:pthreads/src/include http_accept.h pthreads/src/main http_accept.c http_main.c Log: Some tweaking of our http_accept modularization. A call is added to perform any initialization needed in the parent. With this, we can take all knowledge about accept serialization out of http_main.c. Also, the function names were changed as a result of this addition and to keep the difference between request and connection straight. accept_parent_init (NEW) init_accept - accept_child_init start_accepting_requests - start_accepting_connections get_request - get_connection stop_accepting_requests - stop_accepting_connections Revision ChangesPath 1.3 +5 -13 apache-apr/pthreads/src/include/http_accept.h Index: http_accept.h === RCS file: /home/cvs/apache-apr/pthreads/src/include/http_accept.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -u -r1.2 -r1.3 --- http_accept.h 1999/04/14 21:03:18 1.2 +++ http_accept.h 1999/04/14 21:38:28 1.3 @@ -79,19 +79,11 @@ #define USE_ACCEPT_QUEUE /*#define USE_MULTI_ACCEPT*/ -#if defined (USE_ACCEPT_QUEUE) -void init_accept(pool*, int, int); -void start_accepting_requests(int); -int get_request(struct sockaddr *); -void stop_accepting_requests(pool*); - -#elif defined (USE_MULTI_ACCEPT) -void init_accept(pool*,int, int); -void start_accepting_requests(int); -int get_request(struct sockaddr *); -void stop_accepting_requests(pool *); -#endif - +void accept_parent_init(pool*); +void accept_child_init(pool*, int, int); +void start_accepting_connections(int); +int get_connection(struct sockaddr *); +void stop_accepting_connections(pool*); #ifdef __cplusplus } 1.5 +17 -8 apache-apr/pthreads/src/main/http_accept.c Index: http_accept.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_accept.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -u -r1.4 -r1.5 --- http_accept.c 1999/04/14 21:03:26 1.4 +++ http_accept.c 1999/04/14 21:38:28 1.5 @@ -181,6 +181,11 @@ } } +void accept_parent_init(pool *pconf) +{ +SAFE_ACCEPT(accept_mutex_init(pconf)); +} + /* * Description: * Do any setup or initialization required before worker threads begin @@ -191,7 +196,7 @@ * 3. Pass in server_conf? * 4. Simply access the globals (yech...) */ -void init_accept(pool* pchild, +void accept_child_init(pool* pchild, int worker_threads_per_child, int acceptor_threads_per_child) { @@ -202,7 +207,7 @@ } -void start_accepting_requests(int my_child_num) +void start_accepting_connections(int my_child_num) { proc_info *my_info; pthread_t thread; @@ -275,7 +280,7 @@ accept_thread(my_info); } -int get_request(struct sockaddr *sa_client) +int get_connection(struct sockaddr *sa_client) { int csd = -1; int block_if_empty = 1; @@ -295,7 +300,7 @@ return csd; } -void stop_accepting_requests(pool* pconf) +void stop_accepting_connections(pool* pconf) { requests_this_child = 0; /* The two functions to get all of our other threads to die off. */ @@ -313,8 +318,12 @@ static int num_listenfds; static struct pollfd *listenfds; +void accept_parent_init(pool *pconf) +{ +SAFE_ACCEPT(accept_mutex_init(pconf)); +} -void init_accept(pool* pchild, +void accept_child_init(pool* pchild, int worker_threads_per_child, int acceptors_per_child) { @@ -336,10 +345,10 @@ } } -void start_accepting_requests(int my_child_num) +void start_accepting_connections(int my_child_num) { } -int get_request(struct sockaddr *sa_client) +int get_connection(struct sockaddr *sa_client) { int csd = -1; int sd; @@ -446,7 +455,7 @@ return -1; } -void stop_accepting_requests(pool* pconf) +void stop_accepting_connections(pool* pconf) { listen_rec *lr; 1.70 +5 -9 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.69 retrieving revision 1.70 diff -u -u -r1.69 -r1.70 --- http_main.c 1999/04/14 21:03:29 1.69 +++ http_main.c 1999/04/14 21:38:29 1.70 @@ -92,9 +92,6 @@ #include util_script.h /* to force util_script.c linking */ #include util_uri.h #include scoreboard.h -/* XXX - the accept_mutex_init call should be moved to http_accept.c. Until - * that... - mvsk
cvs commit: apache-apr/pthreads/src/main acceptlock.c http_accept.c http_main.c
manoj 99/04/14 15:44:58 Modified:pthreads/src/include acceptlock.h http_accept.h pthreads/src/main acceptlock.c http_accept.c http_main.c Log: Cleanup and bug fixes. This patch removes the link between ap_acceptors_per_child and the number of listen fds, to support the new poll-accept model. As a result, we don't create a bunch of accept mutexes we don't need, and there isn't a pile of phantom threads that we attempt to count and operate on. Revision ChangesPath 1.3 +7 -7 apache-apr/pthreads/src/include/acceptlock.h Index: acceptlock.h === RCS file: /home/cvs/apache-apr/pthreads/src/include/acceptlock.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -u -r1.2 -r1.3 --- acceptlock.h 1999/03/07 00:47:43 1.2 +++ acceptlock.h 1999/04/14 22:44:55 1.3 @@ -65,7 +65,7 @@ /* Prototyps for the accept mutex functions. */ #if defined (USE_USLOCK_SERIALIZED_ACCEPT) #define accept_mutex_child_init(x) -void accept_mutex_init(pool *); +void accept_mutex_init(pool *, int); void accept_mutex_on(int); void accept_mutex_off(int); @@ -73,33 +73,33 @@ void accept_mutex_child_cleanup(void *); void accept_mutex_child_init(pool *); void accept_mutex_cleanup(void *); -void accept_mutex_init(pool *); +void accept_mutex_init(pool *, int); void accept_mutex_on(int); void accept_mutex_off(int); #elif defined (USE_SYSVSEM_SERIALIZED_ACCEPT) void accept_mutex_cleanup(void *); -void accept_mutex_init(pool *); +void accept_mutex_init(pool *, int); void accept_mutex_on(int); void accept_mutex_off(int); #elif defined(USE_FCNTL_SERIALIZED_ACCEPT) #define accept_mutex_child_init(x) -void accept_mutex_init(pool *); +void accept_mutex_init(pool *, int); void accept_mutex_on(int); void accept_mutex_off(int); #elif defined(USE_FLOCK_SERIALIZED_ACCEPT) void accept_mutex_cleanup(void *); void accept_mutex_child_init(pool *); -void accept_mutex_init(pool *); +void accept_mutex_init(pool *, int); void accept_mutex_on(int); void accept_mutex_off(int); #elif defined(USE_OS2SEM_SERIALIZED_ACCEPT) void accept_mutex_cleanup(void *); void accept_mutex_child_init(pool *); -void accept_mutex_init(pool *); +void accept_mutex_init(pool *, int); void accept_mutex_on(int); void accept_mutex_off(int); @@ -109,7 +109,7 @@ * the sockets. */ #define NO_SERIALIZED_ACCEPT #define accept_mutex_child_init(x) -#define accept_mutex_init(x) +#define accept_mutex_init(x, y) #define accept_mutex_on(x) #define accept_mutex_off(x) #endif 1.4 +2 -2 apache-apr/pthreads/src/include/http_accept.h Index: http_accept.h === RCS file: /home/cvs/apache-apr/pthreads/src/include/http_accept.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -u -r1.3 -r1.4 --- http_accept.h 1999/04/14 21:38:28 1.3 +++ http_accept.h 1999/04/14 22:44:55 1.4 @@ -79,8 +79,8 @@ #define USE_ACCEPT_QUEUE /*#define USE_MULTI_ACCEPT*/ -void accept_parent_init(pool*); -void accept_child_init(pool*, int, int); +void accept_parent_init(pool*, int); +void accept_child_init(pool*, int); void start_accepting_connections(int); int get_connection(struct sockaddr *); void stop_accepting_connections(pool*); 1.5 +34 -26apache-apr/pthreads/src/main/acceptlock.c Index: acceptlock.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/acceptlock.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -u -r1.4 -r1.5 --- acceptlock.c 1999/04/14 06:26:12 1.4 +++ acceptlock.c 1999/04/14 22:44:56 1.5 @@ -79,6 +79,8 @@ #include pthread.h +/* Number of cross-process locks we're managing */ +static int lock_count; #if defined(USE_FCNTL_SERIALIZED_ACCEPT) || defined(USE_FLOCK_SERIALIZED_ACCEPT) static void init_lock_fname(pool *p) @@ -102,15 +104,16 @@ -void accept_mutex_init(pool *p) +void accept_mutex_init(pool *p, int number_of_locks) { ptrdiff_t old; usptr_t *us; int i; -uslock = (ulock_t *)ap_palloc(p, ap_acceptors_per_child * sizeof(ulock_t)); +lock_count = number_of_locks; +uslock = (ulock_t *)ap_palloc(p, lock_count * sizeof(ulock_t)); -for (i = 0; i ap_acceptors_per_child; i++) { +for (i = 0; i lock_count; i++) { /* default is 8, allocate enough for all the children plus the parent */ if ((old = usconfig(CONF_INITUSERS, HARD_SERVER_LIMIT + 1)) == -1) { perror(usconfig(CONF_INITUSERS)); @@ -180,7 +183,7 @@ int i; if (accept_mutex != (void *)(caddr_t)-1
cvs commit: apache-apr/pthreads/src/main http_main.c http_accept.c
manoj 99/04/15 13:01:43 Modified:pthreads/src/main http_main.c http_accept.c Log: Enable graceful restart and MaxRequestsPerChild for the multiaccept model, using a pipe watched by poll() to wake up the server at the child's graceful shutdown time. Revision ChangesPath 1.72 +1 -0 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.71 retrieving revision 1.72 diff -u -u -r1.71 -r1.72 --- http_main.c 1999/04/14 22:44:57 1.71 +++ http_main.c 1999/04/15 20:01:40 1.72 @@ -1762,6 +1762,7 @@ } ap_destroy_pool(ptrans); +kill(ap_scoreboard_image-parent[process_slot].pid, SIGWINCH); ap_update_child_status(process_slot, thread_slot, SERVER_DEAD, (request_rec *) NULL); return NULL; 1.7 +29 -24apache-apr/pthreads/src/main/http_accept.c Index: http_accept.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_accept.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -u -r1.6 -r1.7 --- http_accept.c 1999/04/14 22:44:57 1.6 +++ http_accept.c 1999/04/15 20:01:40 1.7 @@ -317,6 +317,7 @@ */ static listen_rec *head_listener; static struct pollfd *listenfds; +static int pipe_of_death; void accept_parent_init(pool *pconf, int listener_count) { @@ -329,15 +330,26 @@ int worker_threads_per_child) { int i; +int pipe_pair_of_death[2]; listen_rec *lr; SAFE_ACCEPT(accept_mutex_child_init(pchild)); requests_this_child = ap_max_requests_per_child; head_listener = ap_listeners; -listenfds = ap_palloc(pchild, sizeof(struct pollfd) * num_listenfds); +listenfds = ap_palloc(pchild, sizeof(struct pollfd) * (num_listenfds + 1)); -for (lr = ap_listeners, i = 0; i num_listenfds; lr = lr-next, ++i) { +if (pipe(pipe_pair_of_death) == -1) { +ap_log_error(APLOG_MARK, APLOG_ERR, + (const server_rec*) ap_get_server_conf(), + pipe: (pipe_of_death)); + clean_child_exit(1); +} +pipe_of_death = pipe_pair_of_death[0]; +listenfds[0].fd = pipe_pair_of_death[1]; +listenfds[0].events = POLLIN; +listenfds[0].revents = 0; +for (lr = ap_listeners, i = 1; i = num_listenfds; lr = lr-next, ++i) { lr-index = i; listenfds[i].fd = lr-fd; listenfds[i].events = POLLIN; /* should we add POLLPRI ?*/ @@ -368,12 +380,19 @@ if (workers_may_exit) break; -if (num_listenfds 1) { +/* XXX - Yes, we always go through the poll, at least for now. + * - mvsk + */ +if (1) { /* more than one socket */ -srv = poll(listenfds, num_listenfds, -1); +srv = poll(listenfds, num_listenfds + 1, -1); if (workers_may_exit) break; if (srv 0) { +/* XXX - h, poll can return EINTR. - mvsk */ +if (errno == EINTR) { +continue; +} SAFE_ACCEPT(accept_mutex_off(0)); /* Single Unix documents select as returning errnos * EBADF, EINTR, and EINVAL... and in none of those @@ -427,6 +446,7 @@ } csd = accept(sd, sa_client, len); +requests_this_child--; if (csd = 0) break; /* We have a socket ready for reading */ @@ -442,39 +462,24 @@ break; } } - -/* If the workers have not already been signaled to die, SIGWINCH the parent to - * kick-off the restart - */ -if (!workers_may_exit) { -index = find_child_by_pid(getpid()); -kill(ap_scoreboard_image-parent[index].pid, SIGWINCH); -} - - return -1; - } + void stop_accepting_connections(pool* pconf) { - -listen_rec *lr; int i; int index = find_child_by_pid(getpid()); +char char_of_death = '!'; parent_score *ss = ap_scoreboard_image-parent[index]; requests_this_child = 0; workers_may_exit = 1; -/* Kick threads out of poll/accept */ -lr = ap_listeners; -while (lr != NULL) { - ap_pclosesocket(pconf, lr-fd); - lr= lr-next; -} +/* Kick threads out of poll */ +(void) write(pipe_of_death, char_of_death, 1); -for (i = 0; i ss-worker_threads + ss-acceptor_threads; i
cvs commit: apache-apr/pthreads/src/main acceptlock.c
manoj 99/04/15 21:43:02 Modified:pthreads/src/main acceptlock.c Log: For pthread serialization: ifdef out an added signal mask call that isn't needed in the current server architecture, and fix up that same code so it can be turned on again if need be. Revision ChangesPath 1.6 +19 -7 apache-apr/pthreads/src/main/acceptlock.c Index: acceptlock.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/acceptlock.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -u -r1.5 -r1.6 --- acceptlock.c 1999/04/14 22:44:56 1.5 +++ acceptlock.c 1999/04/16 04:43:01 1.6 @@ -175,8 +175,13 @@ static pthread_mutex_t *accept_mutex = (void *)(caddr_t) -1; static int *have_accept_mutex; +/* The sections surrounded with this ifdef are not needed because of the + * sigwait thread. They may be turned back on, though, depending on how the + * port to nonthreaded mode goes */ +#ifdef NEED_TO_BLOCK_SIGNALS_AROUND_PTHREAD_CALLS static sigset_t accept_block_mask; -static sigset_t accept_previous_mask; +static sigset_t *accept_previous_masks = NULL; +#endif void accept_mutex_child_cleanup(void *foo) { @@ -193,6 +198,9 @@ void accept_mutex_child_init(pool *p) { ap_register_cleanup(p, NULL, accept_mutex_child_cleanup, ap_null_cleanup); +#ifdef NEED_TO_BLOCK_SIGNALS_AROUND_PTHREAD_CALLS +accept_previous_masks = ap_palloc(p, lock_count * sizeof(sigset_t)); +#endif } void accept_mutex_cleanup(void *foo) @@ -249,10 +257,12 @@ perror(pthread_mutexattr_destroy); exit(APEXIT_INIT); } +#ifdef NEED_TO_BLOCK_SIGNALS_AROUND_PTHREAD_CALLS sigfillset(accept_block_mask); sigdelset(accept_block_mask, SIGHUP); sigdelset(accept_block_mask, SIGTERM); sigdelset(accept_block_mask, SIGWINCH); +#endif ap_register_cleanup(p, NULL, accept_mutex_cleanup, ap_null_cleanup); } @@ -260,10 +270,10 @@ { int err; -/* Already blocking out all signals in worker threads. */ -#if 0 -if (sigprocmask(SIG_BLOCK, accept_block_mask, accept_previous_mask)) { - perror(sigprocmask(SIG_BLOCK)); +#ifdef NEED_TO_BLOCK_SIGNALS_AROUND_PTHREAD_CALLS +if (pthread_sigmask(SIG_BLOCK, accept_block_mask, +accept_previous_mask[locknum])) { + perror(pthread_sigmask(SIG_BLOCK)); clean_child_exit(APEXIT_CHILDFATAL); } #endif @@ -298,10 +308,12 @@ * hits. */ have_accept_mutex[locknum] = 0; -if (sigprocmask(SIG_SETMASK, accept_previous_mask, NULL)) { - perror(sigprocmask(SIG_SETMASK)); +#ifdef NEED_TO_BLOCK_SIGNALS_AROUND_PTHREAD_CALLS +if (pthread_sigmask(SIG_SETMASK, accept_previous_mask[locknum], NULL)) { + perror(pthread_sigmask(SIG_SETMASK)); clean_child_exit(1); } +#endif } #elif defined (USE_SYSVSEM_SERIALIZED_ACCEPT)
cvs commit: apache-apr/pthreads/src/main http_accept.c
manoj 99/04/16 18:58:58 Modified:pthreads/src/main http_accept.c Log: Next time I'll read the whole man page. filedes[0] is for reading, filedes[1] is for writing. Revision ChangesPath 1.8 +2 -2 apache-apr/pthreads/src/main/http_accept.c Index: http_accept.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_accept.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -u -r1.7 -r1.8 --- http_accept.c 1999/04/15 20:01:40 1.7 +++ http_accept.c 1999/04/17 01:58:58 1.8 @@ -345,8 +345,8 @@ pipe: (pipe_of_death)); clean_child_exit(1); } -pipe_of_death = pipe_pair_of_death[0]; -listenfds[0].fd = pipe_pair_of_death[1]; +pipe_of_death = pipe_pair_of_death[1]; +listenfds[0].fd = pipe_pair_of_death[0]; listenfds[0].events = POLLIN; listenfds[0].revents = 0; for (lr = ap_listeners, i = 1; i = num_listenfds; lr = lr-next, ++i) {
cvs commit: apache-apr/pthreads/src/main util.c
manoj 99/04/16 20:06:39 Modified:pthreads/src/main util.c Log: Optimize ap_gm_timestr_822, ap_make_dirstr_prefix, and ap_unescape_url. Revision ChangesPath 1.4 +60 -15apache-apr/pthreads/src/main/util.c Index: util.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/util.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -u -r1.3 -r1.4 --- util.c1999/03/17 17:01:23 1.3 +++ util.c1999/04/17 03:06:38 1.4 @@ -173,14 +173,56 @@ API_EXPORT(char *) ap_gm_timestr_822(pool *p, time_t sec) { struct tm *tms; +char *date_str = ap_palloc(p, 48 * sizeof(char)); +char *date_str_ptr = date_str; +int real_year; tms = gmtime(sec);/* ZZZ replace with AP time routine */ +/* Assumption: this is always 3 */ +/* i = strlen(ap_day_snames[tms-tm_wday]); */ +memcpy(date_str_ptr, ap_day_snames[tms-tm_wday], 3); +date_str_ptr += 3; +*date_str_ptr++ = ','; +*date_str_ptr++ = ' '; +*date_str_ptr++ = tms-tm_mday / 10 + '0'; +*date_str_ptr++ = tms-tm_mday % 10 + '0'; +*date_str_ptr++ = ' '; +/* Assumption: this is also always 3 */ +/* i = strlen(ap_month_snames[tms-tm_mon]); */ +memcpy(date_str_ptr, ap_month_snames[tms-tm_mon], 3); +date_str_ptr += 3; +*date_str_ptr++ = ' '; +real_year = 1900 + tms-tm_year; +/* This routine isn't y10k ready. */ +*date_str_ptr++ = real_year / 1000 + '0'; +*date_str_ptr++ = real_year % 1000 / 100 + '0'; +*date_str_ptr++ = real_year % 100 / 10 + '0'; +*date_str_ptr++ = real_year % 10 + '0'; +*date_str_ptr++ = ' '; +*date_str_ptr++ = tms-tm_hour / 10 + '0'; +*date_str_ptr++ = tms-tm_hour % 10 + '0'; +*date_str_ptr++ = ':'; +*date_str_ptr++ = tms-tm_min / 10 + '0'; +*date_str_ptr++ = tms-tm_min % 10 + '0'; +*date_str_ptr++ = ':'; +*date_str_ptr++ = tms-tm_sec / 10 + '0'; +*date_str_ptr++ = tms-tm_sec % 10 + '0'; +*date_str_ptr++ = ' '; +*date_str_ptr++ = 'G'; +*date_str_ptr++ = 'M'; +*date_str_ptr++ = 'T'; +*date_str_ptr = '\0'; + +return date_str; /* RFC date format; as strftime '%a, %d %b %Y %T GMT' */ + +/* The equivalent using sprintf. Use this for more legible but slower code return ap_psprintf(p, %s, %.2d %s %d %.2d:%.2d:%.2d GMT, ap_day_snames[tms-tm_wday], tms-tm_mday, ap_month_snames[tms-tm_mon], tms-tm_year + 1900, tms-tm_hour, tms-tm_min, tms-tm_sec); +*/ } /* What a pain in the ass. */ @@ -472,15 +514,11 @@ API_EXPORT(char *) ap_make_dirstr_prefix(char *d, const char *s, int n) { for (;;) { - *d = *s; - if (*d == '\0') { + if (*s == '\0' || (*s == '/' (--n) == 0)) { *d = '/'; break; } - if (*d == '/' (--n) == 0) - break; - ++d; - ++s; + *d++ = *s++; } *++d = 0; return (d); @@ -1395,27 +1433,34 @@ */ API_EXPORT(int) ap_unescape_url(char *url) { -register int x, y, badesc, badpath; +register int badesc, badpath; +char *x, *y; badesc = 0; badpath = 0; -for (x = 0, y = 0; url[y]; ++x, ++y) { - if (url[y] != '%') - url[x] = url[y]; +/* Initial scan for first '%'. Don't bother writing values before + * seeing a '%' */ +y = strchr(url, '%'); +if (y == NULL) { +return OK; +} +for (x = y; *y; ++x, ++y) { + if (*y != '%') + *x = *y; else { - if (!ap_isxdigit(url[y + 1]) || !ap_isxdigit(url[y + 2])) { + if (!ap_isxdigit(*(y + 1)) || !ap_isxdigit(*(y + 2))) { badesc = 1; - url[x] = '%'; + *x = '%'; } else { - url[x] = x2c(url[y + 1]); + *x = x2c(y + 1); y += 2; - if (url[x] == '/' || url[x] == '\0') + if (*x == '/' || *x == '\0') badpath = 1; } } } -url[x] = '\0'; +*x = '\0'; if (badesc) return BAD_REQUEST; else if (badpath)
cvs commit: apache-apr/pthreads/src/main Makefile.tmpl acceptlock.c
manoj 99/04/16 20:35:55 Modified:pthreads/src/include acceptlock.h http_accept.h pthreads/src/main Makefile.tmpl acceptlock.c Log: Add intraprocess support to the accept mutexes. This is needed by the USE_MULTI_ACCEPT model since threads within a process can compete with each other for the lock. Revision ChangesPath 1.4 +2 -1 apache-apr/pthreads/src/include/acceptlock.h Index: acceptlock.h === RCS file: /home/cvs/apache-apr/pthreads/src/include/acceptlock.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -u -r1.3 -r1.4 --- acceptlock.h 1999/04/14 22:44:55 1.3 +++ acceptlock.h 1999/04/17 03:35:53 1.4 @@ -79,12 +79,13 @@ #elif defined (USE_SYSVSEM_SERIALIZED_ACCEPT) void accept_mutex_cleanup(void *); +void accept_mutex_child_init(pool *); void accept_mutex_init(pool *, int); void accept_mutex_on(int); void accept_mutex_off(int); #elif defined(USE_FCNTL_SERIALIZED_ACCEPT) -#define accept_mutex_child_init(x) +void accept_mutex_child_init(pool *); void accept_mutex_init(pool *, int); void accept_mutex_on(int); void accept_mutex_off(int); 1.5 +4 -0 apache-apr/pthreads/src/include/http_accept.h Index: http_accept.h === RCS file: /home/cvs/apache-apr/pthreads/src/include/http_accept.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -u -r1.4 -r1.5 --- http_accept.h 1999/04/14 22:44:55 1.4 +++ http_accept.h 1999/04/17 03:35:53 1.5 @@ -85,6 +85,10 @@ int get_connection(struct sockaddr *); void stop_accepting_connections(pool*); +#ifdef USE_MULTI_ACCEPT +#define NEED_INTRAPROCESS_SERIALIZED_ACCEPT +#endif + #ifdef __cplusplus } #endif 1.8 +2 -1 apache-apr/pthreads/src/main/Makefile.tmpl Index: Makefile.tmpl === RCS file: /home/cvs/apache-apr/pthreads/src/main/Makefile.tmpl,v retrieving revision 1.7 retrieving revision 1.8 diff -u -u -r1.7 -r1.8 --- Makefile.tmpl 1999/04/07 22:52:17 1.7 +++ Makefile.tmpl 1999/04/17 03:35:54 1.8 @@ -66,7 +66,8 @@ $(INCDIR)/http_config.h $(INCDIR)/http_protocol.h \ $(INCDIR)/http_request.h $(INCDIR)/http_conf_globals.h \ $(INCDIR)/http_core.h $(INCDIR)/http_vhost.h \ - $(INCDIR)/util_script.h $(INCDIR)/fdqueue.h $(INCDIR)/acceptlock.h + $(INCDIR)/util_script.h $(INCDIR)/fdqueue.h $(INCDIR)/acceptlock.h \ + $(INCDIR)/http_accept.h alloc.o: alloc.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ 1.7 +69 -2 apache-apr/pthreads/src/main/acceptlock.c Index: acceptlock.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/acceptlock.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -u -r1.6 -r1.7 --- acceptlock.c 1999/04/16 04:43:01 1.6 +++ acceptlock.c 1999/04/17 03:35:54 1.7 @@ -68,6 +68,7 @@ #include util_uri.h #include fdqueue.h #include acceptlock.h +#include http_accept.h #include netinet/tcp.h #include stdio.h @@ -82,6 +83,56 @@ /* Number of cross-process locks we're managing */ static int lock_count; +/* Intraprocess locking used by other serialization techniques */ +#ifdef NEED_INTRAPROCESS_SERIALIZED_ACCEPT +static pthread_mutex_t *intra_mutex = NULL; + +static void intra_mutex_cleanup(void *foo) +{ +int i; + +for (i = 0; i lock_count; i++) { +(void) pthread_mutex_destroy(intra_mutex[i]); +} +} + +static void intra_mutex_init(pool *p) +{ +int i; + +intra_mutex = (pthread_mutex_t *)ap_palloc(p, lock_count * sizeof(pthread_mutex_t )); +for (i = 0; i lock_count; i++) { +if (pthread_mutex_init(intra_mutex[i], NULL) != 0) { +perror(intra_mutex_init); + clean_child_exit(APEXIT_CHILDFATAL); +} +} +ap_register_cleanup(p, NULL, intra_mutex_cleanup, ap_null_cleanup); +} + +static void intra_mutex_on(int locknum) +{ +if ((errno = pthread_mutex_lock(intra_mutex[locknum])) != 0) { +ap_log_error(APLOG_MARK, APLOG_EMERG, + (const server_rec *) ap_get_server_conf(), + Error getting intraprocess lock. Exiting!); +} +} + +static void intra_mutex_off(int locknum) +{ +if (pthread_mutex_unlock(intra_mutex[locknum]) != 0) { +ap_log_error(APLOG_MARK, APLOG_EMERG, + (const server_rec *) ap_get_server_conf(), + Error releasing intraprocess lock
cvs commit: apache-apr/pthreads/src/main http_accept.c http_main.c
manoj 99/04/16 21:25:57 Modified:pthreads/src/include http_accept.h pthreads/src/main http_accept.c http_main.c Log: An attempt to put SINGLE_LISTEN_UNSERIALIZED_ACCEPT support back in. This also moves the SAFE_ACCEPT definition from http_accept.h to http_accept.c since it isn't (and shouldn't be) used in other files anymore. Revision ChangesPath 1.6 +0 -2 apache-apr/pthreads/src/include/http_accept.h Index: http_accept.h === RCS file: /home/cvs/apache-apr/pthreads/src/include/http_accept.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -u -r1.5 -r1.6 --- http_accept.h 1999/04/17 03:35:53 1.5 +++ http_accept.h 1999/04/17 04:25:55 1.6 @@ -65,8 +65,6 @@ #include httpd.h #include ap_config.h -#define SAFE_ACCEPT(stmt) do {stmt;} while(0) - /* The info each server thread needs to start correctly. */ typedef struct { 1.9 +16 -0 apache-apr/pthreads/src/main/http_accept.c Index: http_accept.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_accept.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -u -r1.8 -r1.9 --- http_accept.c 1999/04/17 01:58:58 1.8 +++ http_accept.c 1999/04/17 04:25:56 1.9 @@ -72,6 +72,15 @@ static int num_listenfds; #if defined (USE_ACCEPT_QUEUE) + +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT +/* Each thread only listens to one socket in this model, so the starvation + * problem described in manual/misc/perf-tuning.html can't occur here */ +#define SAFE_ACCEPT(stmt) +#else +#define SAFE_ACCEPT(stmt) do {stmt;} while(0) +#endif + /* The queue of sockets we've accepted */ static FDQueue csd_queue; @@ -311,6 +320,13 @@ } #elif defined(USE_MULTI_ACCEPT) + +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT +#define SAFE_ACCEPT(stmt) do {if(ap_listeners-next != NULL) {stmt;}} while(0) +#else +#define SAFE_ACCEPT(stmt) do {stmt;} while(0) +#endif + /* * USE_MULTI_ACCEPT * Worker threads do the accept and process the request. 1.73 +0 -7 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.72 retrieving revision 1.73 diff -u -u -r1.72 -r1.73 --- http_main.c 1999/04/15 20:01:40 1.72 +++ http_main.c 1999/04/17 04:25:56 1.73 @@ -416,13 +416,6 @@ } } -/* On some architectures it's safe to do unserialized accept()s in the single - * Listen case. But it's never safe to do it in the case where there's - * multiple Listen statements. Define SINGLE_LISTEN_UNSERIALIZED_ACCEPT - * when it's safe in the single Listen case. We haven't defined this yet - * for the hybrid server. ZZZ - */ - static void usage(char *bin) { char pad[MAX_STRING_LEN];
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/04/16 22:10:19 Modified:pthreads/src/main http_main.c Log: Note in the scoreboard when a child process dies abnormally, so that a substitute can be started. Revision ChangesPath 1.74 +3 -3 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.73 retrieving revision 1.74 diff -u -u -r1.73 -r1.74 --- http_main.c 1999/04/17 04:25:56 1.73 +++ http_main.c 1999/04/17 05:10:18 1.74 @@ -2227,6 +2227,7 @@ int child_slot; ap_wait_t status; int pid; +int i; while (!restart_pending !shutdown_pending) { pid = wait_or_timeout(status); @@ -2234,9 +2235,8 @@ if (pid = 0) { child_slot = find_child_by_pid(pid); if (child_slot = 0) { -/*(void) ap_update_child_status(child_slot, SERVER_DEAD, - (request_rec *) NULL); - LOOK INTO THIS */ +for (i = 0; i ap_threads_per_child + ap_acceptors_per_child; i++) +ap_update_child_status(child_slot, i, SERVER_DEAD, (request_rec *) NULL); if (remaining_children_to_start child_slot ap_daemons_limit) {
cvs commit: apache-apr STATUS
manoj 99/04/18 21:49:16 Modified:.STATUS Log: I like playing Alpha Centauri. Revision ChangesPath 1.20 +7 -1 apache-apr/STATUS Index: STATUS === RCS file: /home/cvs/apache-apr/STATUS,v retrieving revision 1.19 retrieving revision 1.20 diff -u -u -r1.19 -r1.20 --- STATUS1999/04/09 02:31:21 1.19 +++ STATUS1999/04/19 04:49:15 1.20 @@ -1,5 +1,5 @@ Apache Portable Runtime STATUS: -Last modified at [$Date: 1999/04/09 02:31:21 $] +Last modified at [$Date: 1999/04/19 04:49:15 $] Release: @@ -50,6 +50,12 @@ to the parent process rapidly (but not SIGWINCHes). The suspicion is that this is either an error in how pthread calls are used in the server, or a libc bug (the last refuge of a desperate programer). + +When the server runs at a high load, and the load later drops off, +the server tries to kill off some children. The problem is that the +children selected may have threads blocked on the accept lock, so +they will never exit. This wasn't a problem with 1.3, because each +process got kicked out of the lock with a signal. Open issues:
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/04/19 18:31:04 Modified:pthreads/src/main http_main.c Log: Bug fix for scoreboard handling. Before, if only a single child thread was dead, we assumed that the whole child was dead and reused its slot, even if there are other threads still running in that process slot. Now, we actually check two conditions: any_dying_threads and all_dead_threads. If any_dying_threads, we make sure not to count this as a non-dead process that can be told to die. If all_dead_threads, we can reuse the process slot. Revision ChangesPath 1.75 +38 -29apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.74 retrieving revision 1.75 diff -u -u -r1.74 -r1.75 --- http_main.c 1999/04/17 05:10:18 1.74 +++ http_main.c 1999/04/20 01:31:03 1.75 @@ -1934,6 +1934,7 @@ sigset_t sig_mask; int signal_received; pthread_t thread; +int j; my_pid = getpid(); @@ -1982,6 +1983,13 @@ switch (signal_received) { case SIGWINCH: graceful_sig_handler(SIGWINCH); + for (j = 0; j ap_threads_per_child + ap_acceptors_per_child; + j++) { +/* Useful for debugging */ +if (ap_scoreboard_image-servers[child_num_arg][j].status != SERVER_DEAD) { +ap_scoreboard_image-servers[child_num_arg][j].status = SERVER_GRACEFUL; +} + } graceful_killer(); clean_child_exit(0); break; @@ -2121,47 +2129,48 @@ /* Initialization to satisfy the compiler. It doesn't know * that ap_threads_per_child is always 0 */ int status = SERVER_DEAD; - idle_thread_count = 0; + int any_dying_threads = 0; + int all_dead_threads = 1; + idle_thread_count = 0; if (i = max_daemons_limit free_length == idle_spawn_rate) break; for (j = 0; j ap_threads_per_child; j++) { ss = ap_scoreboard_image-servers[i][j]; status = ss-status; - if (status == SERVER_DEAD) { - /* try to keep children numbers as low as possible */ - if (free_length idle_spawn_rate) { - free_slots[free_length] = i; - ++free_length; - /* We are killing this process, let's leave the loop */ - break; - } - } - else { - /* We consider a starting server as idle because we started it - * at least a cycle ago, and if it still hasn't finished starting - * then we're just going to swamp things worse by forking more. - * So we hopefully won't need to fork more if we count it. - * This depends on the ordering of SERVER_READY and SERVER_STARTING. + + any_dying_threads = any_dying_threads || (status == SERVER_DEAD) +|| (status == SERVER_GRACEFUL); + all_dead_threads = all_dead_threads (status == SERVER_DEAD); + + /* We consider a starting server as idle because we started it + * at least a cycle ago, and if it still hasn't finished starting + * then we're just going to swamp things worse by forking more. + * So we hopefully won't need to fork more if we count it. + * This depends on the ordering of SERVER_READY and SERVER_STARTING. + */ + if (status = SERVER_READY) { + ++ idle_thread_count; + /* always kill the highest numbered child if we have to... + * no really well thought out reason ... other than observing + * the server behaviour under linux where lower numbered children + * tend to service more hits (and hence are more likely to have + * their data in cpu caches). */ - if (status = SERVER_READY) { - ++ idle_thread_count; - /* always kill the highest numbered child if we have to... - * no really well thought out reason ... other than observing - * the server behaviour under linux where lower numbered children - * tend to service more hits (and hence are more likely to have - * their data in cpu caches). - */ - } } } - if (idle_thread_count ap_idle_thread_threshold) { - idle_count++; - to_kill = i; + if (all_dead_threads free_length idle_spawn_rate) { + free_slots[free_length] = i; + ++free_length; } -if (status != SERVER_DEAD
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/04/19 18:43:05 Modified:pthreads/src/main http_main.c Log: Fix comment wrapping. Revision ChangesPath 1.76 +5 -5 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.75 retrieving revision 1.76 diff -u -u -r1.75 -r1.76 --- http_main.c 1999/04/20 01:31:03 1.75 +++ http_main.c 1999/04/20 01:43:04 1.76 @@ -2151,11 +2151,11 @@ */ if (status = SERVER_READY) { ++ idle_thread_count; - /* always kill the highest numbered child if we have to... - * no really well thought out reason ... other than observing - * the server behaviour under linux where lower numbered children - * tend to service more hits (and hence are more likely to have - * their data in cpu caches). +/* always kill the highest numbered child if we have to... + * no really well thought out reason ... other than observing + * the server behaviour under linux where lower numbered + * children tend to service more hits (and hence are more + * likely to have their data in cpu caches). */ } }
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/04/21 21:14:41 Modified:pthreads/src/main http_main.c Log: We were setting max_daemons_limit based on the last fully living children. Instead, we should set it based on the last non-dead child. Revision ChangesPath 1.77 +3 -1 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.76 retrieving revision 1.77 diff -u -u -r1.76 -r1.77 --- http_main.c 1999/04/20 01:43:04 1.76 +++ http_main.c 1999/04/22 04:14:40 1.77 @@ -2163,6 +2163,9 @@ free_slots[free_length] = i; ++free_length; } + if (!all_dead_threads) { + max_daemons_limit = i + 1; + } if (!any_dying_threads) { ++total_non_dead; last_non_dead = i; @@ -2173,7 +2176,6 @@ } } } -max_daemons_limit = last_non_dead + 1; if (idle_count ap_daemons_max_free) { /* kill off one child... we use SIGWINCH because that'll cause it to * shut down gracefully, in case it happened to pick up a request
cvs commit: apache-apr/pthreads/src/modules/standard mod_info.c
manoj 99/04/21 22:13:42 Modified:pthreads/src/modules/standard mod_info.c Log: Remove ap_excess_requests_per_child reference that broke compilation, for now anyway. Revision ChangesPath 1.6 +0 -3 apache-apr/pthreads/src/modules/standard/mod_info.c Index: mod_info.c === RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/mod_info.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -u -r1.5 -r1.6 --- mod_info.c1999/04/09 02:31:24 1.5 +++ mod_info.c1999/04/22 05:13:41 1.6 @@ -432,9 +432,6 @@ ap_rprintf(r, strongThreads:/strong ttper child: %d nbsp;nbsp; /ttbr\n, ap_threads_per_child); -ap_rprintf(r, strongExcess requests:/strong -ttper child: %d nbsp;nbsp; /ttbr\n, -ap_excess_requests_per_child); ap_rprintf(r, strongTimeouts:/strong ttconnection: %d nbsp;nbsp; keep-alive: %d/ttbr,
cvs commit: apache-apr/pthreads/src/main http_accept.c
manoj 99/04/21 22:46:54 Modified:pthreads/src/main http_accept.c Log: Delete unused variable to eliminate a warning. Revision ChangesPath 1.10 +0 -1 apache-apr/pthreads/src/main/http_accept.c Index: http_accept.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_accept.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -u -r1.9 -r1.10 --- http_accept.c 1999/04/17 04:25:56 1.9 +++ http_accept.c 1999/04/22 05:46:53 1.10 @@ -382,7 +382,6 @@ int sd; int srv; listen_rec *lr; -int index; size_t len = sizeof(struct sockaddr);
cvs commit: apache-apr STATUS
manoj 99/04/22 00:02:52 Modified:.STATUS Log: saladfork.com is taken. Oh well. Revision ChangesPath 1.21 +14 -2 apache-apr/STATUS Index: STATUS === RCS file: /home/cvs/apache-apr/STATUS,v retrieving revision 1.20 retrieving revision 1.21 diff -u -u -r1.20 -r1.21 --- STATUS1999/04/19 04:49:15 1.20 +++ STATUS1999/04/22 07:02:52 1.21 @@ -1,5 +1,5 @@ Apache Portable Runtime STATUS: -Last modified at [$Date: 1999/04/19 04:49:15 $] +Last modified at [$Date: 1999/04/22 07:02:52 $] Release: @@ -55,7 +55,19 @@ the server tries to kill off some children. The problem is that the children selected may have threads blocked on the accept lock, so they will never exit. This wasn't a problem with 1.3, because each -process got kicked out of the lock with a signal. +process got kicked out of the lock with a signal. This could be solved +(Thanks, Dean) with a server-wide pipe that replaces the SIGWINCH signal. +This would wake up every thread when a single child death signal is sent +over the pipe. + +Related to the above: On Red Hat 5.2, when we SIGTERM the server and +the server is in this state, the children waiting on fcntl will not +die, even though nobody else is holding the lock, verified with lsof. +The children eventually will be SIGKILLed by the parent. This only +happens in USE_MULTI_ACCEPT mode, and the problem goes away when +USE_INTRAPROCESS_SERIALIZED_ACCEPT is undefined. Dean has a couple of +suggestions for tracing down this problem in +[EMAIL PROTECTED] Open issues:
cvs commit: apache-apr/pthreads/src/main acceptlock.c
manoj 99/04/22 12:09:02 Modified:pthreads/src/main acceptlock.c Log: Go back to old behavior of retrying flock and fcntl when EINTR is received. Our worker and acceptor threads don't receive signals anyway, and the old code would make us retry fcntl if we got any error besides EINTR. Revision ChangesPath 1.8 +7 -7 apache-apr/pthreads/src/main/acceptlock.c Index: acceptlock.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/acceptlock.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -u -r1.7 -r1.8 --- acceptlock.c 1999/04/17 03:35:54 1.7 +++ acceptlock.c 1999/04/22 19:09:01 1.8 @@ -530,11 +530,11 @@ intra_mutex_on(locknum); while ((ret = fcntl(lock_fd[locknum], F_SETLKW, lock_it)) 0 -errno != EINTR) { +errno == EINTR) { /* nop */ } -if (ret 0 errno != EINTR) { +if (ret 0) { ap_log_error(APLOG_MARK, APLOG_EMERG, (const server_rec*) ap_get_server_conf(), fcntl: F_SETLKW: Error getting accept lock, exiting! Perhaps you need to use the LockFile directive to place @@ -548,10 +548,10 @@ int ret; while ((ret = fcntl(lock_fd[locknum], F_SETLKW, unlock_it)) 0 - errno != EINTR) { + errno == EINTR) { /* nop */ } -if (ret 0 errno != EINTR) { +if (ret 0) { ap_log_error(APLOG_MARK, APLOG_EMERG, (const server_rec*) ap_get_server_conf(), fcntl: F_SETLKW: Error freeing accept lock, exiting! Perhaps you need to use the LockFile directive to place @@ -630,10 +630,10 @@ int ret; intra_mutex_on(locknum); -while ((ret = flock(lock_fd[locknum], LOCK_EX)) 0 errno != EINTR) +while ((ret = flock(lock_fd[locknum], LOCK_EX)) 0 errno == EINTR) continue; -if (ret 0 errno != EINTR) { +if (ret 0) { ap_log_error(APLOG_MARK, APLOG_EMERG, (const server_rec *) ap_get_server_conf(), flock: LOCK_EX: Error getting accept lock. Exiting!); @@ -643,7 +643,7 @@ void accept_mutex_off(int locknum) { -if (flock(lock_fd[locknum], LOCK_UN) 0 errno != EINTR) { +if (flock(lock_fd[locknum], LOCK_UN) 0) { ap_log_error(APLOG_MARK, APLOG_EMERG, (const server_rec *) ap_get_server_conf(), flock: LOCK_UN: Error freeing accept lock. Exiting!);
cvs commit: apache-1.3/src/os/tpf cgetop.c Makefile.tmpl os.c os.h
manoj 99/04/27 13:36:39 Modified:htdocs/manual install-tpf.html readme-tpf.html src CHANGES src/ap ap_md5c.c src/include ap_config.h scoreboard.h src/main alloc.c buff.c http_log.c http_main.c http_protocol.c src/modules/proxy proxy_connect.c src/modules/standard mod_cgi.c mod_include.c src/os/tpf Makefile.tmpl os.c os.h Added: src/os/tpf cgetop.c Log: Submitted by: Joe Moenich [EMAIL PROTECTED] Reviewed by: Dean Gaudet, Martin Kraemer, Manoj Kasichainula Add support for standalone mode in TPF Revision ChangesPath 1.6 +3 -5 apache-1.3/htdocs/manual/install-tpf.html Index: install-tpf.html === RCS file: /home/cvs/apache-1.3/htdocs/manual/install-tpf.html,v retrieving revision 1.5 retrieving revision 1.6 diff -u -u -r1.5 -r1.6 --- install-tpf.html 1999/01/08 23:24:46 1.5 +++ install-tpf.html 1999/04/27 20:36:24 1.6 @@ -53,8 +53,6 @@ If you are using a product such as WinZip on your PC, verify that the EMTAR File Smart CR/LF Conversion/EM option is NOT checked. You can find this in WinZip under Options, Configuration. -Since you had to tar and unzip the file to read this document, -you need to re-tar and -unzip if the CR/LF option was checked. This will save you lots of headaches later on. /P P @@ -212,8 +210,7 @@ Apache requires a configuration file to initialize itself during activation. (Previously three configuration files were used.) Copy the distribution version, /conf/httpd.conf-dist, to /conf/httpd.conf and then - edit the /conf/httpd.conf copy with your site specific information. This first release - of Apache for TPF only runs under the inetd model so you + edit the /conf/httpd.conf copy with your site specific information. If your system is pre-PUT09 you font color=redSTRONGmust/STRONG/FONT change TTServerType/TT from TTstandalone/TT to TTinetd/TT. BRBR @@ -226,7 +223,8 @@ BRBR PRE ZINET ADD S-TFTP PGM-CTFT PORT-69 PROTOCOL-UDP MODEL-NOWAIT -ZINET ADD S-APACHE PGM-EM/EM PORT-80 PROTOCOL-TCP MODEL-NOWAIT/PRE +ZINET ADD S-APACHE PGM-EM/EM PROTOCOL-TCP MODEL-NOWAIT PORT-80 (if inetd mode) +ZINET ADD S-APACHE PGM-EM/EM PROTOCOL-TCP MODEL-NOLISTEN (if standalone mode)/PRE Please refer to EMIBM Transaction Processing Facility Transmission Control Protocol/Internet Protocol Version 4 Release 1/EM for more information on ZCLAW, INETD, and TFTP. 1.5 +31 -32apache-1.3/htdocs/manual/readme-tpf.html Index: readme-tpf.html === RCS file: /home/cvs/apache-1.3/htdocs/manual/readme-tpf.html,v retrieving revision 1.4 retrieving revision 1.5 diff -u -u -r1.4 -r1.5 --- readme-tpf.html 1999/01/08 23:13:27 1.4 +++ readme-tpf.html 1999/04/27 20:36:25 1.5 @@ -8,7 +8,6 @@ H1 align=centerOverview of the Apache TPF Port/H1 HR CENTER[nbsp;A HREF=#configuration_filesConfiguration Files/A - nbsp;|nbsp;A HREF=#auto_generated_filesAuto Generated Files/A nbsp;|nbsp;A HREF=#whats_availableWhat's Available/A nbsp;|nbsp;A HREF=#porting_notesPorting Notes/Anbsp;] /CENTER @@ -41,8 +40,7 @@ work on TPF with only a couple of operating system specific changes to httpd.conf:BR UL - LIServerType needs to be inetd since TPF does not yet support - standalone mode. + LIServerType needs to be inetd on pre-PUT09 systems. LIPerformance considerations may dictate setting KeepAlive to Off (the default is On) or lowering the Timeout value from the default 300 seconds (5 minutes) in order to reduce the number of active ECBs on your system. @@ -68,64 +66,75 @@ LIbuff.c LIbuildmark.c LIebcdic.c + LIgen_test.char.c + LIgen_uri_delims.c LIhttp_config.c LIhttp_core.c LIhttp_log.c - LIhttp_main.c + LIhttp_main.c A HREF=#note_1 ismall(see note 1)/small/i/A LIhttp_protocol.c LIhttp_request.c - LIhttp_vhost.c A HREF=#note_2*/A - LImod_access.c + LIhttp_vhost.c ismall(requires PUT9)/small/i + LIlogresolve.c ismall(requires PUT10)/small/i + LImod_access.c A HREF=#note_2 ismall(see note 2)/small/i/A + LImod_actions.c LImod_alias.c LImod_asis.c + LImod_auth_anon.c LImod_autoindex.c LImod_cern_meta.c + LImod_cgi.c ismall(requires PUT10)/small/i LImod_dir.c + LImod_env.c LImod_example.c LImod_expires.c LImod_headers.c LImod_imap.c + LImod_include.c A HREF=#note_3 ismall(see note 3)/small/i/A LImod_info.c LImod_log_agent.c LImod_log_config.c
cvs commit: apache-apr/pthreads/src/main http_accept.c http_main.c
manoj 99/04/29 12:34:23 Modified:.STATUS pthreads/src/main http_accept.c http_main.c Log: Get rid of thread_starter_thread, and just start all of our worker threads from child_main. This makes the code simpler, and eliminates any race conditions involving trying to shutdown a child process while still starting threads. Revision ChangesPath 1.23 +1 -9 apache-apr/STATUS Index: STATUS === RCS file: /home/cvs/apache-apr/STATUS,v retrieving revision 1.22 retrieving revision 1.23 diff -u -u -r1.22 -r1.23 --- STATUS1999/04/27 06:23:04 1.22 +++ STATUS1999/04/29 19:34:19 1.23 @@ -1,5 +1,5 @@ Apache Portable Runtime STATUS: -Last modified at [$Date: 1999/04/27 06:23:04 $] +Last modified at [$Date: 1999/04/29 19:34:19 $] Release: @@ -42,14 +42,6 @@ Everything Needs patch: - -On Red Hat 5.2, with a very low MaxRequestsPerChild (e.g. 10), when the -server is banged on with ApacheBench, occasionally, the main thread of a -process hangs around in pthread_exit_process. The size of that process is -always around 11M. This bug is also exhibited by sending lots of SIGHUPs -to the parent process rapidly (but not SIGWINCHes). The suspicion is that -this is either an error in how pthread calls are used in the server, or a -libc bug (the last refuge of a desperate programer). When the server runs at a high load, and the load later drops off, the server tries to kill off some children. The problem is that the 1.11 +1 -12 apache-apr/pthreads/src/main/http_accept.c Index: http_accept.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_accept.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -u -r1.10 -r1.11 --- http_accept.c 1999/04/22 05:46:53 1.10 +++ http_accept.c 1999/04/29 19:34:20 1.11 @@ -245,7 +245,7 @@ */ int i = ap_threads_per_child; if (lr) { -while (lr-next != NULL) { +while (lr != NULL) { (void) ap_update_child_status(my_child_num, i, SERVER_STARTING, (request_rec *) NULL); @@ -277,17 +277,6 @@ /* no listening sockets Kill the server please. */ exit(0); } -(void) ap_update_child_status(my_child_num, i, SERVER_STARTING, - (request_rec *) NULL); - -my_info = NULL; - -my_info = (proc_info *) malloc(sizeof(proc_info)); -my_info-pid = my_child_num; -my_info-tid = i; -my_info-sd = lr-fd; - -accept_thread(my_info); } int get_connection(struct sockaddr *sa_client) 1.78 +31 -52apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.77 retrieving revision 1.78 diff -u -u -r1.77 -r1.78 --- http_main.c 1999/04/22 04:14:40 1.77 +++ http_main.c 1999/04/29 19:34:21 1.78 @@ -1884,61 +1884,16 @@ #endif /* ndef WIN32 */ } -static void *thread_starter_thread(void *thread_arg) { -int i; -pthread_t thread; -int my_child_num = *((int *) thread_arg); -proc_info *my_info = NULL; - -/* Setup worker threads */ -for (i=0; i ap_threads_per_child; i++) { - -my_info = NULL; - - my_info = (proc_info *)malloc(sizeof(proc_info)); - my_info-pid = my_child_num; -my_info-tid = i; - my_info-sd = 0; - - /* We are creating threads right now */ - (void) ap_update_child_status(my_child_num, i, SERVER_STARTING, - (request_rec *) NULL); - if (pthread_create(thread, NULL, worker_thread, my_info)) { - ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf, - pthread_create: unable to create worker thread); - /* - * We failed to create a thread. Update the scoreboard, - * or it will say SERVER_STARTING forever. - */ - (void) ap_update_child_status(my_child_num, i, SERVER_DEAD, - (request_rec *) NULL); - exit(1); /* We won't always exit here, but for no this is okay */ - } - - /* We let each thread update it's own scoreboard entry. This is done - * because it let's us deal with tid better. - */ -} - - -/* Begin accepting requests - * Design: - * - */ -start_accepting_connections(my_child_num); -return NULL; -} - static void child_main(int
cvs commit: apache-apr/pthreads/src/main buff.c
manoj 99/05/06 23:57:50 Modified:pthreads/src/main buff.c Log: typo Revision ChangesPath 1.8 +1 -1 apache-apr/pthreads/src/main/buff.c Index: buff.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/buff.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -u -r1.7 -r1.8 --- buff.c1999/04/09 04:10:36 1.7 +++ buff.c1999/05/07 06:57:50 1.8 @@ -623,7 +623,7 @@ #elif defined(O_NDELAY) fd_flags |= O_NDELAY; return fcntl(fd, F_SETFL, fd_flags); -#eli f defined(FNDELAY) +#elif defined(FNDELAY) fd_flags |= O_FNDELAY; return fcntl(fd, F_SETFL, fd_flags); #else
cvs commit: apache-apr/pthreads/src/main acceptlock.c http_accept.c
manoj 99/05/09 01:39:32 Modified:pthreads/src/include acceptlock.h pthreads/src/main acceptlock.c http_accept.c Log: Partial solution for the graceful restart during accept locking problem. Make sure that each thread checks the shutdown flag before attempting to get the cross-process accept lock, so that if one thread notices that it's time to die, the rest will soon after. Revision ChangesPath 1.5 +7 -2 apache-apr/pthreads/src/include/acceptlock.h Index: acceptlock.h === RCS file: /home/cvs/apache-apr/pthreads/src/include/acceptlock.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -u -r1.4 -r1.5 --- acceptlock.h 1999/04/17 03:35:53 1.4 +++ acceptlock.h 1999/05/09 08:39:29 1.5 @@ -62,6 +62,11 @@ extern C { #endif +/* Prototypes for the intraprocess accept mutex functions */ +void intra_mutex_init(pool *p, int); +void intra_mutex_on(int); +void intra_mutex_off(int); + /* Prototyps for the accept mutex functions. */ #if defined (USE_USLOCK_SERIALIZED_ACCEPT) #define accept_mutex_child_init(x) @@ -79,13 +84,13 @@ #elif defined (USE_SYSVSEM_SERIALIZED_ACCEPT) void accept_mutex_cleanup(void *); -void accept_mutex_child_init(pool *); +#define accept_mutex_child_init(x) void accept_mutex_init(pool *, int); void accept_mutex_on(int); void accept_mutex_off(int); #elif defined(USE_FCNTL_SERIALIZED_ACCEPT) -void accept_mutex_child_init(pool *); +#define accept_mutex_child_init(x) void accept_mutex_init(pool *, int); void accept_mutex_on(int); void accept_mutex_off(int); 1.9 +10 -29apache-apr/pthreads/src/main/acceptlock.c Index: acceptlock.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/acceptlock.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -u -r1.8 -r1.9 --- acceptlock.c 1999/04/22 19:09:01 1.8 +++ acceptlock.c 1999/05/09 08:39:30 1.9 @@ -83,25 +83,28 @@ /* Number of cross-process locks we're managing */ static int lock_count; +/* Number of intra-process locks we're managing */ +static int intra_lock_count; + /* Intraprocess locking used by other serialization techniques */ -#ifdef NEED_INTRAPROCESS_SERIALIZED_ACCEPT static pthread_mutex_t *intra_mutex = NULL; static void intra_mutex_cleanup(void *foo) { int i; -for (i = 0; i lock_count; i++) { +for (i = 0; i intra_lock_count; i++) { (void) pthread_mutex_destroy(intra_mutex[i]); } } -static void intra_mutex_init(pool *p) +void intra_mutex_init(pool *p, int number_of_locks) { int i; -intra_mutex = (pthread_mutex_t *)ap_palloc(p, lock_count * sizeof(pthread_mutex_t )); -for (i = 0; i lock_count; i++) { +intra_lock_count = number_of_locks; +intra_mutex = (pthread_mutex_t *)ap_palloc(p, intra_lock_count * sizeof(pthread_mutex_t )); +for (i = 0; i intra_lock_count; i++) { if (pthread_mutex_init(intra_mutex[i], NULL) != 0) { perror(intra_mutex_init); clean_child_exit(APEXIT_CHILDFATAL); @@ -110,7 +113,7 @@ ap_register_cleanup(p, NULL, intra_mutex_cleanup, ap_null_cleanup); } -static void intra_mutex_on(int locknum) +void intra_mutex_on(int locknum) { if ((errno = pthread_mutex_lock(intra_mutex[locknum])) != 0) { ap_log_error(APLOG_MARK, APLOG_EMERG, @@ -119,7 +122,7 @@ } } -static void intra_mutex_off(int locknum) +void intra_mutex_off(int locknum) { if (pthread_mutex_unlock(intra_mutex[locknum]) != 0) { ap_log_error(APLOG_MARK, APLOG_EMERG, @@ -127,11 +130,6 @@ Error releasing intraprocess lock. Exiting!); } } -#else /* NEED_INTRAPROCESS_SERIALIZED_ACCEPT */ -#define intra_mutex_init(x) -#define intra_mutex_on(x) -#define intra_mutex_off(x) -#endif /* NEED_INTRAPROCESS_SERIALIZED_ACCEPT */ #if defined(USE_FCNTL_SERIALIZED_ACCEPT) || defined(USE_FLOCK_SERIALIZED_ACCEPT) static void init_lock_fname(pool *p) @@ -454,14 +452,8 @@ } } -void accept_mutex_child_init(pool *p) -{ -intra_mutex_init(p); -} - void accept_mutex_on(int locknum) { -intra_mutex_on(locknum); if (semop(sem_id[locknum], op_on, 1) 0) { perror(accept_mutex_on); clean_child_exit(APEXIT_CHILDFATAL); @@ -474,7 +466,6 @@ perror(accept_mutex_off); clean_child_exit(APEXIT_CHILDFATAL); } -intra_mutex_off(locknum); } #elif defined(USE_FCNTL_SERIALIZED_ACCEPT) @@ -519,16 +510,10 @@ } } -void accept_mutex_child_init(pool *p) -{ -intra_mutex_init(p); -} - void accept_mutex_on(int
cvs commit: apache-apr/pthreads/src/include http_accept.h
manoj 99/05/09 01:46:27 Modified:pthreads/src/include http_accept.h Log: Make the poll-accept model the default. Revision ChangesPath 1.8 +2 -2 apache-apr/pthreads/src/include/http_accept.h Index: http_accept.h === RCS file: /home/cvs/apache-apr/pthreads/src/include/http_accept.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -u -r1.7 -r1.8 --- http_accept.h 1999/04/29 20:09:42 1.7 +++ http_accept.h 1999/05/09 08:46:27 1.8 @@ -75,8 +75,8 @@ } proc_info; /* Select the accept technique. Move this to ap_config eventually... */ -#define USE_ACCEPT_QUEUE -/*#define USE_MULTI_ACCEPT*/ +/*#define USE_ACCEPT_QUEUE*/ +#define USE_MULTI_ACCEPT void accept_parent_init(pool*, int); void accept_child_init(pool*, int);
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/05/19 21:33:33 Modified:pthreads/src/main http_main.c Log: Bug fix. Make sure that perform_idle_server_maintanence runs through whole scoreboard. Revision ChangesPath 1.80 +2 -2 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.79 retrieving revision 1.80 diff -u -u -r1.79 -r1.80 --- http_main.c 1999/04/29 20:09:44 1.79 +++ http_main.c 1999/05/20 04:33:32 1.80 @@ -2145,11 +2145,10 @@ ++free_length; } if (!all_dead_threads) { - max_daemons_limit = i + 1; +last_non_dead = i; } if (!any_dying_threads) { ++total_non_dead; -last_non_dead = i; if (idle_thread_count ap_idle_thread_threshold) { idle_count++; @@ -2157,6 +2156,7 @@ } } } +max_daemons_limit = last_non_dead + 1; if (idle_count ap_daemons_max_free) { /* kill off one child... we use SIGWINCH because that'll cause it to * shut down gracefully, in case it happened to pick up a request
cvs commit: apache-apr/pthreads/src/main http_accept.c
manoj 99/05/19 21:48:40 Modified:pthreads/src/include acceptlock.h pthreads/src/main http_accept.c Log: Minor cleanup. Revision ChangesPath 1.6 +0 -3 apache-apr/pthreads/src/include/acceptlock.h Index: acceptlock.h === RCS file: /home/cvs/apache-apr/pthreads/src/include/acceptlock.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -u -r1.5 -r1.6 --- acceptlock.h 1999/05/09 08:39:29 1.5 +++ acceptlock.h 1999/05/20 04:48:39 1.6 @@ -121,9 +121,6 @@ #endif #endif -/* Prototypes for functions required for accept_mutex */ -void clean_child_exit(int); - #ifdef __cplusplus } #endif 1.13 +1 -0 apache-apr/pthreads/src/main/http_accept.c Index: http_accept.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_accept.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -u -r1.12 -r1.13 --- http_accept.c 1999/05/09 08:39:31 1.12 +++ http_accept.c 1999/05/20 04:48:39 1.13 @@ -57,6 +57,7 @@ #include httpd.h #include http_log.h +#include http_main.h #include http_conf_globals.h #include acceptlock.h #include fdqueue.h
cvs commit: apache-apr/pthreads/src/main http_accept.c
manoj 99/05/19 22:00:42 Modified:pthreads/src/main http_accept.c Log: Another cleanup. Get rid of an if (1) that was left around to make a different patch look small. Revision ChangesPath 1.14 +49 -60apache-apr/pthreads/src/main/http_accept.c Index: http_accept.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_accept.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -u -r1.13 -r1.14 --- http_accept.c 1999/05/20 04:48:39 1.13 +++ http_accept.c 1999/05/20 05:00:41 1.14 @@ -399,72 +399,61 @@ if (workers_may_exit) break; -/* XXX - Yes, we always go through the poll, at least for now. - * - mvsk - */ -if (1) { -/* more than one socket */ -srv = poll(listenfds, num_listenfds + 1, -1); -if (workers_may_exit) -break; -if (srv 0) { -/* XXX - h, poll can return EINTR. - mvsk */ -if (errno == EINTR) { -continue; -} -SAFE_ACCEPT(accept_mutex_off(0)); -SAFE_ACCEPT(intra_mutex_off(0)); -/* Single Unix documents select as returning errnos - * EBADF, EINTR, and EINVAL... and in none of those - * cases does it make sense to continue. In fact - * on Linux 2.0.x we seem to end up with EFAULT - * occasionally, and we'd loop forever due to it. - */ -ap_log_error(APLOG_MARK, APLOG_ERR, (const server_rec*) ap_get_server_conf(), select: (listen)); -clean_child_exit(1); -} - -if (srv == 0) { -/* Is srv == 0 a valid return? */ +srv = poll(listenfds, num_listenfds + 1, -1); +if (workers_may_exit) +break; +if (srv 0) { +/* XXX - h, poll can return EINTR. - mvsk */ +if (errno == EINTR) { continue; +} +SAFE_ACCEPT(accept_mutex_off(0)); +SAFE_ACCEPT(intra_mutex_off(0)); +/* Single Unix documents select as returning errnos + * EBADF, EINTR, and EINVAL... and in none of those + * cases does it make sense to continue. In fact + * on Linux 2.0.x we seem to end up with EFAULT + * occasionally, and we'd loop forever due to it. + */ +ap_log_error(APLOG_MARK, APLOG_ERR, (const server_rec*) ap_get_server_conf(), select: (listen)); +clean_child_exit(1); +} + +if (srv == 0) { +/* Is srv == 0 a valid return? */ +continue; } -/* find a listener */ -/* Loop or NULL terminated list? That is the question. Be consistent across - all the accept techniques */ -lr = head_listener; -do { -/* XXX: should we check for PR_POLL_ERR ?? */ -if (listenfds[lr-index].revents POLLIN) { -/* advance to the next listener for next loop */ -head_listener = lr-next; -/* hack to handle listenfds being NULL terminated list - * rather than a loop - */ -if (!head_listener) { -head_listener = ap_listeners; -} -goto got_lr; +/* find a listener */ +/* Loop or NULL terminated list? That is the question. Be consistent across + all the accept techniques */ +lr = head_listener; +do { +/* XXX: should we check for PR_POLL_ERR ?? */ +if (listenfds[lr-index].revents POLLIN) { +/* advance to the next listener for next loop */ +head_listener = lr-next; +/* hack to handle listenfds being NULL terminated list + * rather than a loop + */ +if (!head_listener) { +head_listener = ap_listeners; } -lr = lr-next; - if (lr == NULL) { +goto got_lr; +} +lr = lr-next; + if (lr
cvs commit: apache-apr/pthreads/src/main http_accept.c http_main.c
manoj 99/05/23 19:10:28 Modified:pthreads/src/include http_main.h pthreads/src/main http_accept.c http_main.c Log: Switch to using a pipe to notify children of graceful shutodwn instead of a signal. This also naturally solves a problem with graceful shutdown of children blocked on the accept mutex. Revision ChangesPath 1.6 +3 -0 apache-apr/pthreads/src/include/http_main.h Index: http_main.h === RCS file: /home/cvs/apache-apr/pthreads/src/include/http_main.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -u -r1.5 -r1.6 --- http_main.h 1999/04/09 04:10:35 1.5 +++ http_main.h 1999/05/24 02:10:25 1.6 @@ -58,6 +58,9 @@ #ifndef APACHE_HTTP_MAIN_H #define APACHE_HTTP_MAIN_H +/* Pipe used to signal a graceful child shutdown */ +extern int ap_pipe_of_death[2]; + #ifdef __cplusplus extern C { #endif 1.15 +19 -15apache-apr/pthreads/src/main/http_accept.c Index: http_accept.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_accept.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -u -r1.14 -r1.15 --- http_accept.c 1999/05/20 05:00:41 1.14 +++ http_accept.c 1999/05/24 02:10:26 1.15 @@ -331,7 +331,6 @@ */ static listen_rec *head_listener; static struct pollfd *listenfds; -static int pipe_of_death; void accept_parent_init(pool *pconf, int listener_count) { @@ -344,7 +343,6 @@ int worker_threads_per_child) { int i; -int pipe_pair_of_death[2]; listen_rec *lr; SAFE_ACCEPT(intra_mutex_init(pchild, 1)); @@ -353,15 +351,7 @@ head_listener = ap_listeners; listenfds = ap_palloc(pchild, sizeof(struct pollfd) * (num_listenfds + 1)); - -if (pipe(pipe_pair_of_death) == -1) { -ap_log_error(APLOG_MARK, APLOG_ERR, - (const server_rec*) ap_get_server_conf(), - pipe: (pipe_of_death)); - clean_child_exit(1); -} -pipe_of_death = pipe_pair_of_death[1]; -listenfds[0].fd = pipe_pair_of_death[0]; +listenfds[0].fd = ap_pipe_of_death[0]; listenfds[0].events = POLLIN; listenfds[0].revents = 0; for (lr = ap_listeners, i = 1; i = num_listenfds; lr = lr-next, ++i) { @@ -380,7 +370,9 @@ int csd = -1; int sd; int srv; +int ret; listen_rec *lr; +char pipe_read_char; size_t len = sizeof(struct sockaddr); @@ -400,6 +392,21 @@ break; srv = poll(listenfds, num_listenfds + 1, -1); +if (listenfds[0].revents POLLIN) { +/* A process has gotten a signal on the shutdown pipe. + * Check if we're the lucky process to die. */ +ret = read(listenfds[0].fd, pipe_read_char, 1); +if (ret == -1 errno == EAGAIN) { +/* It lost the lottery. It must continue to suffer through + * a life of servitude */ +continue; +} +else { +/* It won the lottery (or something else is very wrong). + * Embrace death with open arms. */ +break; +} +} if (workers_may_exit) break; if (srv 0) { @@ -472,6 +479,7 @@ break; } } +workers_may_exit = 1; return -1; } @@ -479,15 +487,11 @@ { int i; int index = find_child_by_pid(getpid()); -char char_of_death = '!'; parent_score *ss = ap_scoreboard_image-parent[index]; requests_this_child = 0; workers_may_exit = 1; - -/* Kick threads out of poll */ -(void) write(pipe_of_death, char_of_death, 1); for (i = 0; i ss-worker_threads; i++) { pthread_join(ap_scoreboard_image-servers[index][i].tid, NULL); 1.81 +26 -9 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.80 retrieving revision 1.81 diff -u -u -r1.80 -r1.81 --- http_main.c 1999/05/20 04:33:32 1.80 +++ http_main.c 1999/05/24 02:10:27 1.81 @@ -216,6 +216,7 @@ array_header *ap_server_config_defines; pool *pchild;/* Pool for httpd child stuff */ +int ap_pipe_of_death[2]; /* thread local storage code that isn't used right now */ @@ -1963,7 +1964,6 @@ /* XXX - Do the appropriate thing for each signal */ switch (signal_received
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/05/23 20:07:03 Modified:pthreads/src/main http_main.c Log: Get rid of the last vestiges of SIGWINCH handling in child processes. Now, each worker thread knows when it's the last one to exit, and in that case, sends SIGTERM to kick the sigwait thread. Revision ChangesPath 1.82 +20 -26apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.81 retrieving revision 1.82 diff -u -u -r1.81 -r1.82 --- http_main.c 1999/05/24 02:10:27 1.81 +++ http_main.c 1999/05/24 03:07:02 1.82 @@ -288,8 +288,10 @@ static int my_pid; /* for hybridization, we need this. Stupid to call getpid all the time */ +/* Keep track of the number of worker threads currently active */ +static int worker_thread_count; +static pthread_mutex_t worker_thread_count_mutex; - /* * Pieces for managing the contents of the Server response header * field. @@ -401,11 +403,6 @@ exit(code); } -static void graceful_killer(void) -{ -stop_accepting_connections(pconf); -} - int ap_get_timeout(request_rec *r) { @@ -991,11 +988,6 @@ } } -static void graceful_sig_handler(int sig) -{ -ap_max_requests_per_child = 1; -} - /* * Connection structures and accounting... */ @@ -1730,7 +1722,6 @@ #endif } - static void * worker_thread(void * dummy) { proc_info * ti = dummy; @@ -1745,6 +1736,10 @@ ptrans = ap_make_sub_pool(tpool); +pthread_mutex_lock(worker_thread_count_mutex); +worker_thread_count++; +pthread_mutex_unlock(worker_thread_count_mutex); + while (1) { (void) ap_update_child_status(process_slot, thread_slot, SERVER_READY, (request_rec *) NULL); @@ -1757,9 +1752,17 @@ } ap_destroy_pool(tpool); -kill(ap_scoreboard_image-parent[process_slot].pid, SIGWINCH); ap_update_child_status(process_slot, thread_slot, SERVER_DEAD, (request_rec *) NULL); +pthread_mutex_lock(worker_thread_count_mutex); +worker_thread_count--; +if (worker_thread_count == 0) { +/* All the threads have exited, now finish the shutdown process + * by signalling the sigwait thread */ +kill(my_pid, SIGTERM); +} +pthread_mutex_unlock(worker_thread_count_mutex); + return NULL; } @@ -1891,7 +1894,7 @@ sigset_t sig_mask; int signal_received; pthread_t thread; -int i, j; +int i; int my_child_num = child_num_arg; proc_info *my_info = NULL; @@ -1923,6 +1926,9 @@ } /* Setup worker threads */ + +worker_thread_count = 0; +pthread_mutex_init(worker_thread_count_mutex, NULL); for (i=0; i ap_threads_per_child; i++) { my_info = NULL; @@ -1957,23 +1963,11 @@ /* This thread will be the one responsible for handling signals */ sigemptyset(sig_mask); -sigaddset(sig_mask, SIGWINCH); sigaddset(sig_mask, SIGTERM); sigaddset(sig_mask, SIGINT); sigwait(sig_mask, signal_received); /* XXX - Do the appropriate thing for each signal */ switch (signal_received) { -case SIGWINCH: - for (j = 0; j ap_threads_per_child + ap_acceptors_per_child; - j++) { -/* Useful for debugging */ -if (ap_scoreboard_image-servers[child_num_arg][j].status != SERVER_DEAD) { -ap_scoreboard_image-servers[child_num_arg][j].status = SERVER_GRACEFUL; -} - } -graceful_killer(); -clean_child_exit(0); - break; case SIGTERM: just_die(SIGTERM); break;
cvs commit: apache-apr STATUS
manoj 99/05/23 20:47:39 Modified:.STATUS Log: I saw Rob Malda take apart the circuitry in his beer mug last night. Revision ChangesPath 1.24 +1 -19 apache-apr/STATUS Index: STATUS === RCS file: /home/cvs/apache-apr/STATUS,v retrieving revision 1.23 retrieving revision 1.24 diff -u -u -r1.23 -r1.24 --- STATUS1999/04/29 19:34:19 1.23 +++ STATUS1999/05/24 03:47:39 1.24 @@ -1,5 +1,5 @@ Apache Portable Runtime STATUS: -Last modified at [$Date: 1999/04/29 19:34:19 $] +Last modified at [$Date: 1999/05/24 03:47:39 $] Release: @@ -42,24 +42,6 @@ Everything Needs patch: - -When the server runs at a high load, and the load later drops off, -the server tries to kill off some children. The problem is that the -children selected may have threads blocked on the accept lock, so -they will never exit. This wasn't a problem with 1.3, because each -process got kicked out of the lock with a signal. This could be solved -(Thanks, Dean) with a server-wide pipe that replaces the SIGWINCH signal. -This would wake up every thread when a single child death signal is sent -over the pipe. - -Related to the above: On Red Hat 5.2, when we SIGTERM the server and -the server is in this state, the children waiting on fcntl will not -die, even though nobody else is holding the lock, verified with lsof. -The children eventually will be SIGKILLed by the parent. This only -happens in USE_MULTI_ACCEPT mode, and the problem goes away when -USE_INTRAPROCESS_SERIALIZED_ACCEPT is undefined. Dean has a couple of -suggestions for tracing down this problem in -[EMAIL PROTECTED] Open issues:
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/05/23 23:29:45 Modified:pthreads/src/main http_main.c Log: Minor cleanup Revision ChangesPath 1.83 +2 -5 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.82 retrieving revision 1.83 diff -u -u -r1.82 -r1.83 --- http_main.c 1999/05/24 03:07:02 1.82 +++ http_main.c 1999/05/24 06:29:43 1.83 @@ -1966,17 +1966,14 @@ sigaddset(sig_mask, SIGTERM); sigaddset(sig_mask, SIGINT); sigwait(sig_mask, signal_received); -/* XXX - Do the appropriate thing for each signal */ switch (signal_received) { case SIGTERM: -just_die(SIGTERM); - break; case SIGINT: -just_die(SIGINT); +just_die(signal_received); break; default: ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf, -received strange signal: %d, signal_received); +received strange signal: %d, signal_received); } }
cvs commit: apache-apr/pthreads/src/main http_config.c http_core.c http_main.c
manoj 99/05/23 23:53:37 Modified:pthreads/src/include httpd.h pthreads/src/main http_config.c http_core.c http_main.c Log: Change the algorithm for spare server maintanence to base its decisions on the number of idle threads, rather than the number of mostly idle processes. Revision ChangesPath 1.15 +0 -8 apache-apr/pthreads/src/include/httpd.h Index: httpd.h === RCS file: /home/cvs/apache-apr/pthreads/src/include/httpd.h,v retrieving revision 1.14 retrieving revision 1.15 diff -u -u -r1.14 -r1.15 --- httpd.h 1999/04/14 21:03:19 1.14 +++ httpd.h 1999/05/24 06:53:32 1.15 @@ -370,14 +370,6 @@ #define DEFAULT_THREADS_PER_CHILD 50 #endif -#ifndef DEFAULT_IDLE_THRESHOLD -#define DEFAULT_IDLE_THRESHOLD (int)(DEFAULT_THREADS_PER_CHILD * 0.05) -#endif - -#ifndef DEFAULT_BUSY_THRESHOLD -#define DEFAULT_BUSY_THRESHOLD (DEFAULT_THREADS_PER_CHILD - (int)(DEFAULT_THREADS_PER_CHILD * 0.05)) -#endif - #ifndef DEFAULT_EXCESS_REQUESTS_PER_CHILD #define DEFAULT_EXCESS_REQUESTS_PER_CHILD 0 #endif 1.12 +0 -2 apache-apr/pthreads/src/main/http_config.c Index: http_config.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_config.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -u -r1.11 -r1.12 --- http_config.c 1999/03/17 17:01:18 1.11 +++ http_config.c 1999/05/24 06:53:33 1.12 @@ -1394,8 +1394,6 @@ ap_lock_fname = DEFAULT_LOCKFILE; ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD; ap_threads_per_child = DEFAULT_THREADS_PER_CHILD; -ap_idle_thread_threshold = DEFAULT_IDLE_THRESHOLD; -ap_busy_thread_threshold = DEFAULT_BUSY_THRESHOLD; /* ZZZ Initialize the Network Address here. */ ap_bind_address.s_addr = htonl(INADDR_ANY); ap_listeners = NULL; 1.13 +0 -35 apache-apr/pthreads/src/main/http_core.c Index: http_core.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_core.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -u -r1.12 -r1.13 --- http_core.c 1999/04/14 21:03:28 1.12 +++ http_core.c 1999/05/24 06:53:33 1.13 @@ -2155,28 +2155,7 @@ return NULL; } -static const char *set_idle_threshold(cmd_parms *cmd, void *dummy, char *arg) -{ -const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); -if (err != NULL) { -return err; -} -ap_idle_thread_threshold = atoi(arg); -return NULL; -} - -static const char *set_busy_threshold(cmd_parms *cmd, void *dummy, char *arg) -{ -const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); -if (err != NULL) { -return err; -} - -ap_busy_thread_threshold = atoi(arg); -return NULL; -} - static const char *set_max_free_servers(cmd_parms *cmd, void *dummy, char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); @@ -2224,8 +2203,6 @@ } static const char *set_threads(cmd_parms *cmd, void *dummy, char *arg) { -int user_def_idle = ap_idle_thread_threshold; -int user_def_busy = ap_busy_thread_threshold; const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) { return err; @@ -2233,14 +2210,6 @@ ap_threads_per_child = atoi(arg); -ap_idle_thread_threshold = (int)(ap_threads_per_child * 0.05); -ap_busy_thread_threshold = ap_threads_per_child - (int)(ap_threads_per_child * 0.05); - -if (user_def_idle != DEFAULT_IDLE_THRESHOLD) -ap_idle_thread_threshold = user_def_idle; -if (user_def_busy != DEFAULT_BUSY_THRESHOLD) -ap_busy_thread_threshold = user_def_busy; - if (ap_threads_per_child 1) { fprintf(stderr, WARNING: Require ThreadsPerChild 0, setting to 1\n); ap_threads_per_child = 1; @@ -2838,10 +2807,6 @@ Maximum number of idle children }, { MaxServers, set_max_free_servers, NULL, RSRC_CONF, TAKE1, Deprecated equivalent to MaxSpareServers }, -{ IdleThreadThreshold, set_idle_threshold, NULL, RSRC_CONF, TAKE1, - Minimum number of idle threads, below which process is considered ready for reaping. }, -{ BusyThreadThreshold, set_busy_threshold, NULL, RSRC_CONF, TAKE1, - Maximum number of idle threads, above which process is considered busy. }, { ServersSafetyLimit, set_server_limit, NULL, RSRC_CONF, TAKE1, Deprecated equivalent to MaxClients }, { MaxClients, set_server_limit, NULL, RSRC_CONF, TAKE1, 1.84 +16 -20apache-apr/pthreads/src/main/http_main.c Index: http_main.c
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/05/24 13:33:35 Modified:pthreads/src/main http_main.c Log: Since pthread_join isn't used anymore in the server, create all of our threads in detached state. Revision ChangesPath 1.85 +5 -1 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.84 retrieving revision 1.85 diff -u -u -r1.84 -r1.85 --- http_main.c 1999/05/24 06:53:34 1.84 +++ http_main.c 1999/05/24 20:33:32 1.85 @@ -1894,6 +1894,7 @@ sigset_t sig_mask; int signal_received; pthread_t thread; +pthread_attr_t thread_attr; int i; int my_child_num = child_num_arg; proc_info *my_info = NULL; @@ -1929,6 +1930,8 @@ worker_thread_count = 0; pthread_mutex_init(worker_thread_count_mutex, NULL); +pthread_attr_init(thread_attr); +pthread_attr_setdetachstate(thread_attr, PTHREAD_CREATE_DETACHED); for (i=0; i ap_threads_per_child; i++) { my_info = NULL; @@ -1942,7 +1945,7 @@ /* We are creating threads right now */ (void) ap_update_child_status(my_child_num, i, SERVER_STARTING, (request_rec *) NULL); - if (pthread_create(thread, NULL, worker_thread, my_info)) { + if (pthread_create(thread, thread_attr, worker_thread, my_info)) { ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf, pthread_create: unable to create worker thread); /* @@ -1959,6 +1962,7 @@ */ } +pthread_attr_destroy(thread_attr); start_accepting_connections(my_child_num); /* This thread will be the one responsible for handling signals */
cvs commit: apache-apr STATUS
manoj 99/05/24 22:49:28 Modified:.STATUS Log: oh well... Revision ChangesPath 1.25 +8 -1 apache-apr/STATUS Index: STATUS === RCS file: /home/cvs/apache-apr/STATUS,v retrieving revision 1.24 retrieving revision 1.25 diff -u -u -r1.24 -r1.25 --- STATUS1999/05/24 03:47:39 1.24 +++ STATUS1999/05/25 05:49:27 1.25 @@ -1,5 +1,5 @@ Apache Portable Runtime STATUS: -Last modified at [$Date: 1999/05/24 03:47:39 $] +Last modified at [$Date: 1999/05/25 05:49:27 $] Release: @@ -42,6 +42,13 @@ Everything Needs patch: + + With Linux 2.2.9 + glibc 2.1.1pre (from RH 6), if MaxRequestsPerChild + is low (e.g. 5) and ThreadsPerChild is high (e.g. 64), some processes + will hang in pthread_create. This is an insane configuration, though. + + With AIX 4.2, if MaxRequestsPerChild is low and ThreadsPerChild is + high, the signal delivered to sigwait gets dropped on the floor. Open issues:
cvs commit: apache-apr STATUS
manoj 99/05/25 21:04:32 Modified:.STATUS Log: 64 * 8 256. Linux was hitting user process limits. Revision ChangesPath 1.26 +7 -7 apache-apr/STATUS Index: STATUS === RCS file: /home/cvs/apache-apr/STATUS,v retrieving revision 1.25 retrieving revision 1.26 diff -u -u -r1.25 -r1.26 --- STATUS1999/05/25 05:49:27 1.25 +++ STATUS1999/05/26 04:04:32 1.26 @@ -1,5 +1,5 @@ Apache Portable Runtime STATUS: -Last modified at [$Date: 1999/05/25 05:49:27 $] +Last modified at [$Date: 1999/05/26 04:04:32 $] Release: @@ -43,12 +43,12 @@ Needs patch: - With Linux 2.2.9 + glibc 2.1.1pre (from RH 6), if MaxRequestsPerChild - is low (e.g. 5) and ThreadsPerChild is high (e.g. 64), some processes - will hang in pthread_create. This is an insane configuration, though. - - With AIX 4.2, if MaxRequestsPerChild is low and ThreadsPerChild is - high, the signal delivered to sigwait gets dropped on the floor. + With AIX 4.2, if MaxRequestsPerChild is low (e.g. 5) and + ThreadsPerChild is high (e.g. 64), the signal delivered to sigwait + gets dropped on the floor. The hypothesis is that the signals blocked + by pthread_sigmask aren't kept pending as they should be, so when + worker threads exit quickly and signal the sigwait thread before the + sigwait() call has been entered, the thread never gets the signal. Open issues:
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/05/26 00:12:32 Modified:pthreads/src/main http_main.c Log: Cleanup and dead code removal. Revision ChangesPath 1.88 +15 -73apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.87 retrieving revision 1.88 diff -u -u -r1.87 -r1.88 --- http_main.c 1999/05/26 07:09:18 1.87 +++ http_main.c 1999/05/26 07:12:30 1.88 @@ -98,20 +98,12 @@ #include netinet/tcp.h #include stdio.h -#ifdef USE_SHMGET_SCOREBOARD -#include sys/types.h -#include sys/ipc.h -#include sys/shm.h -#endif - #include pthread.h /*#include initialization if any #include threadabstractionlayer; #include networkiolayer #include lock */ -#include setjmp.h - /* This next function is never used. It is here to ensure that if we * make all the modules into shared libraries that core httpd still * includes the full Apache API. Without this function the objects in @@ -218,33 +210,6 @@ int ap_pipe_of_death[2]; -/* thread local storage code that isn't used right now */ - -#if 0 -/* stuff that needs thread local store in main */ -typedef struct { -jmp_buf thread_exit; -int generation; -} tls_main_t; - -static pthread_key_t tls_main_key;/* */ - -static tls_main_t *gettls(pthread_key_t tls_main_key) -{ -tls_main_t *tls_p; -tls_p = pthread_getspecific(tls_main_key); -if (!tls_p) { -tls_p = NULL; -fprintf(stderr, pthread_getspecific failed\n); -} - -return tls_p; -} -#define tls() ((tls_main_t *) gettls(tls_main_key)) /* Z */ -#endif - - - /* *Non*-shared http_main globals... */ static server_rec *server_conf; @@ -961,24 +926,9 @@ */ } -/* - * Connection structures and accounting... - */ - -/* XXX - alarms will need to be blockable at some point */ - -static int alarms_blocked = 0; -static int exit_after_unblock = 0; static void just_die(int sig) -{/* SIGHUP to child process??? */ -/* if alarms are blocked we have to wait to die otherwise we might - * end up with corruption in alloc.c's internal structures */ -if (alarms_blocked) { - exit_after_unblock = 1; -} -else { - clean_child_exit(0); -} +{ +clean_child_exit(0); } /* @@ -1926,9 +1876,12 @@ pthread_attr_setdetachstate(thread_attr, PTHREAD_CREATE_DETACHED); for (i=0; i ap_threads_per_child; i++) { -my_info = NULL; - my_info = (proc_info *)malloc(sizeof(proc_info)); +if (my_info == NULL) { +ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf, + malloc: out of memory); +clean_child_exit(APEXIT_CHILDFATAL); +} my_info-pid = my_child_num; my_info-tid = i; my_info-sd = 0; @@ -1940,13 +1893,11 @@ if (pthread_create(thread, thread_attr, worker_thread, my_info)) { ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf, pthread_create: unable to create worker thread); - /* - * We failed to create a thread. Update the scoreboard, - * or it will say SERVER_STARTING forever. - */ - (void) ap_update_child_status(my_child_num, i, SERVER_DEAD, - (request_rec *) NULL); - exit(1); /* We won't always exit here, but for no this is okay */ +/* 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); + clean_child_exit(APEXIT_CHILDFATAL); } /* We let each thread update it's own scoreboard entry. This is done @@ -1969,8 +1920,8 @@ break; default: ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf, -received strange signal: %d, signal_received); - +received impossible signal: %d, signal_received); +just_die(SIGTERM); } } @@ -1991,8 +1942,6 @@ if (one_process) { set_signals(); - /* Needed even in the one process case because lookup of the process - * pid sometimes must go through the scoreboard */ ap_scoreboard_image-parent[slot].pid = getpid(); child_main(slot); } @@ -2000,12 +1949,6 @@ Explain1(Starting new child in slot %d,slot); if ((pid = fork()) == -1
cvs commit: apache-apr/pthreads/src/main http_accept.c
manoj 99/05/27 17:19:34 Modified:pthreads/src/main http_accept.c Log: Squash a potential thread-safeness bug. Every thread could touch the lr and head_listener pointers at the same time when accepts weren't serialized. So, put back the special condition for one listen socket where we don't bother with lr and head_listener at all. Revision ChangesPath 1.17 +40 -31apache-apr/pthreads/src/main/http_accept.c Index: http_accept.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_accept.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -u -r1.16 -r1.17 --- http_accept.c 1999/05/24 06:18:47 1.16 +++ http_accept.c 1999/05/28 00:19:33 1.17 @@ -400,38 +400,48 @@ if (srv == 0) { /* Is srv == 0 a valid return? */ continue; - } +} -/* find a listener */ -/* Loop or NULL terminated list? That is the question. Be consistent across - all the accept techniques */ -lr = head_listener; -do { -/* XXX: should we check for PR_POLL_ERR ?? */ -if (listenfds[lr-index].revents POLLIN) { -/* advance to the next listener for next loop */ -head_listener = lr-next; -/* hack to handle listenfds being NULL terminated list - * rather than a loop - */ -if (!head_listener) { -head_listener = ap_listeners; + /* This conditional is used because the single listen case is the + * only one where the accept might not be serialized. In that + * case, multiple threads mucking around with the head_listener + * pointer will be harmful */ +if (num_listenfds == 1) { + /* only one socket, just pretend we did the other stuff */ + sd = ap_listeners-fd; +} +else { +/* find a listener */ +/* Loop or NULL terminated list? That is the question. Be + * consistent across all the accept techniques */ +lr = head_listener; +do { +/* XXX: should we check for PR_POLL_ERR ?? */ +if (listenfds[lr-index].revents POLLIN) { +/* advance to the next listener for next loop */ +head_listener = lr-next; +/* hack to handle listenfds being NULL terminated list + * rather than a loop + */ +if (head_listener == NULL) { +head_listener = ap_listeners; +} +goto got_lr; } -goto got_lr; -} -lr = lr-next; - if (lr == NULL) { - lr = ap_listeners; -} -} while (lr != head_listener); - -/* if we don't find anything then just start again */ - fprintf(stderr,poll returned but we got nothing!\n); - head_listener = ap_listeners; -continue; - -got_lr: -sd = lr-fd; +lr = lr-next; +if (lr == NULL) { + lr = ap_listeners; +} +} while (lr != head_listener); + +/* if we don't find anything then just start again */ +fprintf(stderr,poll returned but we got nothing!\n); +head_listener = ap_listeners; +continue; + +got_lr: +sd = lr-fd; +} csd = accept(sd, sa_client, len); requests_this_child--; @@ -439,7 +449,6 @@ break; /* We have a socket ready for reading */ /* XXX: we need to deal with error conditions here */ } - SAFE_ACCEPT(accept_mutex_off(0)); SAFE_ACCEPT(intra_mutex_off(0));