Cliff Woolley [Mon, 6 May 2002 03:10:24 +0000 (03:10 +0000)]
Added an optional function (ap_register_rewrite_mapfunc) which allows
third-party modules to extend mod_rewrite's "int:" internal RewriteMap
functionality.
Cliff Woolley [Mon, 6 May 2002 01:10:24 +0000 (01:10 +0000)]
grr... mod_mem_cache didn't take kindly to that constness fix. So I'm
reverting it and will just have to live with the warning for now. FirstBill,
what's The Right Way to fix this? Should we drop all the const qualifiers
in there, or should cache_hash_set() return a const void * and mod_mem_cache
should cast away the const, or what?
Cliff Woolley [Sun, 5 May 2002 22:28:03 +0000 (22:28 +0000)]
Fix compile break:
mod_mem_cache.c: In function `cleanup_cache_mem':
mod_mem_cache.c:251: too many arguments to function `cache_hash_first'
make[4]: *** [mod_mem_cache.slo] Error 1
Bill Stoddard [Sat, 4 May 2002 19:54:39 +0000 (19:54 +0000)]
Introduce a dedicated cache hash adt that does not rely on pools. This
cures a storage leak when garbage collecting expired entries out of the
hash table. cache_hash is just apr_hash with some of the function removed
and reimplemented to use malloc/free in place of apr_pool calls.
We can't specify it in DISTCLEAN_TARGETS because it is a directory.
Perhaps we could modify DISTCLEAN_TARGETS to delete dirs too, but
that's outside the scope of what Thom (or I) want to deal with now.
Submitted by: Thom May <thom@planetarytramp.net>
Reviewed by: Justin Erenkrantz
By using _setn instead of _set, this call is setting a pointer to a stack variable
in the hash entry. Once initialize_module() returns, the key pointer in the
hash entry is invalid. This causes a fault the next time that the hash entry
key is checked. Calling the _set() version will store a copy of the key which
has the same lifetime as the hash table entry.
Brian Pane [Thu, 2 May 2002 03:19:44 +0000 (03:19 +0000)]
Performance fixes:
* eliminate some copying of sub-parts of the content type in analyze_ct()
* take advantage of the fact that we know the lengths of those sub-parts
in find_ct() to avoid having to recompute their length for concatenation
The charset handling code needs the same type of optimization eventually.
Paul J. Reder [Wed, 1 May 2002 19:28:52 +0000 (19:28 +0000)]
Fix a case where an invalid pass phrase is entered and an
error message is given, but the prompt is not shown again.
This left the user in an ambiguous state.
Bill Stoddard [Wed, 1 May 2002 15:06:44 +0000 (15:06 +0000)]
Defer starting the listener until we have at least tried to start all the worker
threads. We want to get the workers in the pool of available threads ASAP
to keep perform_idle_server_maintenance from thrashing and starting too
many processes prematurely. The code before this patch would dribble workers
into the worker pool over an extended period of time and this prevented
perform_idle_server_maintenance from accurately deciding when new processes
were needed.
Readjusting how the bucket alloc is done for each worker thread. Allocate
the bucket once per thread rather than on every request. This change
increases our performance significantly.
SHMCB should not have been using apr_rmm -- it was doing so incorrectly,
for one thing. But it just plain doesn't need it. Rip it out to avoid
segfaulting.
Bill Stoddard [Tue, 30 Apr 2002 03:25:12 +0000 (03:25 +0000)]
Enable mod_mem_cache to be configured to cache open file handle using new
directive option: CacheEnable fd / will enable caching fds. If for some
reason the fd cannot be cached, the directive will effectively morph into
CacheEnable mem /
Should correctly build mod_ext_filter, mod_deflate dependant upon zlib,
and change the license-add code for openssl+zlib based on the newest
changes to a global LICENSE for all bundled components.
Brian Pane [Mon, 29 Apr 2002 01:57:39 +0000 (01:57 +0000)]
Removed some code from the mutex-protected block in ap_queue_pop().
If the worker thread synchronization is working properly, it's not
necessary to set these fields to NULL after removing an element from
the queue, and it's IMO more important to have a shorter code path
leading up to the mutex_unlock. I left in support for NULLing the
fields when debugging, though.
Brian Pane [Mon, 29 Apr 2002 01:03:17 +0000 (01:03 +0000)]
Because mod_imap's handler runs on every request in the default
configuration, rearrange the code to keep it from allocating a few
pages worth of local variables on the stack on requests that don't
use imagemaps
Rename the worker_stack_interrupt_all() function as worker_stack_terminate().
Also, broadcast a signal after we set the terminate flag on the worker stack.
Brian Pane [Sun, 28 Apr 2002 23:12:35 +0000 (23:12 +0000)]
Removed the "not_full" condition variable and associated conditional
logic from the file descriptor queue, now that we can rely on the
idle worker reference count to keep the listener from trying to
push connections into a full queue
Reviewed by: Aaron Bannert (concept)
- Add a "state" variable to the worker_wakeup_info struct. This is
used to make sure that we act on the correct signal, and to know when
to shut down a worker thread.
- Fix the call when the worker thread waits for a connection to use
the new state variable and use mutexes around the cond_wait() call.
- Change the interrupt_all() call to set the WORKER_TERMINATED state.
- Add two AP_DEBUG_ASSERT() to make sure that we aren't waking up
a worker thread before it is idle.
- We don't need the listener_blocked flag, just check if the element
we're adding makes the stack non-empty.
- When we are terminated, return APR_EOF; catch this event in the
worker thread and the listener thread.
- When shutting down, always signal a potential listener thread.
- Wait to signal the listener thread until after we add the worker
element to the stack.
Detect APR_EINTR from ap_queue_pop() and avoid calling
ap_queue_info_set_idle() more than once at a time per worker thread.
This fixes an assert coredump.
Submitted by: Aaron Bannert
Reviewed by: Brian Pane
When we signal a condition variable, we need to own the lock that
is associated with that condition variable. This isn't necessary
for Solaris, but for Posix it is.
If a subreq added a filter (say INCLUDES) and the subreq was promoted via
fast_redirect, the filter would still point at the subreq - rather than
the original r. So, we must update any filters pointing at rr to be r.
This would cause lots of problems with mod_include with mod_dir requests
such as seen in PR 7966. mod_include would be unsetting the headers_out
of rr instead of r. But, we disassociate rr->headers_out and r->headers_out.
Therefore, the C-L header in r->headers_out would remain - even though it
bears no relation to what we will be outputting - causing problems.
This also now permits chunked-encoding of mod_dir/mod_include requests
which could never happen before and fixes the content-length problem
seen in PR 7966.
As hinted at in PR 7966, there is a race condition - if for some reason
the server stalls reading an included file (or even better, placing a
sleep in the cgi-bin script!), the invalid C-L may get propogated to the
client.
(Note that internal_internal_redirect has this same code fragment.)
Brian Pane [Sun, 28 Apr 2002 05:28:18 +0000 (05:28 +0000)]
Moved the recycled pool list from the queue to the queue_info structure.
The advantage of doing this is that it enables us to guarantee that the
number of ptrans pools in existence at once is no greater than the
number of worker threads, and that we'll never have to delete ptrans
pools.
Modify the worker MPM to not accept() new connections until
there is an available worker thread. This prevents queued
connections from starving for processing time while long-running
connections were hogging all the available threads.
Add a "queue_info" structure to the worker MPM. This is used to prevent
the listener thread from accept()ing more connections than there are
available workers. This prevents long-running requests from starving
connections that have been accepted but not yet processed.
The queue_info is a simple counter, mutex, and condition variable. Only
the listener thread blocks on the condition, and only when there are no
idle workers. In the fast path there is a mutex lock, integer decrement,
and and unlock (among a few conditionals). The worker threads each notify
the queue_info when they are about to block on the normal worker_queue
waiting for some connection to process, which wakes up any sleeping
listener thread to go perform another accept() in parallel.
After review and testing against all of the PSDK examples (see
http://www.apache.org/~wrowe/ for commentary on building the
examples and making them work) ... this disable-optimization
should no longer be required.
Added a check to make sure that h_aliases is not NULL before we try to
dereference it in the for(...) loop. Attempting to dereference a NULL pointer
was causing a fault if there were no aliases found.
Graham Leggett [Fri, 26 Apr 2002 21:54:38 +0000 (21:54 +0000)]
Apply a patch to compile cleanly again against changes to the shared memory
implementation in APR.
PR:
Obtained from:
Submitted by: Eduardo Garcia Lopez <egarcia@stream18.com>
Reviewed by: