1
0
mirror of https://github.com/apache/httpd.git synced 2025-11-06 16:49:32 +03:00
Commit Graph

242 Commits

Author SHA1 Message Date
Jeff Trawick
d0f5240ca9 update leader, threadpool, and worker MPMs to return MPM state
from ap_mpm_query()


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102045 13f79535-47bb-0310-9956-ffa450edef68
2003-12-13 19:00:56 +00:00
Brian Pane
79a3c0c99b remove calls to the apr_proc_other_child_read function that no longer exists
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@101858 13f79535-47bb-0310-9956-ffa450edef68
2003-11-24 01:34:04 +00:00
Greg Stein
0ea3a6ccd9 Switch over to the new pollset API.
* server/mpm/worker/worker.c:
  (listener_thread): create and add sockets to the pollset using the new
    APIs. rearrange the round-robin a little bit to work with the new
    pollset return values.
    cleaning: get rid of an extraneous status variable. get rid of
      obsoleted round-robin code.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@101801 13f79535-47bb-0310-9956-ffa450edef68
2003-11-16 23:47:07 +00:00
Jeff Trawick
0024a03faa Lower the severity of the "listener thread didn't exit" message
to debug, as it is of interest only to developers.

PR:                9011


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@101165 13f79535-47bb-0310-9956-ffa450edef68
2003-09-05 19:36:26 +00:00
Jeff Trawick
3090c1b2c5 Fix a misleading message from the some of the threaded MPMs when
MaxClients has to be lowered due to the setting of ServerLimit.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@101160 13f79535-47bb-0310-9956-ffa450edef68
2003-09-05 16:50:22 +00:00
Cliff Woolley
a770ae9e77 Updated the various MPM's to use the new bucket_alloc_create_ex API
when necessary.  Which is to say that it's necessary in all cases except
for prefork, where the change to apr-util to have it use the allocator
from the pool passed in is already sufficient.

Reviewed by:	Jean-Jacques Clar, Sander Striker, Brad Nicholes


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@101122 13f79535-47bb-0310-9956-ffa450edef68
2003-08-28 05:54:44 +00:00
Bradley Nicholes
dc4cfa1640 Make sure that the global ap_max_mem_free is initialized along with the
other MPM globals whenever HTTPD is started or restarted.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@101117 13f79535-47bb-0310-9956-ffa450edef68
2003-08-27 22:33:12 +00:00
Jeff Trawick
457570612a consolidate code related to sig_coredump
a note on perchild:
  perchild exception handling was busted before this and is still busted
  the problem I noticed was that a client that exposes a segfault never
  gets its connection dropped and the parent never notices that the
  child process that segfaulted hasexited


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@99312 13f79535-47bb-0310-9956-ffa450edef68
2003-04-09 16:58:30 +00:00
André Malo
742af25096 finished that boring job:
update license to 2003.

Happy New Year! ;-))


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@98573 13f79535-47bb-0310-9956-ffa450edef68
2003-02-03 17:53:28 +00:00
Jim Jagielski
f63b988b92 Adjust the descriptions of these directives, avoid the child/process/thread
confusion.
PR:
Obtained from:
Submitted by:
Reviewed by:


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96558 13f79535-47bb-0310-9956-ffa450edef68
2002-08-28 18:48:07 +00:00
Jim Jagielski
e9851bb0ea Minor error log typo
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96463 13f79535-47bb-0310-9956-ffa450edef68
2002-08-21 13:32:16 +00:00
Ryan Bloom
2c94ecadce Bring Apache in line with APR's new poll implementation. This isn't
optimal, because it still uses the compatibility functions to make it
work, but it does work.  The next step will be to take the memory for
the pollsets under Apache's control.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96005 13f79535-47bb-0310-9956-ffa450edef68
2002-07-11 05:42:20 +00:00
Brian Pane
f545f26c8d replaced APR_USEC_PER_SEC division with the new time macros
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95959 13f79535-47bb-0310-9956-ffa450edef68
2002-07-04 22:41:48 +00:00
Sander Striker
62faca71e7 Add a new directive: MaxMemFree. MaxMemFree makes it possible
to configure the maximum amount of memory the allocators will
hold on to for reuse.  Anything over the MaxMemFree threshold
will be free()d.  This directive is usefull when uncommon large
peaks occur in memory usage.  It should _not_ be used to mask
defective modules' memory use.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95954 13f79535-47bb-0310-9956-ffa450edef68
2002-07-04 15:20:54 +00:00
Jim Jagielski
cb3975a65b Now that we have the functionality in apr, we can now have 2.0's
startup message regarding AcceptMutex (what we are using and what
the default is) "fully" match what is present in 1.3.
PR:
Obtained from:
Submitted by:
Reviewed by:


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95568 13f79535-47bb-0310-9956-ffa450edef68
2002-06-07 14:08:05 +00:00
Sander Striker
b1d454e981 Catch up with the apr_allocator_set_owner -> apr_allocator_owner_set renames
in APR.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95373 13f79535-47bb-0310-9956-ffa450edef68
2002-05-30 00:21:27 +00:00
Brian Pane
cc62268db9 Fix for the worker deadlock problem
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95270 13f79535-47bb-0310-9956-ffa450edef68
2002-05-24 19:50:58 +00:00
Jeff Trawick
0547e6e6e9 Add "-k start|startssl|restart|graceful|stop" support to httpd
for the Unix MPMs.  These have semantics very similar to the
old apachectl commands of the same name.

