1
0
mirror of https://github.com/apache/httpd.git synced 2025-11-11 02:42:23 +03:00
Commit Graph

249 Commits

Author SHA1 Message Date
Jeff Trawick
c366452ca7 in a worker thread, don't dare try to process a connection if
ap_queue_pop() failed...  csd is not cleared by ap_queue_pop()
so checking csd is not helpful


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94067 13f79535-47bb-0310-9956-ffa450edef68
2002-03-20 23:29:13 +00:00
Jim Jagielski
730e99e461 Fold the compiled-in knowledge of the allowable AcceptMutex settings into
its help entry. Requires the use of a extern string rather than a function
call for the initialization to be valid in the macro (Thx to Jeff!).
In the meantime, bump down the error logging until we deal with true
default and configured setting information ala 1.3.

PR:
Obtained from:
Submitted by:
Reviewed by:


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94062 13f79535-47bb-0310-9956-ffa450edef68
2002-03-20 22:19:11 +00:00
Jeff Trawick
eada6f8255 no need to kill the scoreboard cleanup anymore on graceful
restart; the scoreboard is longer-lived
PR:
Obtained from:
Submitted by:
Reviewed by:


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94061 13f79535-47bb-0310-9956-ffa450edef68
2002-03-20 20:38:52 +00:00
Jeff Trawick
e8dc265c9a write a debug message to the log when we're stuck in the sicko state
of trying to take over scoreboard slots that aren't going to be released
(we could also be stalled while taking over slots if a thread in child
gracefully terminating is serving a long-running request)

update a comment describing the sicko state to remove any information
I'm not absolutely sure of


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94059 13f79535-47bb-0310-9956-ffa450edef68
2002-03-20 19:53:18 +00:00
Jim Jagielski
a65170a84c Bring 2.0 up to parity, a bit, with how much info we provide to
the admin regarding valid values for AcceptMutex. Should also
tell 'em what "default" actually maps to, but that can wait.

PR:
Obtained from:
Submitted by:
Reviewed by:


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94055 13f79535-47bb-0310-9956-ffa450edef68
2002-03-20 16:44:13 +00:00
William A. Rowe Jr
cec6d4b870 The pre_mpm hook creates server-lifetime objects (or at least, for the
generations across graceful restarts.)  They should use the process pool.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94039 13f79535-47bb-0310-9956-ffa450edef68
2002-03-20 05:58:21 +00:00
Jeff Trawick
ae65c40d8e 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.

PR:
Obtained from:
Submitted by:
Reviewed by:


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94031 13f79535-47bb-0310-9956-ffa450edef68
2002-03-20 03:54:25 +00:00
Jeff Trawick
f8827903aa 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


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94030 13f79535-47bb-0310-9956-ffa450edef68
2002-03-20 03:38:07 +00:00
Jeff Trawick
32fe8d097f be a little more specific in a thread-create error message
it is helpful to distinguish between a failure creating the
first thread (listener) vs. a failure creating one of n
worker threads


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94025 13f79535-47bb-0310-9956-ffa450edef68
2002-03-19 22:09:26 +00:00
Jeff Trawick
cfcab38a77 "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


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94024 13f79535-47bb-0310-9956-ffa450edef68
2002-03-19 21:31:04 +00:00
Jeff Trawick
80788ba82a get rid of unnecessary code to track the number of worker threads
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94017 13f79535-47bb-0310-9956-ffa450edef68
2002-03-19 17:56:57 +00:00
Jeff Trawick
67f3ac2762 prefork and worker:
after allocating a new scoreboard, make sure the right generation
is stored in the global score


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93998 13f79535-47bb-0310-9956-ffa450edef68
2002-03-18 18:12:43 +00:00
William A. Rowe Jr
d07e31f81f Simplify s/APR_OS_PROC_T_FMT/APR_PID_T_FMT/, apr_os_foo entities aren't
for external consumption.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93969 13f79535-47bb-0310-9956-ffa450edef68
2002-03-16 18:42:46 +00:00
Sander Striker
50ba0ce732 Update the mpms to call the new allocator/pools API
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93943 13f79535-47bb-0310-9956-ffa450edef68
2002-03-15 00:50:31 +00:00
Roy T. Fielding
845cbfd508 Update our copyright for this year.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93918 13f79535-47bb-0310-9956-ffa450edef68
2002-03-13 20:48:07 +00:00
Jeff Trawick
04bde59aaf failures on the accept mutex are common at restart time, so be smart
about the log level and use APLOG_DEBUG if we're restarting


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93720 13f79535-47bb-0310-9956-ffa450edef68
2002-03-05 21:18:07 +00:00
Jeff Trawick
152c269699 fix a typo in a log message... the message claimed that apr_proc_mutex_lock()
failed when actually it was apr_proc_mutex_unlock() which failed


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93719 13f79535-47bb-0310-9956-ffa450edef68
2002-03-05 21:01:24 +00:00
Jeff Trawick
da3ac1a6e5 skip the lock release if the lock obtain failed
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93718 13f79535-47bb-0310-9956-ffa450edef68
2002-03-05 20:51:50 +00:00
Jeff Trawick
610f8046a4 restart fixes for worker:
fix a segfault and a window in which we could miss joining
newly-created threads

