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

379 Commits

Author SHA1 Message Date
Jeff Trawick
e0eb7d1eef Introduce a new set of APIs to allow MPMs to be proper modules instead
of integral parts which share global variables, functions, and macros
with the rest of httpd.

Converted now:
  prefork, worker, event, simple, WinNT*

*WinNT hasn't been built or tested, and relies on a hack to include the
WinNT mpm.h to disable Unixy MPM support routines in mpm_common.c


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@757853 13f79535-47bb-0310-9956-ffa450edef68
2009-03-24 15:43:59 +00:00
Jeff Trawick
65aa430597 Fix a crash with r742218 by calling apr_os_thread_put() properly.
(The first parameter to apr_os_thread_put() must be initialized, either to
NULL or to an existing apr_thread_t.)



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@743894 13f79535-47bb-0310-9956-ffa450edef68
2009-02-12 21:40:20 +00:00
Paul Querna
69f2fd40dc Add conn_rec::current_thread.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@742218 13f79535-47bb-0310-9956-ffa450edef68
2009-02-09 00:57:58 +00:00
Jeff Trawick
9a00245469 prefork: Fix child process hang during graceful restart/stop in
configurations with multiple listening sockets.

PR: 42829
Submitted by: Joe Orton, with some tweaking and testing from me



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@732451 13f79535-47bb-0310-9956-ffa450edef68
2009-01-07 20:00:56 +00:00
Jeff Trawick
23d6680301 Release the accept mutex after receiving the shutdown signal
in single-process mode.  (That isn't a critical step, but
neatness counts.)

Submitted by: rpleum



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@732421 13f79535-47bb-0310-9956-ffa450edef68
2009-01-07 18:37:18 +00:00
Jeff Trawick
136a5072c1 As jorton discovered, recent Linux kernels have a new tunable
setting for epoll that will trip up many prefork users.  Write
a log message instead of crashing.

PR: 46467

As rpluem notes, some Apache doc is in order.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@732414 13f79535-47bb-0310-9956-ffa450edef68
2009-01-07 18:22:07 +00:00
Paul Querna
a73acf02f6 API Cleanup in preperation for 2.4.x, make sure all exported functions or variables contain an ap_ prefix.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@722399 13f79535-47bb-0310-9956-ffa450edef68
2008-12-02 08:13:36 +00:00
Nick Kew
368d9bb335 Further unixd hacks to remove duplication between old-unixd and mod_unixd,
and get it working with old MPMS[1] + mod_unixd.  It's still an uneasy
split, as some modules (mod_cgid, suexec)[2] also use unixd.
More thinking+hacking due.

[1] Should be prefork/worker/event, but only worker is tested.
[2] cgid is OK, suexec is untested.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@711146 13f79535-47bb-0310-9956-ffa450edef68
2008-11-04 00:44:56 +00:00
Nick Kew
72119d92f5 Switch all unix MPMs to use drop_privileges hook (mod_unixd) for startup
and add a flag to prevent running without any module taking responsibility
for managing system privileges!


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@709993 13f79535-47bb-0310-9956-ffa450edef68
2008-11-03 00:46:54 +00:00
Paul Querna
a324a1d72f Remove all references to CORE_PRIVATE.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@645455 13f79535-47bb-0310-9956-ffa450edef68
2008-04-07 10:45:43 +00:00
Paul Querna
5fa2bbbdeb Remove ap_graceful_stop_signalled from all MPMs.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@645437 13f79535-47bb-0310-9956-ffa450edef68
2008-04-07 10:00:32 +00:00
Joe Orton
9b7914b51d * server/mpm/prefork/prefork.c (child_main): If apr_pollset_poll()
fails with EINTR and die_now has been set (indicating a graceful
  stop/restart), terminate the child quickly rather than re-entering
  poll().


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@613260 13f79535-47bb-0310-9956-ffa450edef68
2008-01-18 20:31:28 +00:00
Joe Orton
8b7ef86718 * server/mpm/prefork/prefork.c (child_main): Unlock the mutex before
terminating in the multi-listener poll error path.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@613252 13f79535-47bb-0310-9956-ffa450edef68
2008-01-18 20:12:31 +00:00
Joe Orton
e0f93beb56 * server/mpm/prefork/prefork.c (child_main): Stop processing new
connections if shutdown_pending is set, i.e. when SIGTERM is received
in single-proecss mode.

Submitted by: Garrett Rooney <rooneg apache.org>
PR: 38848


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@552029 13f79535-47bb-0310-9956-ffa450edef68
2007-06-29 20:54:01 +00:00
Joe Orton
0a0d324e07 Add alternative fixes for CVE-2007-3304:
* configure.in: Check for getpgid.

* include/mpm_common.h (ap_mpm_safe_kill): New prototype.

* server/mpm_common.c (reclaim_one_pid): Ensure pid validity before
calling apr_proc_wait().
(ap_mpm_safe_kill): New function.

* server/mpm/prefork/prefork.c, server/mpm/worker/worker.c,
server/mpm/experimental/event/event.c: Use ap_mpm_safe_kill() on pids
from the scoreboard, throughout.

* include/ap_mmn.h: Minor bump.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@551843 13f79535-47bb-0310-9956-ffa450edef68
2007-06-29 10:33:14 +00:00
Joe Orton
ada9c28dcf Revert r547987 ("svn merge -c -547987 .")
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@551835 13f79535-47bb-0310-9956-ffa450edef68
2007-06-29 09:31:11 +00:00
Joe Orton
f4fee126cc * server/mpm/prefork/prefork.c (reap_children),
* server/mpm_common.c (ap_wait_or_timeout): Remove dead code; NEED_WAITPID
has never been defined by the 2.x build system.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@551823 13f79535-47bb-0310-9956-ffa450edef68
2007-06-29 08:43:29 +00:00
Jim Jagielski
86f602beb2 PID table impl: parent process keeps a local table store of
Apache child process PIDs and uses that to check validity
of what's in the scoreboard.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@547987 13f79535-47bb-0310-9956-ffa450edef68
2007-06-16 21:29:24 +00:00
Joe Orton
d6c234ac4a * server/mpm/prefork/prefork.c (prefork_check_config): Remove unused variable.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@451297 13f79535-47bb-0310-9956-ffa450edef68
2006-09-29 14:03:13 +00:00
Jeff Trawick
743a621e8d Replace ap_get_server_version with ap_get_server_banner() and
ap_get_server_description().

High-level summary:

The full server version information is now included in the error log at
startup as well as server status reports, irrespective of the setting
of the ServerTokens directive.

Third-party modules must now use ap_get_server_banner() or 
ap_get_server_description() in place of ap_get_server_version().



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@440337 13f79535-47bb-0310-9956-ffa450edef68
2006-09-05 13:08:15 +00:00
Chris Darroch
e69f467709 Introduce a check_config phase between pre_config and open_logs,
to allow modules to review interdependent configuration directive
values and adjust them while messages can still be logged to the
console.

The open_logs phase is already used somewhat for this purpose by
certain MPMs (winnt, prefork, worker, and event) but only by forcing
their functions ahead of the core ap_open_logs() function, and
since this phase runs after the ap_signal_server function during startup,
it can not be used to generate messages on the console when restarting.

Add the check_config phase to mod_info and mod_example.

Handle relevant MPM directives during this phase and format messages
for both the console and the error log, as appropriate.  Bounds and sanity
checks on the values of the MPM directives are handled in sequence in
this phase instead of in the various directive handling functions, since
those functions (e.g., set_max_clients()) may not be called at all if their
directives do not appear in the configuration files, and even if they
are called, there is no guarantee that this will occur in any particular
order.

Remove from the worker and event MPMs the code in the pre_config phase
that alters the configuration node tree by re-ordering ThreadsPerChild
ahead of MaxClients.  This code is effective but insufficient; for
example, if ServerLimit follows MaxClients, the test against server_limit
in set_max_clients() is invalid.  (In practice, this only results in
incorrect or absent warnings on the console, because server_limit is
set to its configured value when the main loop re-runs the configuration
process.)

Prevent ap_threads_per_child from exceeding thread_limit in the
winnt, worker, and event MPMs.  This situation could occur if
ThreadsPerChild was not specified in the configuration files and
ThreadLimit was set to a value smaller than DEFAULT_THREADS_PER_CHILD,
because set_threads_per_child() would never be called and therefore
its bounds check against thread_limit would not be performed.

Remove from the winnt, prefork, worker, and event MPMs the
changed_limit_at_restart flag.  Set the first_server_limit and
first_thread_limit values during the first execution of the check_config
function, and use them to detect changes to ServerLimit and ThreadLimit
across restarts and issue appropriately formatted warnings.  Remove the
comments about the error log being a "bit bucket"; this was true when
the code was originally committed in r92530 but that was due to a bug
fixed in r92769.

Be consistent about setting all MPM configuration directive values in the
pre_config phase.

Rephrase and reformat the console and log file messages relating to
MPM configuration directives to be consistent across all MPMs.  Use
briefer messages when logging to the error log than to the console.

Update miscellaneous stale comments and messages (e.g., reference to
daemons_min_free in worker and event MPMs, "prefork open_logs" in
winnt MPM, and StartServers in netware MPM).

