The source of some ills ... there is no reason to keep going if the
scoreboard exists. I suspect this should be a general cleanup as well
[at the end of ap_create_scoreboard.] But calling ap_run_pre_mpm with
the process->pool should take care of a clobbered scoreboard shm on
graceful restart.
Jeff Trawick [Wed, 20 Mar 2002 03:54:25 +0000 (03:54 +0000)]
Make the listener thread stop accepting new connections and exit
cleanly at graceful restart time. This is a basic requirement of
reliable graceful restarts (the kind that won't drop connections).
This allows a future fix to make worker threads hang around until
they service all connections previously accepted by the listener
thread.
The old mechanism of doing a dummy connection to wake up the
listener thread in each old child process didn't work. It didn't
guarantee that (in the main thread) the byte was read from the pod
and global variables were set before the listener thread grabbed
the connection. It didn't guarantee that a child process in the
new generation didn't get some of the dummy connections.
Rather than burn extra syscalls adding a unique socket or pipe
to the poll set (and breaking single listen unserialized accept
in the same change), this uses a signal sent from the main thread
to the listener thread to break it out of the poll or accept.
(We don't worry about breaking it out of the optional mutex because
the child process holding the mutex will break out of poll/accept
and release the mutex, allowing a child blocked in the mutex to
get it. Eventually all children blocked in the mutex will come
out.)
Since the listener thread now exits reliably, the main thread
joins it.
Jeff Trawick [Wed, 20 Mar 2002 03:38:07 +0000 (03:38 +0000)]
get the start thread to exit when we have reached termination but
it is still trying to create worker threads
previously, after a non-graceful restart followed by a terminate
you could see a bunch of log messages showing the parent repeatedly
sending SIGTERM and finally SIGKILL to one or more children...
with this change, the sequence of messages should stop very soon
add a comment to start_threads() describing a current problem
Jeff Trawick [Tue, 19 Mar 2002 21:31:04 +0000 (21:31 +0000)]
"apachectl stop" shouldn't send the gracefully-terminate char down
the pod... the child processes need to know that it isn't a graceful
termination and they shouldn't wait for old connections to finish
Greg Stein [Tue, 19 Mar 2002 10:11:33 +0000 (10:11 +0000)]
The underlying change here was to add the new WebDAV/DeltaV methods
now that it has an RFC. At the same time, I revamped a good chunk of
the name <-> number mapping code in http_protocol.c
* add M_FOO constants for the new RFC 3253 (DeltaV) methods. label
where each of the builtin methods comes from.
* moved METHOD_NUMBER_FIRST/LAST from http_protocol.h into
http_protocol.c since they weren't used anywhere else and they
weren't namespace-protected.
* create register_one_method() and use it to insert all builtin
methods (at _init() time) and extended methods into the registry.
* add a lookup_builtin_method() to quickly map a method name to a
builtin method number.
* rebuild ap_method_number_of() to use the new lookup function.
* revamp ap_method_name_of() to use the registry to locate the name
for any method number. add a pool argument (no callers in the core
code needed to be updated)
* revamp make_allow() to deal with the new method numbers and all
extended methods.
* in mod_dav, use the new method numbers rather than registering the
DeltaV methods.
Jeff Trawick [Mon, 18 Mar 2002 18:24:55 +0000 (18:24 +0000)]
Fix a hang condition with graceful restart and prefork MPM
in the situation where MaxClients is very high but
much fewer servers are actually started at the time of the
restart.
The way we notify an entire generation to die at once is
changed so that we don't have to use the pod (and deal with
the ease of filling the kernel pipe buffer).
Brian Pane [Sun, 17 Mar 2002 17:35:39 +0000 (17:35 +0000)]
Performance fix for ap_ssi_get_tag_and_value: do a lightweight
scan through the tag value until/unless we reach a backslash
that necessitates the more complicated scanner loop. In cases
where there isn't a backslash in the tag value, this reduces
the overhead of the scan from 5 comparisons per character to 3.
Clear up a const warning, and recognize some arrays by changing the
variable names to the plural [rather than aszFoo, which I hope continues
to be cleaned up as folks have time.]
Brian Pane [Sun, 17 Mar 2002 06:31:22 +0000 (06:31 +0000)]
Another optimization for find_end_sequence: once we're in the
middle of parsing a tag, consume the entire tag in a quick loop,
rather than jumping back to the outer state-machine loop for
each character
Brian Pane [Sun, 17 Mar 2002 05:13:12 +0000 (05:13 +0000)]
Use the "recent time" cache to optimize timestamp generation for
the httpd error log
Background: According to some profile data that we collected on Solaris,
half the run time of ap_log_rerror() was spent in localtime(3). With
this change, the recent-time cache ensures that the error logger won't
cause more than one localtime() call per second, no matter how high the
error rate is.
Lost the prior log message ... [this is an empty commit]
Prior revision fixes the last ap_server_root_relative() NULL return
code potential segfaults. It also quits trying to server_root_relative
a logging pipe, since log pipes generally take arguments. However, it
ignores the PassPhraseDialog exec: since the argument to that shell
mechanism is the server name itself.
Eliminate potential ap_server_root_relative segfaults, with the input
of Jeff Trawick's style changes to the first patches. Doesn't include
the fixes to ssl [more complex], and we won't trap errors that involve
ap_serverroot, since we presume that was normalized on the way in.
Therefore, testing ap_server_root_relative(DEFAULT_FOO) cases
should never become necessary.
A coworker discovered that really bogus path names segfault the server
on Win32. ap_server_root_relative() doesn't have an apr_status_t result,
so we are limited in what we can figure out - but 99.99% of the time,
the file's path is just plain bogus.
Jeff Trawick [Fri, 15 Mar 2002 15:16:27 +0000 (15:16 +0000)]
Factor out a bunch of commonality between the HAVE_TIMES path and
the !HAVE_TIMES path. This will help avoid future errors similar
to the ones fixed earlier today.
The code change also has the benefit of getting the paren-matching
feature of some editors to work properly.
Jeff Trawick [Fri, 15 Mar 2002 13:35:42 +0000 (13:35 +0000)]
Allow URIs specifying CGI scripts to include '/' at the end
(e.g., /cgi-bin/printenv/) on AIX and Solaris (and other OSs
which ignore '/' at the end of the names of non-directories).
Aaron Bannert [Thu, 14 Mar 2002 18:54:20 +0000 (18:54 +0000)]
This was fixed last week but I didn't notice the bug report or the STATUS
entry until today. The bug report had to do with recursively removing
all CVS directories from a person's home directory.
Aaron Bannert [Thu, 14 Mar 2002 17:18:33 +0000 (17:18 +0000)]
Fix a comment about the /<target> appended to config.layout variables
postpended with a '+' character. We don't currently support --target
(and as Thom pointed out, --target means something completely different
to Autoconf). Also change the default for '+' replacement to 'apache2'
so 1.3 and 2.0 can coexist on such distributions.
Doug MacEachern [Thu, 14 Mar 2002 07:04:10 +0000 (07:04 +0000)]
PR:
Obtained from:
Submitted by:
Reviewed by:
fix bug in ssl_io_input_getline():
in most cases we get all the headers on the first SSL_read.
however, in certain cases SSL_read will only get a partial
chunk of the headers, so we now try to read until LF is seen.
bug seen with netscape client (running both on linux and win32) and
server running on win32.
My [sixth?] major revamp of service.c. Traded an event for a mutex
to the service_init completion, expanded timeouts, moved SERVICE_STOPPED
message posting to the main thread since sometimes, in odd cirumstances,
our SCM thread wasn't resumed prior to termination, and ripped the code
for the stderr logs to use nt_eventlog.c instead. And generally tried
to make the code just a little bit more grokable [as if such a thing
is really possible.]
Now that we test ownership of the listeners in listen.c, -k "start"
can no longer hang on to the listeners after it checks that they are
free. Also, we cannot be checking listeners if we are using -k "config"
to alter the service config, since the service might be running as we
try this, and we cannot check the listeners in -k "restart", since we
are pretty certain they are owned by the running service we are about
to try restarting..