we can't try to signal workers if the worker queue hasn't
been initialized (or we segfault)

make sure the start thread is done creating threads before
we try to join; otherwise we can just miss some of them and
not be able to clean them up properly


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93561 13f79535-47bb-0310-9956-ffa450edef68
2002-02-24 20:53:26 +00:00
Aaron Bannert
5e4fba9c6c Implement apr_proc_detach changes and allow -DNO_DETACH in the multi-process
mode to not "daemonize" while detaching from the controlling terminal.
This is necessary for Apache to work with process-management tools like
AIX's "System Resource Controller" as well as Dan Bernstein's "daemontools".

What this means is apache must _NOT_ be a process group leader if called
with the -DNO_DETACH flag.

Submitted from:     Jos Backus <josb@cncdsl.com>
Edited/Reviewed by: Aaron Bannert


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93535 13f79535-47bb-0310-9956-ffa450edef68
2002-02-21 18:52:28 +00:00
Jeff Trawick
a57a1a0c11 Convert the ap_queue_foo routines to return apr_status_t as appropriate.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93530 13f79535-47bb-0310-9956-ffa450edef68
2002-02-21 14:22:05 +00:00
Jeff Trawick
203edb6d82 zap an incorrect comment
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93528 13f79535-47bb-0310-9956-ffa450edef68
2002-02-21 11:20:01 +00:00
Aaron Bannert
0cff6e8f58 Implement new ScoreBoardFile directive logic. This affects how we
create the scoreboard's shared memory segment. We now have the best of
both worlds:

if config specifies ScoreBoardFile
  create name-based shared memory, errors are fatal
else /* we get to choose */
  create anonymous shared memory
  if ENOTIMPL
    create name-based shared memory from DEFAULT_SCOREBOARD
  else
    errors are fatal

This gives us the flexibility to have anonymous shared memory (on platforms
that support it) as well as name-based shared memory when third-party
programs want access to our scoreboard.

The ap_scoreboard_fname static variable is now owned by the scoreboard.c
file, and no longer by the MPMs. The MPMs MUST NOT set ap_scoreboard_fname
to a default, since that will override the default creation logic and
only allow name-based segments.

Submitted by:	Aaron Bannert
Reviewed by:	Justin Erenkrantz


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93434 13f79535-47bb-0310-9956-ffa450edef68
2002-02-15 20:48:19 +00:00
Aaron Bannert
c47efa9889 Retain signal handling in the worker MPM for the one_process case
(httpd with -DDEBUG, -X, or -DONE_PROCESS).

Fix -X, -DNO_DETACH, -DONE_PROCESS, etc. flags.