The use of stderr/stdout and exit status for error conditions
needs to be revisited.  For now it matches apachectl behavior.

Justin Erenkrantz got the ball rolling with this feature.  Some
of his support code was used unchanged.  Other code was shuffled
around and modified or rewritten.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95237 13f79535-47bb-0310-9956-ffa450edef68
2002-05-23 12:58:37 +00:00
Jeff Trawick
c871b41d3c stop using APLOG_NOERRNO in calls to ap_log_?error()
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95149 13f79535-47bb-0310-9956-ffa450edef68
2002-05-17 11:11:39 +00:00
Jeff Trawick
a07f9b83c8 wait for worker threads to exit even in graceless termination
(we already have code to make them exit sooner now)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94892 13f79535-47bb-0310-9956-ffa450edef68
2002-05-01 16:05:59 +00:00
Bill Stoddard
f6b612b4e8 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.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94889 13f79535-47bb-0310-9956-ffa450edef68
2002-05-01 15:06:44 +00:00
Justin Erenkrantz
8fb484861e Close sockets on worker MPM when doing a graceless restart. This should
resolve some segfaults see when doing such restarts.

(Justin tweaked the palloc/memset in favor of calloc.)

Submitted by:	Aaron Bannert
Reviewed by:	Greg Ames, Sander Striker, Justin Erenkrantz


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94886 13f79535-47bb-0310-9956-ffa450edef68
2002-05-01 07:15:39 +00:00
Aaron Bannert
03966a632c 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


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94840 13f79535-47bb-0310-9956-ffa450edef68
2002-04-28 22:13:32 +00:00
Brian Pane
6625520bac 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.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94830 13f79535-47bb-0310-9956-ffa450edef68
2002-04-28 05:28:18 +00:00
Aaron Bannert
23fa964736 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.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94824 13f79535-47bb-0310-9956-ffa450edef68
2002-04-28 01:45:00 +00:00
Jeff Trawick
767b98fcf5 back out ill-conceived attempt to fix a segfault during
graceless termination


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94700 13f79535-47bb-0310-9956-ffa450edef68
2002-04-18 17:46:20 +00:00
Jeff Trawick
3f449a651e 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


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94679 13f79535-47bb-0310-9956-ffa450edef68
2002-04-17 15:45:27 +00:00
Jeff Trawick
162a4d313d worker MPM: Fix a situation where a child exited without releasing
the accept mutex.  Depending on the OS and mutex mechanism this
could result in a hang.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94625 13f79535-47bb-0310-9956-ffa450edef68
2002-04-12 19:58:52 +00:00
Jeff Trawick
724abc113d Remind the admin about the User and Group directives when we are
unable to set permissions on a semaphore.

PR:    7812


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94541 13f79535-47bb-0310-9956-ffa450edef68
2002-04-08 16:57:06 +00:00
Jeff Trawick
d29493fa5b quiet a bogus gcc warning that crops up with -O2
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94443 13f79535-47bb-0310-9956-ffa450edef68
2002-04-05 02:23:02 +00:00
Jeff Trawick
20a1bf6862 worker MPM: add -DFOREGROUND option to use when you want
the parent process to run in the foreground

             (NO_DETACH is a special mode for running under
             programs like daemontools)

             the existing flag -DDEBUG turns on FOREGROUND
             now instead of NO_DETACH


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94441 13f79535-47bb-0310-9956-ffa450edef68
2002-04-05 00:18:14 +00:00
Jeff Trawick
8551f53a5b worker MPM:
Don't create a listener thread until we have a worker thread.  Otherwise,
in situations where we'll have to wait a while to take over scoreboard
slots from a previous generation, we'll be accepting connections we can't
process yet.