The winnt, netware, beos, and mpmt_os2 MPMs should be tested by developers
with access to those platforms, especially the winnt MPM, which has
unique logic with respect to distinguishing between parent and child
processes during the configuration phases.

Update the English documentation for the worker MPM's ThreadsPerChild
directive, which no longer needs to precede other MPM directives in the
configuration files if it has a non-default value.  The German (.de) and
Japanese (.ja) translations should be updated by developers fluent in
those languages.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@431460 13f79535-47bb-0310-9956-ffa450edef68
2006-08-14 22:55:45 +00:00
Roy T. Fielding
de659cbed0 update license header text
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@420983 13f79535-47bb-0310-9956-ffa450edef68
2006-07-11 20:33:53 +00:00
Joe Orton
b3f30e49c1 * server/mpm/prefork/prefork.c (child_main): Tag pchild.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@405721 13f79535-47bb-0310-9956-ffa450edef68
2006-05-10 11:51:41 +00:00
Colm MacCarthaigh
dd95d7c37c Update the copyright year in all .c, .h and .xml files
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@395228 13f79535-47bb-0310-9956-ffa450edef68
2006-04-19 12:11:27 +00:00
Jim Jagielski
5061d9fa92 No functional Change: Removing trailing whitespace. This also
means that "blank" lines consisting of just spaces or
tabs are now really blank lines


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@332306 13f79535-47bb-0310-9956-ffa450edef68
2005-11-10 15:11:44 +00:00
Colm MacCarthaigh
e92e109916 Remove some trailing spaces. Syncs with 2.2.x.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@293307 13f79535-47bb-0310-9956-ffa450edef68
2005-10-03 11:09:15 +00:00
Joe Orton
0fb1643049 * server/mpm/prefork/prefork.c: Add volatile qualifier to die_now
since it is changed by a signal handler.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@290124 13f79535-47bb-0310-9956-ffa450edef68
2005-09-19 11:54:52 +00:00
Colm MacCarthaigh
cc841a28e5 Initiliase all of the first_*_limit variables to zero, so that we can actually
raise limits beyond their defaults reliably. 



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@265523 13f79535-47bb-0310-9956-ffa450edef68
2005-08-31 16:10:55 +00:00
Jim Jagielski
d81de0d9b3 Add ap_append_pid(); This is performed enough to warrant
a function I think, especially with the fact that
the mapping of getpid() to APR_PID_T_FMT isn't
consistant in some areas. 


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@265506 13f79535-47bb-0310-9956-ffa450edef68
2005-08-31 15:22:08 +00:00
Colm MacCarthaigh
5a0531c52e Move the "GracefulShutdownTimeout" command definition into mpm_common
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@264103 13f79535-47bb-0310-9956-ffa450edef68
2005-08-29 09:28:27 +00:00
Colm MacCarthaigh
b4b88ed365 Re-add a simple, obvious, speed-up.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@241814 13f79535-47bb-0310-9956-ffa450edef68
2005-08-27 23:04:17 +00:00
Colm MacCarthaigh
04558bec28 Remove as many ghastly scoreboard loops from the graceful-shutdown code, and
replace with the new ap_relieve_child_processes() call. Add a sleep() call now,
as we lost the timeout inherent in ap_wait_or_timeout(). 1 second seems a sane
choice.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@240466 13f79535-47bb-0310-9956-ffa450edef68
2005-08-27 22:16:46 +00:00
Colm MacCarthaigh
d7c04b158c Move the "GracefulShutdownTimeout" directive into mpm_common, for re-use
with other MPM's.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@240296 13f79535-47bb-0310-9956-ffa450edef68
2005-08-26 17:43:24 +00:00
Colm MacCarthaigh
c6fb6c57d0 Implement a "graceful-stop" for the prefork MPM (might aswell do the hard one
first). 

General approach is to send SIGUSR1 to all children (which will de-listen, and
exit when finished), and to gather all children as they exit. 

We don't use a sleep(timeout) for the timeout implementation, because this
would lead to a rut of defunct children until the timeout had expired.

set_graceful_shutdown stolen from Ken Coar. See <3E84B1EC.3050007@Golux.Com>
(28 Mar 2003).



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@240270 13f79535-47bb-0310-9956-ffa450edef68
2005-08-26 16:09:54 +00:00
Colm MacCarthaigh
aacf3609d2 Implement "de-listening" for graceful restarts with the prefork MPM. With this
change;

  1.) httpd -k graceful sends SIGUSR1 to the parent pid, which in turn
      sends SIGUSR1 to all of the active children,

  2.) Active children each close their copy of listener fd's.