Tested on solaris w/ start/stop, restart, graceful, and with the
above debugging flags.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93403 13f79535-47bb-0310-9956-ffa450edef68
2002-02-14 02:48:19 +00:00
Brian Pane
481bad782c Performance optimization: updated the worker MPM to recycle
per-transaction pools instead of destroying them.  Based on
Ian's benchmark testing, this reduces CPU utilization by
about 1% on Solaris.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93386 13f79535-47bb-0310-9956-ffa450edef68
2002-02-13 04:49:55 +00:00
Greg Ames
9ad90284cd if a child detects a resource shortage on accept(), limit the rate of fork()s
to 1 per second until the situation clears up.

Inspired by: Martin Kraemer


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93366 13f79535-47bb-0310-9956-ffa450edef68
2002-02-11 23:20:16 +00:00
Ryan Bloom
1703da8e37 Remove all signal handling from the worker MPM's child processes. Instead,
we use the pipe of death for all communication between parent and child.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93358 13f79535-47bb-0310-9956-ffa450edef68
2002-02-11 04:56:10 +00:00
William A. Rowe Jr
89de6d1d1a Some compatibility fixes. Built yet untested, read three times through.
Please review and raise the flag if any of these introduce bad mojo.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93264 13f79535-47bb-0310-9956-ffa450edef68
2002-02-05 23:17:22 +00:00
Ryan Bloom
aedb317878 Not being able to bind to a socket is a fatal error. This makes all
MPMs treat it as such.  We now print a message to the console, and return
a non-zero status code.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93227 13f79535-47bb-0310-9956-ffa450edef68
2002-02-04 18:41:46 +00:00
Bill Stoddard
bd3d360392 Reintroduce the create_connection hook. This hook is required to enable
modules to completely take over all network i/o from the core.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93171 13f79535-47bb-0310-9956-ffa450edef68
2002-02-01 22:16:31 +00:00
Ryan Bloom
5cd5470300 Change the Windows MPM to only use the pre_mpm phase in the parent process.
The child processes use the child_init phase to reattach to the shared
memory.  This makes Windows work like Unix, which should make it easier
for module authors to write portable modules.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93119 13f79535-47bb-0310-9956-ffa450edef68
2002-01-30 22:35:57 +00:00
Jeff Trawick
90ffe9ae98 get rid of a bunch of warnings about unused variables
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93101 13f79535-47bb-0310-9956-ffa450edef68
2002-01-30 11:56:26 +00:00
Brian Pane
d33f04cab0 Added logic to the worker MPM to skip the poll before accept
if there's only one listener socket (based on the implementation
in the prefork MPM).  This also enables us to do single-listener
unserialized accept


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93096 13f79535-47bb-0310-9956-ffa450edef68
2002-01-30 06:33:18 +00:00
Bill Stoddard
4168820850 This patch restores most of Ryan's patch (11/12/2001) to remove the
client_socket from the conn_rec.  Diffs from Ryan's patch include:

- rename the create_connection hook to install_transport_filters
- move the point of invocation of the hook till after the call to
  after ap_update_vhost_given_ip to enable the hook to use vhost
  config info in its decision making.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93087 13f79535-47bb-0310-9956-ffa450edef68
2002-01-29 19:02:04 +00:00
Aaron Bannert
aa71fe9345 Take advantage of the new pre_config return value when apr_proc_detach
fails. I'll be making some changes to apr_proc_detach, and it will be
nice to be able to report runtime errors.

Tested on worker but the code changes are identical on other MPMs.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93069 13f79535-47bb-0310-9956-ffa450edef68
2002-01-29 02:41:46 +00:00
Aaron Bannert
d5fdaf9cfd The pre_config hook now takes a return value. This allows modules to
cause the server to bail out under error conditions.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93063 13f79535-47bb-0310-9956-ffa450edef68
2002-01-28 23:49:40 +00:00
Jeff Trawick
65c36405b6 zap an unintended (and incorrect) comment that slipped in with
the last commit; sorry!


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93057 13f79535-47bb-0310-9956-ffa450edef68
2002-01-28 00:49:04 +00:00
Jeff Trawick
7c1ce28ee1 fix the problem where a scoreboard init failure could leave
mod_cgid stranded

