Fix inadvertant closing of FD0 when a client aborts a request to a dynamic applicatio...
[mod_fastcgi.git] / CHANGES
blob665a32edb68e48e51153c2905c1bf7b452b05cdf
1 2.2.9
3  *) Fix a nasty bug that occurred when a client aborted a request 
4     before the connection to a dynamic FastCGI application was opened.
5     The application's lock file descriptor wasn't setup but was being 
6     closed which resulted in FD0 being closed.  Normally this open to 
7     /dev/null and should pose no problems except that because the FD
8     was available it was being returned by Apache's accept().  This 
9     caused it to be registered for pool cleanup.  mod_cgi though moves
10     the CGI stdin pipe to FD0 and thus it was getting waxed during pool
11     cleanup.  Problem identified by checksum@tebie.com.
13 Changes with mod_fastcgi 2.2.8
15  *) Eliminate the concept of disabled applications.  If a failure 
16     occurs trying to setup an application (e.g. bind() error) its 
17     tried repeatedly every init-start-delay seconds.
19  *) Tweak to Makefile.tmpl to support DSOs.  Dave Hill [ddhill@zk3.dec.com]
21 Changes with mod_fastcgi 2.2.6
23  *) Shutdown the PM when Apache appears to have disappeared.
25  *) seteuid() tweak for HP-UX 11.  Milton L. Hankins [mlh@swl.msd.ray.com]
27  *) (Win32) More dynamic fixes.
29  *) (Win32) Eliminate the per application named pipe mutex.  Its now 
30     per process to keep the lib happy (the use _FCGI_MUTEX_ should
31     removed from the lib).  This allows pipe-based applications to
32     now handle multiple simoultanous requests (one per process).
34  *) Increase the number of open FDs we look to close when spawning apps.
36  *) Prevent an assert from popping unnecessarily.
38  *) (Win32) Add support for interpretter scripts.
40  *) (Win32) Fix named pipe handling (problems with large responses).
42  *) (Win32) Remove the "can exec" check.
44 Changes with mod_fastcgi 2.2.4
46  *) Beta WinNT support.  David Allen [djallen@raleigh.ibm.com] and 
47     Rob Saccoccio [robs@chelsea.net]
49  *) Remove request type restriction (GET and POST only) in order to support
50     Web DAV requests.  Scott Robertson [sroberts@codeit.com] 
52  *) Allow requests for URLs such as /server/some/other/qualifier to match a
53     FastCGI server defined as /server.  This was done primarily for Java
54         Servlets, but is generically useful.
56  *) Change the comm between the PM and the request handlers from a regular
57     file to a pipe and an assortment of other dynamic fixes.
59  *) Log dynamic process termination scheduling and the resulting 
60     process exit notification.
62  *) Change the default singleThreshhold from 10 to 0 to prevent the last dynamic
63     application process from being killed off due to low demand.
65  *) Clean up FastCGI application pathnames (e.g. remove duplicate slashes). 
67  *) Fix bugs that prevented dynamic processes from being shutdown when
68     the load subsided.  Lars Heete [heete@do.isst.fhg.de]
70  *) Prevent dynamic processes from being scheduled to be started before
71     the init-start-delay or restart-delay period expires.  This prevents
72         the queuing of process start requests while an application which has
73         a long initialization period starts up.
75  *) When suexec is enabled, allow the process manager to become root again in
76     order to signal applications it spawned.
78  *) Change the "server started" log message level from INFO to WARN.
80  *) Fix dynamic server "Connection Refused" handling.
82  *) Fix demand-based dynamic process spawing (uses a more portable approach).
84  *) Add -idle-timeout arg to FastCgiServer, FastCgiExternalServer, and
85     FastCgiConfig.  mod_fastcgi will now abort a connection if inactive for
86         longer than this period.  It applies to the initiation of connections as
87         well (and thus is similar to appConnTimeout).  Default is 30 seconds.
89  *) appConnTimeout is 0 by default now resulting in blocking connect()s.  This
90     is more platform portable/predicable.
92  *) Leave STDOUT and STDERR open to the main server error_log.  This should
93     eliminate a pile of protocol errors and having to track down 3rd party
94     libs writing to stderr inadvertantly.  This doesn't mean these shouldn't
95     be fixed in the application to use the FastCGI I/O, it just allows these
96     applications to run when previously they'd crash and burn.
98  *) Add the pass-header arg to server directives.
100  *) Allow supplementary groups to be passed to spawned FastCGI applications (as
101     is done for CGI) - at least until PR2580 is resolved.
103  *) Initialize the default (empty) environment in a more socially acceptable
104     way.
106  *) Miscellaneous doc improvements based on notes I've collected up over the
107     last few months.
109  *) Fix a bug in the stderr handling introduced in 2.2.2.  There were conditions
110     that resulted in not or improperly terminated strings.
112  *) Fix the call to setsockopt() to disable Nagle.  [based on a bug report by
113     Johannes Plassmann <johannes.plassmann@pdb.siemens.de>]
115 Changes with mod_fastcgi 2.2.2
117  *) Added support for blocking connect()s by setting appConnTimeout to 0.
118     Non-blocking connect()s (the default) can be troublesome on some platforms.
119     Its expected that blocking connect()s will become the default (and
120     non-blocking connect()s will become optional) in the next release.
122  *) Dump a compile time error if the version of Apache is too old.
124  *) Wrap the SIGPIPE handler manipulation code such that it is only applicable
125     to Apache releases prior to 1.3.6.
127  *) Minor tweaks for RUSSIAN_APACHE.  [Sergey Gershtein <sg@mplik.ru>]
129  *) Dynamic updates:
131     Always restart a failed dynamic application if it is the last instance.
132     This means there once started there will always be at least one process
133     instance of a dynamic application.
135     Send PLEASE_START to the PM when a connect() results in an ECONNREFUSED.
136     ECONNREFUSED means the listen queue is full (or there isn't one).  Asking
137     the PM to start (another) application instance may help empty it faster.
139     Change two sleep() calls to select() based snoozes because alarm() is in
140     effect and sleep() and alarm() don't always play nice together.
142     Fixed a couple of error messages.
144  *) Fix -listen-queue-depth arg on FastCgiConfig (dynamic).  Previously it
145     was ignored and the default was always used.
147  *) Allow the -initial-env argument to be used to pass variables from the
148     Apache process environment to the FastCGI server (by specifying a
149     variable name without the "=" or a value).  [suggested by
150     Martin Lichtin <lichtin@oanda.com>]
152  *) Cleanup some debug macros.
154  *) Improved script stderr handling.  [based on suggestions by
155     David Birnbaum <davidb@chelsea.net>]
157  *) Added IRIX and FreeBSD to the list of supported platforms and other minor
158     updates to the INSTALL doc.
160  *) Changed the default listen-queue-depth (FCGI_DEFAULT_LISTEN_Q) from
161     5 to 100.  Its still configurable with the -listen-queue-depth option.
162     This should help eliminate the FAQ - Why do I see "Connection Refused"
163     messages in the log?
165  *) Fix a bug in FastCgiExternalServer that broke support for external servers
166     on other hosts.  [Dave Neuer <dneuer@futuristics.net>]
168 Changes with mod_fastcgi 2.2.1
170  *) Updates to the INSTALL doc to describe building as a DSO.
172  *) If the FastCgiIpcDir directive was in use and "httpd -t" was issued while
173     Apache was running ("apachectl restart" does this), the contents of the
174     dynamic directory (dynamic sockets and the mbox) would be blown away
175     (a 2.1b1 bug).
177  *) Add an extern declaration for ap_sys_siglist (its exposed but not in any
178     Apache header file) to prevent a compile error on systems without
179     SYS_SIGLIST defined.
181  *) During auth requests, the subprocess_env table was left holding variables
182     sent to the auth FastCGI server (including REMOTE_PASSWD!) which means they
183     were passed to other processing phases (such as CGI/FastCGI).  The
184     subprocess_env is now restored to its pre-auth condition.
186  *) Added a FastCGI Authorizer Role compatibility mode which implements the
187     specification to the tee.  Use -compat arg with any of the Auth server
188     directives.  This is intended for new and existing FastCGI authorizer
189     applications that require compatibility with other server implementations.
191  *) Fix logging from the process manager.  Previously, all calls to the
192     logging routines used NULL for the server_rec.  This works fine in a dev
193     environment, but results in most of these messages being tossed by
194     log_error_core() because DEFAULT_LOGLEVEL is too low.  Odd logic.
196  *) Always setup fr->header so that in the event the FastCGI server
197     doesn't get a valid FastCGI protocol header over the wire, we
198     can still print our error message to the log from do_work().
200  *) Fix a compile error in open_connection_to_fs() on systems with TCP_NODELAY
201     defined (Don Locrasto [locrasto@iceminer.com]).
203 Changes with mod_fastcgi 2.2.0
205  *) Serious rewrite of mod_fastcgi.html.  An example conf will have
206     to wait until another time - I'm burned out on docs updates.
208  *) Add to the mod_fastcgi to the server version string.
210  *) SCO doesn't like the const in the arg to inet_addr() and
211     gethostbyname().
213  *) Use Apache's NET_SIZE_T to get the correct arg type for getsockopt().
215  *) Deleted redundant header files from fcgi.h.
217  *) Full path names are no longer required for directives which take
218     file names as arguments.  Like other Apache directives you can
219     specify paths from server_root (don't start with a "/").
221  *) The fcgiKillMgr is gone.  This intermediate process sat between
222     the Apache parent and the FastCGI Process Manager under Apache
223     1.2.         The process manager tries to name itself fcgi_pm (it used
224     to be fcgiProcMgr).
226  *) Authentication, Authorization, and Access phases are now
227     supported. I've bent the FastCgi spec a bit: as many of the standard
228     environment variables (that were easy) are sent (the spec says don't
229     send some by name), all headers (except Status) sent by the auth
230     FastCgi server are passed to subprocesses (CGI/FastCGI invocations)
231     as environment variables rather than just those prefixed by
232     "Variable-".  Custom responses for auth failures aren't supported
233     (yet.. we'll see what the demand for this is like).  In addition to
234     the FastCGI protocol defined environment variable "FCGI_ROLE" being
235     set to "AUTHORIZER" an environment variable "FCGI_APACHE_ROLE" is
236     set indicating which of the three phases is being processed.  See
237     the docs for info on the new per-directory directives:
239         FastCgiAuthenticator, FastCgiAuthenticatorAuthoritative,
240         FastCgiAuthorizer, FastCgiAuthorizerAuthoritative,
241         FastCgiAccessChecker, FastCgiAccessCheckerAuthoritative
243  *) The code has been broken into logical chunks making figuring it
244     out much easier.  All of the #defines a user may want to change are
245     now in mod_fastcgi.h.
247  *) All the logging has been converted to the "supported" Apache
248     logging routines, ap_log_error() and ap_log_rerror().  Log entries
249     for request specific errors should now be directed to the correct
250     server errorlog (if your running more than one).  Some attempt has
251     been made at setting appropriate log levels (comments of course are
252     welcome) and printing errno info when its of value.  All of log
253     messages now have "FastCGI" in them (nice for grep).
255  *) All of the calls to Apache routines have been updated to the ap_
256     convention, eliminating the need for the compat header.
258  *) By default we no longer flush every piece of data we get from the
259     FastCGI server to the client.  This allows the FastCGI server to
260     release without having to wait for the client flush to complete.
261     The old behaviour can revived with the -flush argument to AppClass.
263  *) I renamed some of the directives for consistency (the old names
264     still work).
266         AppClass -> FastCgiServer,
267         FCGIConfig -> FastCgiConfig,
268         ExternalAppClass -> FastCgiExternalServer
270  *) Directive arguments are no longer case sensitive.
272  *) The module now uses hard_timeout() rather than soft_timeout.  This
273     means that the module will longjump out of the request if the
274     drop-dead timeout expires (set with Apache's Timeout directive, the
275     default is 5min) or if the client closes the connection (SIGPIPE).
276     This is more typical for a Apache modules and I'm not convinced we
277     properly handle all of the error cases well enough to use
278     soft_timeout (I can think of one place we don't anyway). This means
279     your FastCGI application can see SIGPIPE.
281  *) SIGPIPE is now ignored by default in FastCGI servers spawned by
282     Apache.  Without this the default behaviour is exit().
284  *) It should (I think) run now under DSO now.
286  *) The bug which prevented sending of binary data in 2.1b1 is fixed.
288  *) The broken -initial-env bug ins 2.1b1 is fixed.
290  *) Maybe some other stuff.
294 *** Well there's a big gap here.  Maybe I'll go back and extract the CVS
295 commit notes and stick 'em in here.. when I get some free time. ;)
297     --robs  (8 Feb 99)
300 *** Originally from docs/README..
302 Apache[X1.03.01]/mod_fastcgi[02.00.05] 19970909 unsupported
303 From: Stanley Gambarin <stanleyg@cs.bu.edu>
305  *) Yet more changes to the source distribution.  Separated out
306     the Tcl dynamic string and buffer libraries into separate files.
307     Did the same for the OS library, however, it is not really an
308     abstraction... more like a bunch of wrappers.  Added to DEVNOTES
309     a note about the problem of Apache not allowing including header
310     file more than once.
312 Apache[X1.03.01]/mod_fastcgi[02.00.04] 19970908 unsupported
313 From: Stanley Gambarin <stanleyg@cs.bu.edu>
315  *) More changes to the installation scripts.  Theoretically we
316     should be able to to use the same Makefile/installation script
317     for both Apache 1.2.x and 1.3.x.  Need some sort of the abstraction
318     layer to use the same source code for both 1.2.x and 1.3.x sources.
320 Apache[X1.03.01]/mod_fastcgi[02.00.03] 19970905 unsupported
321 From: Stanley Gambarin <stanleyg@cs.bu.edu>
323  *) Created Makefile to compile the module into the archive library,
324     just like the proxy module.  Also initial draft of the installation
325     script, which should work for both 1.2 and 1.3 sources of Apache.
327 Apache[01.02.04]/mod_fastcgi[02.00.02] 19970903 unsupported
328 From: Stanley Gambarin <stanleyg@cs.bu.edu>
330  *) More source reorg.  Separated out some header files.  Need much
331     more work on this.  Updated the TODO file.  Added fcgivers.h and
332     CHANGES     file to track the history.
334 Apache[01.02.04]/mod_fastcgi[02.00.01] 19970902 unsupported
335 From: Stanley Gambarin <stanleyg@cs.bu.edu>
337  *) Source reorganization.  This is done to provide a basis for later
338     functionality implementation.  See TODO file for more information
339     of what possible future enhancements are possible/desired.
341 Apache[01.02.04]/mod_fastcgi[02.00.00] 19970902 unsupported
342 From:  David MacKenzie <djm@va.pubnix.com>
344  *) Create the "dynamic" dir and "mbox" as the user specified in the
345     User and Group directives instead of as root.  They are created with
346     restrictive permissions, and then the module checks to see whether the
347     user specified in the User and Group directives has read, write, and
348     execute permissions on them.  Those permissions had been explicitly
349     denied by creating them as "root".
351  *) Some documentation was garbled or incomplete.
353  *) When a FastCGI application can't be execl'd, the code used a
354     value of errno that may have been stomped on by intervening system
355     calls.  That happened on BSD/OS 2.1, where the error_log was
356     reporting errno=25 (NOTTY) instead of the correct errno=13 (EACCES).
357     An intervening stdio call was setting errno as a side-effect, which
358     it has the right to do.
360  *) Erroneous fprintf arguments, a missing return value, an unused
361     function, missing declarations, and other problems detected by gcc
362     -Wall.
364  *) Duplicated code to create the lock file name merged into a single
365     function, closing several memory leaks.
367  *) FCGIConfig -minProcesses didn't allow a value of 0, so the last
368     FCGI app in a given dynamic class would live forever, even if it
369     hadn't been requested for weeks.
371  *) The test for whether to keep looking for dynamic app victims to
372     kill was backwards, so no dynamic apps were ever selected as
373     victims.
375  *) The killInterval and updateInterval were being ignored; the
376     sigsuspend() forced recalculations only when a child died,
377     instead of at the intervals specified.
379  *) When a dynamic app couldn't be started, the program SEGV'd when
380     trying to free the ipcAddrPtr twice.
382  *) Remove the dead lock file and socket when cleaning up after a
383         server whose last child has been killed, so the FastCGIHandler
384     isn't fooled into thinking there is still a process serving
385     that app.
387  *) Make file locking robust in the presence of signals.
389  *) Rename some badly named variables.
391  *) Fix typos in many comments.
393  *) Fix some memory and file descriptor leaks.
395  *) Make the blocking kill of a server closer to working.
397  *) More fixes to calculations in dynamic application management.
400 *** Originally from docs/README.OMI..
402 What's New: Version 2.0b1, 16 Apr 1997
404  *) Implemented a mechanism by which FastCGI applications are started by
405     the web server on the first request and continue running.  Also,  a
406     heuristics have been implemented to allow for dynamic killing of the
407     running FastCGI apps.  The configuration options are supplied via
408         the new FCGIConfig directive, that is described in the
409         mod_fastcgi.html
411  *) When performing internal redirect, since the original request's body
412     has already been read, do not allow the redirected request to think
413     that is has one [body].
415  *) More conditional compilation for OS/2.
417  *) Fixed occassional  "Assertion failed: len > 0, file mod_fastcgi.c"
419  *) Fixed "failed assertion `count >= 0 && count <= bufPtr->length'"
421  *) Added bflush() call after bwrite() in DrainReqOutBuf function to
422     force some output to be written in the period of inactivity. This
423     circumvents the Apache's buffering during the server-push.
425  *) Added a header-parser function placeholder for compatibility with an
426     Apache source code.
428  *) Additional checks have been placed with regard to permissions of the
429     FastCGI processes.  These include the existence of the  file,
430     ExecCGI and IncludesNOEXEC checks, disallowing of nph- scripts, etc.
432  *) Implemented a restart cleanup, so that no parentlesses FastCGI
433         applications are left after Apache is restarted and/or terminated.
434         This was accomplished via two independent mechanisms, where the
435         first one prevents a start of the process manager on the first
436         reading of the configuration files.  The second mechanism deals away
437         from Apache's  implementation of fork() (via spawn_child()) and
438         implements its own forking, thus removing any dependencies on the
439         Apache to cleanup  processes during termination phase.
441  *) Removed the definition of the Sigfunc, as Apache 2.0b10 defines it
442     itself in the file conf.h
444 What's New: Version 1.4.3, 15 Jan 1997
446  *) Fixed compilation warnings for various platforms, as well as
447         conditional compilation for OS/2.
449 What's New: Version 1.4.2, 12 Dec 1996
451  *) mod_fastcgi.c is ported to Apache 1.2b.  Any further development
452         will proceed under this version of Apache web server.
454  *) As the result of porting, the "include virtual" construct of SSI
455         will now work correctly using either <Location> or <Directory>
456         directive.
458 What's New: Version 1.4.1, 4 Dec 1996
460  *) Checks have been removed from the ScanCGIHeaders that provided
461     for the presence of both Status and Location headers as being
462     an error.  Contradictory to CGI/1.1 Internet Draft, both of
463     these headers are used by the current CGI applications.
465 What's New: Version 1.4, 22 Nov 1996
467  *) Added the -port option to AppClass, allowing TCP/IP communication.
468     Added the -socket option to AppClass, allowing Unix domain
469     communication via a configurable pathname.
471  *) Added the ExternalAppClass directive, allowing TCP/IP
472     communication with remote FastCGI applications.
474  *) The handler had its own code for generating HTTP response headers;
475     now it uses Apache's.  This reduces the size of the module.
476     More importantly, it fixes the bug in which "include virtual"
477     sees the HTTP response headers.
479  *) The response header parser performed very little checking.
480     Now the parser enforces the guidelines in the CGI/1.1
481     Internet-Draft: Status and Location are mutually exclusive,
482     Location can only be a response to GET or HEAD,
483     CGI response headers can't be repeated, etc.  (The CGI response
484     headers are the ones the handler interprets: Status, Location,
485     and Content-type.)
487  *) The response header parser used to miss CGI headers
488     with no whitespace after the colon, e.g. "Status:200 OK".
490  *) The response header parser sometimes interpreted the first line
491     of content as an RFC822 continuation line.
493  *) The handler implemented a nonstandard version of Location
494     which never used internal redirects.  The handler
495     now attempts to implement Location as specified in the
496     CGI/1.1 Internet-Draft.  The module documentation explains
497     the new behavior.
499  *) Error log entries from the response header parser were
500     pretty uninformative; they are better now.  If a header is
501     malformed, the log entry includes it.  If the headers are
502     unterminated rather than malformed, the log entry says that,
503     and says how many bytes were received from the app.
505  *) When the application manager forked a new process, and that
506     process ran into trouble before executing the first instruction
507     of application code, the process used to exit with status =
508     errno.  This made certain configuration problems (e.g. incorrect
509     file permissions when server parent is root) quite difficult
510     to pin down.  Now the failing child process opens up the error log
511     and writes an informative entry before exiting.
513  *) The module now correctly handles a slash at the end of the
514     DocumentRoot directive.  This was a one-line fix.
516 What's New: Version 1.3.3, 17 Oct 1996
518  *) The module now registers its request handler under the name
519     fastcgi-script in addition to the name application/x-httpd-fcgi.
520     This was a one-line addition to the module, but had quite
521     a large impact on the documentation and sample configuration.
523 What's New: Version 1.3.2, 27 Sept 1996
525  *) On some systems (SunOS, Linux?), fopen for append has a bug
526     that strikes when two processes append to the same file.
527     This bug causes the process manager to corrupt the error log.
528     Work around the bug by calling open, then fdopen.  A patch
529     to Apache 1.1.1 is also required, as described in mod_fastcgi.html.
530     (Reported by Bob Ramstad.)
532 What's New: Version 1.3.1, 17 Sept 1996
534  *) On Linux and SunOS, the Apache default user_id (-1) is not a
535     legal value of uid_t, so cast it.  (Reported by Bob Ramstad,
536     Scott Langley, others.)
538  *) On some systems (Linux, some Solaris?, Irix?), connect requires
539     write access to a Unix Domain socket, so provide it.  (Reported
540     by Scott Langley, freeform@wired.com, others.)
542  *) If you hit a .fcg file, but there's no AppClass defined, the
543     error should be NOT_FOUND instead of SERVER_ERROR.  (Reported
544     by Michael Smith.)
546 What's New: Version 1.3, 4 Sept 1996
548  *) Module sometimes busy-waited in FastCgiDoWork.  Fixed.
550  *) Module violated the Apache buff abstraction.
551     Fixed.  Might now work with SSL (not tested).
552     As part of the fix, eliminated support for
553     Apache 1.0x versions.
555  *) Module failed to chmod the Unix domain listening sockets
556     it created, so protections were set according to the current
557     umask.  Fixed.
559  *) Module forked too many process manager processes: One
560     per AppClass.  When the Apache parent ran as root, these
561     process manager processes ran as root.  New process
562     manager is a single process (only started if AppClass is
563     used) and runs with same privileges as other children.
564     The new process manager doesn't do any polling, so
565     there's less system overhead than before.
567  *) AppClass insisted on getting at least two arguments.  Fixed.
569  *) Module used setjmp/longjmp, causing compiler warnings
570     on some platforms (e.g. Linux.)  The module no longer
571     uses setjmp/longjmp.
573  *) Module created listening sockets in /tmp, where they were
574     sometimes wiped out by cleanup scripts.  Added FastCgiIpcDir
575     directive to give control over the location of listening
576     sockets.
578  *) Module wrote error log entries without a timestamp.  Fixed.
580  *) AppClass directive wrote error messages to stderr in addition
581     to returning a char * message to the Apache core.  Fixed.
583 What's New: Version 1.2, 3 June 1996
585  *) Ported from Apache-1.0-based code to Apache-1.1b2 internals by
586     Ralf S. Engelschall
587     <rse@en.muc.de>
588     Add version string: APACHEVERSION macro to mod_fastcgi.c
590  *) chown FastCGI socket to user_id and setuid to user_id for app
591     class processes
593  *) Modify GetFromStream() by having it call an OS dependent
594     function GetStreamSize(FILE *) which uses FILE internal data member.
595     Linux users might need to modify GetStreamSize().
597 What's New: Version 1.1, 10 May 1996
599  *) If you specify a non-existent executable in the AppClass directive,
600         or if the file exists and it does not have execute permission you
601         get a constant stream of error messages telling you that "program
602         terminated due to a signal".
604  *) The mod_fastcgi module should use the standard Apache error logging
605         facility instead of writing to stderr.
607 Version 1.0, 30 April 1996