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
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
Greg Ames
b3c397fadf worker/event MPMs: graceful-stop doesn't work if the listener thread is
waiting for an available worker thread.  PR 43081

Reported by: Paul Querna
Debugged by: Takashi Sato [takashi lans-tv.com]



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@668826 13f79535-47bb-0310-9956-ffa450edef68
2008-06-17 20:59:55 +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
Greg Ames
3a57782587 the cost of synchronized SMP proof updates far outweighs the value of having
100% accurate MaxRequestsPerChild.  
* it doesn't even count requests, it counts connections.  
* all it is is a number someone pulls out of a hat in an attempt to deal with
  resource leaks.  
i.e., no strong need for accuracy.  

atomic operations are relatively expensive and this is mainline code.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@558039 13f79535-47bb-0310-9956-ffa450edef68
2007-07-20 16:20:10 +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
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
Jeff Trawick
f81c6a1b44 remove a bit of useless code from worker and event MPMs
PR: 41193
Submitted by: Davi Arnaut <davi haxent.com.br>
Reviewed by: trawick


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@490030 13f79535-47bb-0310-9956-ffa450edef68
2006-12-24 14:52:06 +00:00
Ruediger Pluem
bdb52abd19 * Remove an unused variable and thus fix a compiler warning.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@483629 13f79535-47bb-0310-9956-ffa450edef68
2006-12-07 19:45:51 +00:00
Chris Darroch
9c4d3003b7 added APR_THREAD_FUNC on listener_thread() in event and worker MPMs
to match definition of apr_thread_start_t


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@465333 13f79535-47bb-0310-9956-ffa450edef68
2006-10-18 18:49: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
Chris Darroch
ab486bc088 On graceless shutdown or restart, send AP_SIG_GRACEFUL to all worker
threads so that any that are polling on Keep-Alive connections will
wake up and exit promptly.  Otherwise, on Linux, they wait until
poll()'s timeout interval completes, which is often too long for
the parent process; the parent issues SIGKILL before the child's main
thread manages to re-join all the worker threads.  PR 38737.

On Solaris, by contrast, the close_worker_sockets() function
successfully alerts all worker threads that they should exit quickly.
On Linux, this side-effect of one thread closing another's socket
doesn't occur; see:

http://bugme.osdl.org/show_bug.cgi?id=546

Also, expand on the placeholder in CHANGES regarding previous
cleanups to scoreboard.c and scoreboard.h in r404848 and r404849.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@409715 13f79535-47bb-0310-9956-ffa450edef68
2006-05-26 18:27:23 +00:00
Chris Darroch
b2ba96e340 Make the worker and event MPMs not touch the scoreboard when
handling a fork() failure.  The previous behaviour appears to have
been inherited from the prefork MPM, where is it appropriate.

The prefork MPM sets thread_limit to 1 and therefore each
child process has a single worker_score structure in the scoreboard's
array, i.e., ap_scoreboard_image->servers[slot][0].  In make_child(),
it sets this structure's status to SERVER_STARTING, and then does
a fork(); if the fork() fails, it resets the status to SERVER_DEAD.

The worker and event MPMs, by constrast, obviously use multiple
worker_score structures per child process.  They may also be
in use by worker threads from a previous generation at any particular
moment.  Therefore make_child() and the parent process in general
doesn't normally update them; make_child() doesn't set them all
to SERVER_STARTING before doing fork(), for example.

So, make_child() shouldn't set them to SERVER_DEAD if fork()
fails (and even if it should, it certainly shouldn't be just
updating the first one).



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@409693 13f79535-47bb-0310-9956-ffa450edef68
2006-05-26 16:26:52 +00:00
Nick Kew
691a99bd81 Initialise server generation (Chris Darroch)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@404850 13f79535-47bb-0310-9956-ffa450edef68
2006-05-07 21:03:39 +00:00
Greg Ames
0da0ca701b PR 39275. don't fork MaxClients worth of processes if child_init or fork() are
slow.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@399099 13f79535-47bb-0310-9956-ffa450edef68
2006-05-03 00:30:56 +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
Greg Ames
9f83736b37 decouple the two scoreboard full messages
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@394116 13f79535-47bb-0310-9956-ffa450edef68
2006-04-14 15:12:35 +00:00
Greg Ames
801bb0266a MaxClients isn't the only reason the scoreboard can fill up. another
reason should be fixed soon.

also add a comment to explain an obscure line of code.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@393868 13f79535-47bb-0310-9956-ffa450edef68
2006-04-13 17:53:04 +00:00
Garrett Rooney
b458b88d15 Make the worker and event MPMs support GracefulShutdownTimeout just like
the prefork MPM does.

Submitted by: Chris Darroch <chrisd pearsoncmg.com>
Ported to event MPM by: rooneg
Issue number: 38621

* server/mpm/worker/worker.c
  (ap_mpm_run): Make the graceful shutdown log message refer to the right
   signal, and respect the graceful shutdown timeout if there is one.

* server/mpm/experimental/event/event.c
  (ap_mpm_run): Ditto.