a pre_mpm hook can now return failures, so problems in
ap_create_scoreboard percolate back to a place where Apache
can exit cleanly


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93055 13f79535-47bb-0310-9956-ffa450edef68
2002-01-28 00:41:32 +00:00
Bill Stoddard
327e4989d5 Remove the create_connection hook and put the client_socket back into the
conn_rec. The create_connection_hook has a design flaw that prevents it
from making decisions based on vhost information.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93050 13f79535-47bb-0310-9956-ffa450edef68
2002-01-27 12:52:08 +00:00
Brian Pane
e2d9d72362 Fix for a segfault in the worker MPM during graceful shutdown:
The per-transaction pools in the worker MPM can't be children of
the listener thread's pool, because that pool may go out of scope
while some workers are still procesing requests using the transaction
pools.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92821 13f79535-47bb-0310-9956-ffa450edef68
2002-01-11 08:01:11 +00:00
William A. Rowe Jr
7e1113f913 This patch eliminated from the _SHARED_ segment of the scoreboard all
pointer math.  This is required for portable scoreboards.

  vhost becomes the 'vhost name string' so it now survives ap_generation
  clicks.  next was apparently never used.

  This patch also accounts for the changes to the apr_shm api, and gives
  Win32 the magic of a shared scoreboard.

  Breakage aplenty on non-win32 platforms, I suspect, but this radical
  surgery, and culling of unused functions, was really, really needed.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92791 13f79535-47bb-0310-9956-ffa450edef68
2002-01-10 00:28:00 +00:00
Jeff Trawick
57b42f96ac handle the disappearance of apr_lock_create_np() and
apr_proc_mutex_create_np() and the new parameter to
apr_lock_create() and apr_proc_mutex_create()


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92653 13f79535-47bb-0310-9956-ffa450edef68
2001-12-29 23:16:24 +00:00
William A. Rowe Jr
9d8903dc06 mpm_common.c did all this dirty work - cleans up a duplicate symbol error
from the OSX.1 build.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92648 13f79535-47bb-0310-9956-ffa450edef68
2001-12-29 17:36:17 +00:00
Aaron Bannert
9348edfc43 Clean up the error checking a little. Make sure we're comparing against
APR_SUCCESS instead of just non-zero. Add some new error checking/reporting.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92632 13f79535-47bb-0310-9956-ffa450edef68
2001-12-27 23:40:55 +00:00
Aaron Bannert
be7241632c Take advantage of the new usable apr_thread_exit().
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92622 13f79535-47bb-0310-9956-ffa450edef68
2001-12-27 17:06:40 +00:00
David Reid
a9eff7270c Add ap_os_killpg as well as unixd_killpg and beosd_killpg.
Move the worker MPM to use ap_os_killpg in place of unixd_killpg as
this makes it more portable.

Ryan notes that really we should be using the POD mechanism to
control death of the child processes, so this is temporary until
we have that change in place.  Note added to STATUS to that effect.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92598 13f79535-47bb-0310-9956-ffa450edef68
2001-12-25 12:24:14 +00:00
David Reid
f3184c2dbf unixd.h is included in mpm.h so shouldn't need to be included here as well.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92597 13f79535-47bb-0310-9956-ffa450edef68
2001-12-25 02:34:29 +00:00
David Reid
88b31284ff This allows platforms without the _NP locking palaver to build
the worker MPM.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92596 13f79535-47bb-0310-9956-ffa450edef68
2001-12-25 02:30:53 +00:00
David Reid
a547cce526 This fixes a segfault that showed up on BeOS and may catch other systems.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92581 13f79535-47bb-0310-9956-ffa450edef68
2001-12-23 13:56:49 +00:00
Jeff Trawick
7e0f4e43e1 Add directives to worker and preform MPMs so that the admin can set
the equivalent of HARD_SERVER_LIMIT/HARD_THREAD_LIMIT at startup.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92530 13f79535-47bb-0310-9956-ffa450edef68
2001-12-19 14:49:22 +00:00