Major improvement in concurrent processing for AB:
- Enable non-blocking connects.
- Prevent quasi-blocking mode apr_recv (which would prevent AB from
multiplexing over the entire descriptor set).
- Catch other fatal apr_recv() errors.
[This patch is slightly different than the one posted to the dev list,
but regardless thanks to the many people who reviewed this.]
A bug affecting any platform that had pre-lstat'ed the file or directory
in question. We neglected to clear the FINFO_LINK bit that told us this
was lstat()ed, but also causes stat() to follow an lstat() approach.
This is part 2 of 2 to correct the NTFS Junction (symlink) bug.
Bugz report 8014, identified by Sam Morris <sam@netcity.co.uk>
Clarify the remaining problems with Range: headers. The seg faults went away
when we changed ap_send_error_response to get rid of resource filters.
This was triggered because we generate a lot of invalid 416 responses for SSI.
That happens because the complete length of the entity body (response) isn't
known accurately until after the C/L filter runs. That's C/L's job, after all.
Flipping the order of the byterange and C/L filters fixes the invalid
Content-Range headers and 416's. But then the Content-Length header contains
the full length, rather than the sum of the returned ranges. That's wrong, but
doesn't seem too hard to fix.
Ryan Bloom [Mon, 22 Apr 2002 18:57:12 +0000 (18:57 +0000)]
Fix perchild MPM so that it can be configured with the move to the
experimental directory. Fix perchild MPM so that it uses ap_gname2id
for groups instead of ap_uname2id.
Small optimization, if we are behind (at the 5th segment, for example),
catch up the segment-count-sorted directory list without string compares.
Mostly affects win32 which jumps from seg 0 (root) to 4 for UNC path names.
AcceptPathInfo was totally backwards... it would reject when set to on and
by default and accept when set to off for the default handler, and would
reject only if set to accept for mod_cgi(d) and mod_isapi.
Brian Pane [Mon, 22 Apr 2002 04:48:11 +0000 (04:48 +0000)]
Skip a potentially heavyweight call to sysconf, plus some
local variable initializations, in the common case where the
request is not for the server status page
Bill Stoddard [Mon, 22 Apr 2002 03:25:40 +0000 (03:25 +0000)]
Added the APLOG_TOCLIENT flag to ap_log_rerror() to
explicitly tell the server that warning messages should be sent
to the client in addition to being recorded in the error log.
Prior to this change, ap_log_rerror() always sent warning
messages to the client. In one case, a faulty CGI script caused
the server to send a warning message to the client that contained
the full path to the CGI script. This could be considered a
minor security exposure.
Brian Pane [Sat, 20 Apr 2002 20:41:33 +0000 (20:41 +0000)]
Workaround to get leader/follower compiling on recent Linuxes:
apr_atomic.h includes some <asm/*.h> header files that clash
with stdlib.h, so I've moved apr_atomic.h so that it's included
after all the other header files.
Propogate the change to insert "bucket_" into the names of the
static functions that operate on various bucket types to make
backtraces more sensible-looking.
showstoppers+=2; :-( ...but these might have already been fixed, I just
never got a response on-list about them and wanted
to note them somewhere where they wouldn't be
forgotten
Paul J. Reder [Fri, 19 Apr 2002 19:16:23 +0000 (19:16 +0000)]
Moved the call to apr_mmap_dup outside the error branch so
that it would actually get called. This fixes a core dump
at init everytime you use the MMapFile directive. [Paul J. Reder]
Jeff Trawick [Fri, 19 Apr 2002 18:31:20 +0000 (18:31 +0000)]
Trigger an error when a LoadModule directive attempts to
load a module which is built-in. This is a common error when
switching from a DSO build to a static build.
SOCKETs are HANDLEs, but they type mismatch. This fix has now been
verified by the vast majority of folks complaining about the "Not a
handle" failures in WSADuplicateHandle, later in the code flow.
Jeff Trawick [Fri, 19 Apr 2002 14:04:30 +0000 (14:04 +0000)]
Change instdso.sh to use libtool --install everywhere and then
clean up some stray files and symlinks that libtool leaves around
on some platforms. This gets subversion building properly since
it needed a re-link to be performed by libtool at install time,
and the old instdso.sh logic to simply cp the DSO didn't handle
that requirement.
Submitted by: Sander Striker
Reviewed by: Jeff Trawick
Brian Pane [Fri, 19 Apr 2002 08:02:00 +0000 (08:02 +0000)]
Some code transformations to improve the generated assembly
code within the critical region inside the spin locks. (Shortening
this code path reduces the probability that we'll have to spin.)
Switch ap_http_filter to use ap_get_brigade and apr_brigade_flatten
instead of ap_getline - this prevents some odd looping issues that
can cause problems.
Also, when we call get_mime_headers to read the trailers, we need
to reset our ctx->state to BODY_NONE - there should only be MIME-header
information (followed by a blank CRLF line) - and we don't know
how much data there will be - so it is by definition BODY_NONE.
Simplify last commit by only calling cat once (this should hopefully resolve
rbb's concern about maintainability and still address mine about annoying /s).
Don't call mkdir when we are the top-level directory. We *have* to have
been created before hand.
Replace this bogus check with something that actually works. I have no
idea what this line is attempting to do, but it doesn't work in the
top-level Makefile - causing an error. Therefore, take the line we use
in APR to check if a file exists.
The pedant in me wishes to see all extraneous trailing / go away.
So, if we are in the top-level makefile, don't add an extra trailing
slash to srcdir, builddir, or VPATH. It's annoying.
Bill Stoddard [Wed, 17 Apr 2002 18:52:32 +0000 (18:52 +0000)]
Fix seg fault when garbage collecting an expired entry. remove_entity
should just remove the object from the cache and set the cleanup flag
in the object. decrement_refcount will clean the object up when the refcount
goes to zero.
Experimental patch that may mitigate (but not eliminate) the errors in
[crit] (32538)An operation was attempted on something that is not a socket.
: Parent: WSADuplicateSocket failed for socket ...
if the particular stacks' bug is that it won't associate a handle as a
socket if that handle was duped with DuplicateHandle(). Other bugs with
unimplemented WSADuplicateSocket are not addressed by this patch.
Introduced -E startup_logfile_name option to httpd to allow admins
to begin logging errors immediately. This provides Win32 users
an alternative to sending startup errors to the event viewer, and
allows other daemon tool authors an alternative to logging to stderr.
Jeff Trawick [Wed, 17 Apr 2002 15:45:27 +0000 (15:45 +0000)]
use an independent pool for threads so that when we abandon them
during graceless termination the cleanups on pchild won't mess with
stuff they are still referencing
Brian Havard [Wed, 17 Apr 2002 14:55:20 +0000 (14:55 +0000)]
When an exception in a worker thread initiates a child shutdown, get things
moving sooner by sending a SIGHUP to the accept thread, breaking it out
of its accept/poll.
Fix subreqs with non-defined Content-Types being served improperly.
If we do not know a C-T for a subreq, we *must* propogate that
non-knowledge upwards to the main request.
Previously, if you used a DirectoryIndex with a file without a C-T (say
.shtml without AddType), the r->content_type will be kept as
httpd/unix-directory when we promoted the subreq in mod_dir. Since there
would be no handler on this file, ap_invoke_handler (config.c:355) would
set the handler to be httpd/unix-directory (which was the old C-T of the
dir). This would then trigger the handler to become httpd/unix-directory.
mod_autoindex would then try to serve the request. But, the filename
was propogated upwards by mod_dir's DirectoryIndex via
internal_fast_redirect - it would then return a 403 trying to generate a
mod_autoindex page for a file.
Now, we will use ap_default_type() which is correct.
Tired of 'foo.h not found' messages in the build. Checked ms's docs,
seems xcopy's /y arg goes all the way back to Win95. This shouldn't
introduce any hassles.
Brian Pane [Tue, 16 Apr 2002 23:37:06 +0000 (23:37 +0000)]
Another experimental MPM derived from worker:
The threadpool MPM implements Aaron Bannert's "time-space tradeoff"
design managing idle workers. Rather than putting accepted connections
into a queue, the threadpool MPM keeps idle worker threads in a stack.
Its dedicated listener thread retrieves an idle worker from the stack
before accepting a connection. If there are no idle workers, the
listener blocks until a worker becomes available before doing an accept.
In many ways, threadpool is also a variant of leader/follower. They
both maintain a stack of idle threads. The difference is that threadpool
has a dedicated listener thread, and leader/follower rotates the listening
responsibility among its worker threads. In my initial testing, the
leader/follower MPM performs very well on multiprocessor Solaris 8 when
listening on a single port, but poorly when listening on multiple ports.
(I don't know why this is happening. What I've found so far is that
when you add a poll on the listen socket(s) before the accept in the
leader/follower MPM, all the socket-related syscalls in the httpd get
slower. My hypothesis is that the thread scheduler is making an optimal
decision about where (on what CPU) to run the newly awakened thread if
its first syscall is an accept, and a nonoptimal decision if its first
syscall is a poll.) The threadpool MPM performs better with multiple
listener ports, and in my testing so far it looks competitive with
leader/follower when running with a single listener.
Merge in latest GNU config.guess and config.sub files. Synchronize all
config.guess/config.sub files to be identical. Previously, we had three
different versions of the guess files - now they are the same.
I attempted to merge in ASF changes that were marked and still needed.
Please verify that these work on your platform. (Particular attention
is required for the IBM platforms.)
Part of PR 7818 stems from the fact that the bundled expat did not have an
included config.guess/config.sub. Therefore, it would take the config.guess
from the system. Icarus's autoconf/libtool is very old (2.13/1.3.5). The
machine that was used to roll 2.0.32 had a recent autoconf/libtool which
explains the behavior that Sander saw in the PR. Therefore, we now
explicitly provide a config.guess/.sub for the bundled expat so that
all of the versions are in sync. This should minimize configuration
problems.
pcre was using a config.guess that was imported when Brian made the 3.9
import. It did not have the Apache modifications, but seems to have
had the Darwin changes. Go figure. Sync it up as well.
PR: 7818
Obtained from: GNU FSF - ftp.gnu.org/gnu/config
worker is not the default Unix MPM. [This statement has been in the docs
ever since this was copy-and-pasted from the threaded MPM documentation,
and threaded *was* the default at one point.]
Move 100 - Continue support to the HTTP_IN filter so that filters
are guaranteed to support 100 - Continue logic without any
intervention.
This requires some reshuffling of the code in http_protocol.c so
that some static declarations are available early enough in the
code so that ap_http_filter can access them.
Note that we can not read the chunk until after (possibly) sending the
100.
Adds support for reading trailers on input by exporting get_mime_headers
to ap_get_mime_headers and calling it in the appropriate place in
ap_http_filter.
ap_send_error_response: reset r->output filters to the protocol filters.
The equivalent logic was deleted when request filters were renamed to
RESOURCE filters. This fixes the seg faults that sometimes happen on
daedalus after a bogus 416 HTTP response is generated.
In this case, includes_filter had found an <!--#include virtual > tag, and
sent a brigade representing the data before it down the filter chain. The
byterange filter generated the bogus 416. ap_send_error_response essentially
starts over with a new response, but it didn't do anything to clean up the
filter chain. So the same instance of the includes_filter got driven from the
top with the canned error text and and EOS bucket, which confused the heck
out of it. It inserted a sentinel from the original brigade into the
error page brigade, causing problems further down the filter chain.
would get a 400. RFC 2616 specifically allows for a "blank" host field.
The read_request code properly handled this, but the fix_hostname in
vhost.c would cause the 400. Now, simply return in fix_hostname when
we see a blank hostname rather than erroring out.