* CHANGES: Note change.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@377291 13f79535-47bb-0310-9956-ffa450edef68
2006-02-13 02:25:53 +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
Jim Jagielski
5d2fae4818 No functional change: simple detabbing of indented code.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@332305 13f79535-47bb-0310-9956-ffa450edef68
2005-11-10 15:05:51 +00:00
Jeff Trawick
ee3ff1a4a0 use Greg's cleaner fix for CAN-2005-2970
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@307221 13f79535-47bb-0310-9956-ffa450edef68
2005-10-08 00:10:02 +00:00
Jeff Trawick
a755909804 SECURITY: CAN-2005-2970 (cve.mitre.org)
worker MPM: Fix a memory leak which can occur after an aborted
connection in some limited circumstances.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@292809 13f79535-47bb-0310-9956-ffa450edef68
2005-09-30 16:34:25 +00:00
Colm MacCarthaigh
106fdaa568 Revert one part. I should have tested seperately. This line isn't neccessary.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@265519 13f79535-47bb-0310-9956-ffa450edef68
2005-08-31 16:04:25 +00:00
Colm MacCarthaigh
cef7ca9fe6 Actually allow the admin to set thread_limit higher than the default.
Also, initialise the first_ variables, since they are tested in the
set_ functions.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@265518 13f79535-47bb-0310-9956-ffa450edef68
2005-08-31 16:01:13 +00:00
Jim Jagielski
1df26ab1bb More getpid format fixes
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@265504 13f79535-47bb-0310-9956-ffa450edef68
2005-08-31 15:18:54 +00:00
Colm MacCarthaigh
36b3643d82 *how* did I mis-spell that.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@264104 13f79535-47bb-0310-9956-ffa450edef68
2005-08-29 09:38:33 +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
fec621ccba Implement a graceful-stop for the worker MPM. We close our listeners, and then
ask each child process to do the same. We then monitor until all children have
exited.

The change to ap_start_shutdown(void) to ap_start_shutdown(int) may look like
an external API change, but the function is defined static, and used only in
one place.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@241819 13f79535-47bb-0310-9956-ffa450edef68
2005-08-27 23:22:50 +00:00
Colm MacCarthaigh
cdb2935300 Implement "de-listening" in the worker MPM. Fixes PR28167. Comments in CHANGES
file also cover r239710-1. 



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@239740 13f79535-47bb-0310-9956-ffa450edef68
2005-08-24 19:37:46 +00:00
Jeff Trawick
002ca1448b downgrade the log level of a proc_mutex_unlock error message
when it occurs during restart; it isn't at all uncommon then
when SysV semaphores are used for the accept mutex

same logic already in place for two other mutex calls


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@179317 13f79535-47bb-0310-9956-ffa450edef68
2005-05-31 23:57:41 +00:00
Joe Orton
9d9b45ae5c * server/mpm/worker/worker.c (listener_thread): Create ptrans pool as
a child of pconf, to fix APR pool lifetime checks in apr_tables.c.

Submitted by: Joe Schaefer


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@170896 13f79535-47bb-0310-9956-ffa450edef68
2005-05-19 09:01:22 +00:00
Greg Ames
e06eaebac5 missed a couple.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@168649 13f79535-47bb-0310-9956-ffa450edef68
2005-05-06 20:37:05 +00:00
Greg Ames
5ceb57af0d worker and event mpms: transient thread creation errors shouldn't take down
the whole server.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@168182 13f79535-47bb-0310-9956-ffa450edef68
2005-05-04 20:00:23 +00:00
Greg Ames
20b9c89da5 the style police have been sleeping
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@160211 13f79535-47bb-0310-9956-ffa450edef68
2005-04-05 19:45:32 +00:00
Jeff Trawick
3e14f16867 worker MPM/mod_status: Support per-worker tracking of pid and
generation in the scoreboard so that mod_status can accurately
represent workers in processes which are gracefully terminating.

New child processes with worker MPM can take over slots of
individual threads within gracefully terminating processes.
Sometimes this is a problem (too many of these gracefully
terminating processes), so it is helpful to have mod_status
provide the information required to recognize these processes.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@156274 13f79535-47bb-0310-9956-ffa450edef68
2005-03-05 20:06:55 +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
Jeff Trawick
592750b026 worker MPM: Fix a problem which could cause httpd processes to
remain active after shutdown.

The problem occurred when a scoreboard entry currently
in use by an exiting child process was used for a new child
process.  At that point, the MPM forgot about the exiting
child process, so ap_reclaim_child_processes() wouldn't be
able to forceably terminate it.

(An exiting child process may *never* exit due to a stuck
or long-running request being handled on one of the threads.)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@109510 13f79535-47bb-0310-9956-ffa450edef68
2004-12-02 17:39:22 +00:00
Jeff Trawick
c940ea5b58 use existing directive name ThreadStackSize instead of
WorkerStackSize

as made obvious by: Brad Nicholes


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102975 13f79535-47bb-0310-9956-ffa450edef68
2004-03-15 23:08:41 +00:00
Jeff Trawick
cb5c3dd6fd Threaded MPMs for Unix and Win32: Add WorkerStackSize directive
to override default thread stack size for threads which handle
client connections.  Required for some third-party modules on
platforms with small default thread stack size.

This is also useful for trimming back the stack size on
platforms with relatively large default stack size in order to
conserve address space for supporting more threads per child.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102931 13f79535-47bb-0310-9956-ffa450edef68
2004-03-11 03:57:50 +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
b4a7810707 fix copyright dates according to the first checkin
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102587 13f79535-47bb-0310-9956-ffa450edef68
2004-02-08 13:52:12 +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
Jeff Trawick
7efcd3598e worker MPM: fix stack overlay bug that could cause the parent
process to crash.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102425 13f79535-47bb-0310-9956-ffa450edef68
2004-01-28 15:31:02 +00:00
Jeff Trawick
01da1159b3 Unix MPMs: Stop dropping connections when the file descriptor
is at least FD_SETSIZE.

That isn't a problem for most users (since poll() is widespread).
On old boxes where select() must be used by APR, APR needs to fail
operations that don't work with such fds.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102419 13f79535-47bb-0310-9956-ffa450edef68
2004-01-27 15:19:58 +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
92227a69f4 remove inadvertent commit of clumsy gdb workaround (sorry!)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102047 13f79535-47bb-0310-9956-ffa450edef68
2003-12-13 19:43:40 +00:00