Don't let the listener thread clobber the scoreboard entry of the first
worker thread.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94420 13f79535-47bb-0310-9956-ffa450edef68
2002-04-03 15:47:59 +00:00
Jeff Trawick
cdb0212dd2 Allow worker MPM to build on systems without pthread_kill().
Submitted by:  Pier Fumagalli (and mangled by Jeff)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94417 13f79535-47bb-0310-9956-ffa450edef68
2002-04-03 13:10:56 +00:00
Jim Jagielski
70bb2575ea The old, legacy (and unused) code in which the scoreboard was totally
and completely contained in a file (SCOREBOARD_FILE) has been
removed. This does not affect scoreboards which are *mapped* to
files using named-shared-memory at all. This implies that scoreboards
must be based, at some level, on native shared memory (mmap, shm_open,
shmget, whatever), but the code has assumed that for quite awhile
now. Having the scoreboard be *based* on a file makes no sense today.

PR:
Obtained from:
Submitted by:
Reviewed by:


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94306 13f79535-47bb-0310-9956-ffa450edef68
2002-03-29 14:33:50 +00:00
Cliff Woolley
3e2ce19baf BUCKET FREELISTS
Add an allocator-passing mechanism throughout the bucket brigades API.

From Apache's standpoint, the apr_bucket_alloc_t* used throughout a given
connection is stored in the conn_rec by the create_connection hook.  That
means it's the MPM's job to optimize recycling of apr_bucket_alloc_t's --
the MPM must ensure that no two threads can ever use the same one at the
same time, for instance.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94304 13f79535-47bb-0310-9956-ffa450edef68
2002-03-29 08:17:26 +00:00
Jeff Trawick
97659630cc worker MPM:
get MaxRequestsPerChild to work again by allowing the main thread of
a child to be interrupted by one of the other threads in the process

this should get graceful termination to work after encountering one of
the various possible error conditions in the listener and worker threads


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94232 13f79535-47bb-0310-9956-ffa450edef68
2002-03-27 20:37:32 +00:00
Jeff Trawick
db1f8661e6 document yet another worker MPM glitch
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94117 13f79535-47bb-0310-9956-ffa450edef68
2002-03-22 03:43:22 +00:00
Jeff Trawick
61c0797041 remove some unnecessary, commented-out code; add a comment
about a use of signals


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94112 13f79535-47bb-0310-9956-ffa450edef68
2002-03-22 01:12:49 +00:00
Jeff Trawick
4867fb1974 Don't drop connections during graceful restart. Previously, worker
threads could exit even though there were connections waiting in the
queue.

Now, for a graceful restart the worker threads won't exit until they
are told that the queue has been drained and no more connections will
ever be added.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94106 13f79535-47bb-0310-9956-ffa450edef68
2002-03-21 19:12:54 +00:00
Jeff Trawick
d1122ee9cc graceful shutdown (no dropped connections) requires that the listener
go away before the workers...  introduce separate XXX_may_exit flags
for our different categories of threads so that a future fix for
graceful shutdown can terminate them in the right order

rename signal_workers() to signal_threads() and give it a parameter
so it knows whether or not termination should be graceful

this commit doesn't change the behavior in any noticeable way;  the
flags used to tell threads to go away are still set at about the same
time


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94095 13f79535-47bb-0310-9956-ffa450edef68
2002-03-21 16:31:39 +00:00
Jeff Trawick
533551f8a7 document a glitch that prevents complete graceful termination of the
process when one of the threads encounters a critical error


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94094 13f79535-47bb-0310-9956-ffa450edef68
2002-03-21 16:18:11 +00:00
Jeff Trawick
3289de6264 make the comment for the call to apr_signal_thread() a little more
correct about what it is going to do


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94091 13f79535-47bb-0310-9956-ffa450edef68
2002-03-21 16:06:51 +00:00
Jeff Trawick
5ffc63f688 don't log a failure of ap_queue_pop() at termination; it is
expected


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94068 13f79535-47bb-0310-9956-ffa450edef68
2002-03-21 03:40:23 +00:00
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