This means that the listening sockets are freed for re-use. In the ordinary
case, this makes no difference. However if for example admin changes "Listen
80" to "Listen 81" in the config, this rev makes port 80 immediately available
(no waiting for the graceful children to die).



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@239711 13f79535-47bb-0310-9956-ffa450edef68
2005-08-24 16:58:11 +00:00
Justin Erenkrantz
905cdf9f0b Update copyright year to 2005 and standardize on current copyright owner line.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@151408 13f79535-47bb-0310-9956-ffa450edef68
2005-02-04 20:28:49 +00:00
Joe Orton
d2e2c4e584 * modules/ssl/ssl_engine_kernel.c (ssl_callback_SSLVerify_CRL),
* server/log.c (ap_log_pid),
* server/mpm/prefork/prefork.c (accept_mutex_on, accept_mutex_off),
* support/htdbm.c (htdbm_list):
Fix some non-literal format strings (warnings from gcc -Wformat-security).

PR: 30585
Submitted by: Ulf Harnhammar (SITIC), Joe Orton


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@104548 13f79535-47bb-0310-9956-ffa450edef68
2004-08-11 14:25:30 +00:00
André Malo
aeed109950 the eight space tabs are harassing me.
:set tabstop=8
:retab
(no code changes)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@103348 13f79535-47bb-0310-9956-ffa450edef68
2004-04-11 23:55:10 +00:00
Justin Erenkrantz
7fbfdd72cd Improve helpfulness of error messages when accept mutex has a problem.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102957 13f79535-47bb-0310-9956-ffa450edef68
2004-03-14 19:08:07 +00:00
André Malo
eeb57c17ad fix name of The Apache Software Foundation
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102619 13f79535-47bb-0310-9956-ffa450edef68
2004-02-09 20:40:53 +00:00
André Malo
9090bb2ba8 fix copyright dates according to the first check in
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102585 13f79535-47bb-0310-9956-ffa450edef68
2004-02-08 13:45:34 +00:00
André Malo
4f02cb1e18 apply Apache License, Version 2.0
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102525 13f79535-47bb-0310-9956-ffa450edef68
2004-02-06 22:58:42 +00:00
Greg Ames
1dc72a2ff6 bump MAX_SERVER_LIMIT by 10x (hoping to stay ahead of Moore's Law for a little
while) since the current limit is too small for at least one high end site.

Submitted by: Colm MacCarthaigh [colm stdlib.net]


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102347 13f79535-47bb-0310-9956-ffa450edef68
2004-01-15 15:42:38 +00:00
André Malo
fb07607180 update license to 2004.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102135 13f79535-47bb-0310-9956-ffa450edef68
2004-01-01 13:26:26 +00:00
Jeff Trawick
fe30657ac4 fix the name of the failing API call in a log message
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102042 13f79535-47bb-0310-9956-ffa450edef68
2003-12-13 15:43:19 +00:00
Jeff Trawick
ef4b1b3de7 add new MPM query -- AP_MPMQ_MPM_STATE -- to find out what the MPM
is doing

work-in-progress; not so useful until other MPMs support it


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102019 13f79535-47bb-0310-9956-ffa450edef68
2003-12-10 20:45:09 +00:00
Jeff Trawick
0f5ba4e44d build with latest other-child API changes
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@101848 13f79535-47bb-0310-9956-ffa450edef68
2003-11-22 20:43:25 +00:00
Greg Stein
6ff23b5f80 Switch the prefork MPM over to the new pollset interface.
* server/mpm/prefork/prefork.c:
  (listensocks[]): removed. not required.
  (child_main): stop using listensocks[] in favor of an apr_pollset_t. if
    there is just one listener, then always refer to that listener's
    listen_rec for further processing, otherwise poll and pick up the
    listen_rec pointer from the polling structure's client_data. tweaked
    the round-robin for the new pollset API (and documented).
    cleaning: removed 'offset' which is obviated by the use of a pointer
      to a listen_rec. tighten the block-scope of several variables.
      switch to use a 'status' variable name rather than three separately
      named variables. rename n->numdesc to be more obvious.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@101799 13f79535-47bb-0310-9956-ffa450edef68
2003-11-16 23:03:18 +00:00
Jeff Trawick
de5a239b61 Fix uninitialized gprof directory name in prefork MPM.
PR:           24450
Submitted by: Chris Knight <Christopher.D.Knight@nasa.gov>
Reviewed by:  Jeff Trawick


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@101714 13f79535-47bb-0310-9956-ffa450edef68
2003-11-07 13:40:04 +00:00
Joe Orton
bc2aea49ab Prevent slow graceful restarts on some platforms:
* prefork.c (ap_mpm_run): Only make as many dummy connections as slots
used, not as many as slots are available.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@101513 13f79535-47bb-0310-9956-ffa450edef68
2003-10-22 11:38:46 +00:00