1
0
mirror of https://github.com/apache/httpd.git synced 2026-01-13 21:42:17 +03:00
Commit Graph

434 Commits

Author SHA1 Message Date
Yann Ylavic
8fb0b6f980 mpm_{prefork,worker}: follow up to r1635521.
Don't crash when there is no accept mutex (one listener => apr_proc_mutex_name(NULL)).

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1643179 13f79535-47bb-0310-9956-ffa450edef68
2014-12-05 07:57:57 +00:00
Yann Ylavic
4669bc745b mpm_event(opt), mpm_worker, mpm_prefork: follow up to r1635521, r1640161.
Retain num_buckets and max_buckets accross restarts so that we can determine
whether new buckets were allocated and set their idle_spawn_rate at the same
level as the existing ones (max).

Also, adjust ap_daemons_limit and ap_daemons_to_start lower bounds at mpm_run()
time, once num_buckets is available for the current generation (previously done
at check_config time, hence before num_buckets is computed, and then with the
previous generation's value).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1640763 13f79535-47bb-0310-9956-ffa450edef68
2014-11-20 16:26:04 +00:00
Yann Ylavic
fe1189c22f mpm_prefork: follow up to r1635521.
Avoid oddity on bucket_make_child_record overflow.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1640184 13f79535-47bb-0310-9956-ffa450edef68
2014-11-17 16:31:06 +00:00
Yann Ylavic
c5d85f6439 mpm_worker, mpm_prefork: follow up to r1635521.
Use one dedicated accept mutex per listeners bucket.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1640145 13f79535-47bb-0310-9956-ffa450edef68
2014-11-17 11:45:29 +00:00
Yann Ylavic
61d5a3c1ca MPMs, core: make duplicated listeners (SO_REUSEPORT) introduced in r1599531
less intrusive.

Submitted by: Yingqi Lu <yingqi.lu@intel.com>
Modified/Committed by: ylavic

Add ListenCoresBucketsRatio which is a configurable ratio between the number of
CPU cores (online) and the number of listeners buckets to create, defaulting to
zero (so that listeners buckets become an opt-in, ie. ncpus / ratio > 1).
This could also be made an opt-out by using the previous hardcoded value (8) as
default.

Make ap_close_listeners() act on all the listeners (including duplicated ones),
since the function is also called externally (eg. mod_cgid, mod_ssl_ct and
possibly any third party module) to cleanup opened descriptors when a process
is forked (the duplicated listeners are kept in a scoped/static variable).

Add ap_close_listeners_ex() to close a single bucket of listeners, used by the
children to close unused duplicates and internally by ap_close_listeners().

Make ap_duplicate_listeners() compute the number of buckets to be used, instead
of each MPM. This number is now based on the above ratio and will not change
unless asked to (given *num_buckets < 1, that is when the MPM does not run in
one-process mode nor after a graceful restart).

Remove some global variables (mpm_listen, enable_default_listeners) previously
used to communicate between MPMs and ap_listen, since ap_duplicate_listeners()
API can now be used to do so.
Also rename num_buckets as ap_num_listen_buckets, and prefix have_so_reuseport
with ap_ (both printed by ap_log_common(), hence kept global).
Detect ap_have_so_reuseport once only at startup.

Restore dummy_connection() as before r1599531 since sending POD signals should
not depend on the number of listeners buckets (there is still one single socket
receiving the connections).

For each MPM (concerned), move the bucket data (pod, listeners and eventually
accept mutex) into a struct and instanciate an array of them (sized by the
number of buckets), for each child to use its own data according to its bucket
index, and the parent to maintain the whole.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1635521 13f79535-47bb-0310-9956-ffa450edef68
2014-10-30 15:24:58 +00:00
Yann Ylavic
d2bec9df64 core: ensure that MPMs return an error on runtime failure and hence that
httpd's main process also exits with an error.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1629925 13f79535-47bb-0310-9956-ffa450edef68
2014-10-07 16:54:31 +00:00
Yann Ylavic
90d30c63e0 mpms: enforce assertion that unreachable code is not reached.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1629918 13f79535-47bb-0310-9956-ffa450edef68
2014-10-07 15:46:05 +00:00
Yann Ylavic
7d64b627e5 core: follow up to r1629909: ap_daemons_to_start can't be lower than 1 (not 0) for prefork either.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1629916 13f79535-47bb-0310-9956-ffa450edef68
2014-10-07 15:35:56 +00:00
Yann Ylavic
a527db4331 core: Use process scoreboard to store each child's listener bucket,
and silently adjust the configured number of processes/threads to
be above the computed number of listener buckets (depending on the
CPU cores).



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1629909 13f79535-47bb-0310-9956-ffa450edef68
2014-10-07 15:16:02 +00:00
Jan Kaluža
c2372b9ae3 prefork: Ignore SIGINT in child. This fixes race-condition in signals handling
when httpd is runnning on foreground and user hits ctrl+c. In this case, SIGINT
is sent to all children followed by SIGTERM from the main process, which
interrupts the SIGINT handler and leads to inconsistency (process freezes
or crashes).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1618555 13f79535-47bb-0310-9956-ffa450edef68
2014-08-18 07:43:43 +00:00
Yann Ylavic
5d05482970 Fixed unused "ap_listen_rec *lr;" in prefork_run().
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1602827 13f79535-47bb-0310-9956-ffa450edef68
2014-06-16 09:34:36 +00:00
Yann Ylavic
d2e9cc1e16 Mark all unused/duplicated/closed child listeners as inactive.
Fix unused "ap_listen_rec *lr;" in worker_run().


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1602826 13f79535-47bb-0310-9956-ffa450edef68
2014-06-16 09:28:01 +00:00
Yann Ylavic
9f9dc4c4d2 -MPMs prefork & worker: avoid segfault with SAFE_ACCEPT in ONE_PROCESS mode.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1601170 13f79535-47bb-0310-9956-ffa450edef68
2014-06-07 22:04:48 +00:00
Jim Jagielski
e91b9104df fix restart issues
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1600656 13f79535-47bb-0310-9956-ffa450edef68
2014-06-05 13:38:08 +00:00
Jim Jagielski
db0457b3b2 Break out common code to be share-able
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1599641 13f79535-47bb-0310-9956-ffa450edef68
2014-06-03 16:02:44 +00:00
Jim Jagielski
cdf5c0570f Now allow MPMs to call ap_log_common()
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1599603 13f79535-47bb-0310-9956-ffa450edef68
2014-06-03 15:25:59 +00:00
Jim Jagielski
c539206da2 Optimize w/ duplicated listeners and use of SO_REUSEPORT
where available.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1599531 13f79535-47bb-0310-9956-ffa450edef68
2014-06-03 13:07:29 +00:00
Stefan Fritsch
67fde08ec7 Fix usage of MOD_* variables for MPM modules
r1385216 broke building of mpm event with serf support. To fix,

* introduce APACHE_MPMPATH_INIT/FINISH similar to
  APACHE_MODPATH_INIT/FINISH to create modules.mk and add
  MOD_* vars to it.
* change APACHE_MPM_MODULE to only append to modules.mk, not
  overwrite
* add APACHE_MPMPATH_INIT/FINISH to all MPMs


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1395252 13f79535-47bb-0310-9956-ffa450edef68
2012-10-07 08:56:45 +00:00
Jeff Trawick
f5584db9a3 follow up to r1387633: use the right exit code depending on the error scenario
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1392850 13f79535-47bb-0310-9956-ffa450edef68
2012-10-02 11:33:34 +00:00
Joe Orton
ca557acd34 * server/mpm/prefork/prefork.c (child_main): Don't log errors for an
apr_pollset_add() failure if a graceful-stop has been signalled.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1387633 13f79535-47bb-0310-9956-ffa450edef68
2012-09-19 15:09:35 +00:00
Jeff Trawick
391e8e1645 fix child exit status in prefork after certain errors in
the child so that the parent resets the spawn rate to the
minimum

or:

mpm_prefork: Reduce spawn rate after a child process exits due to
unexpected poll or accept failure.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1363183 13f79535-47bb-0310-9956-ffa450edef68
2012-07-19 00:05:29 +00:00
Jim Jagielski
5caa336986 Move away from DEFAULT_REL_RUNTIMEDIR and use ap_runtime_dir_relative()
API

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1299718 13f79535-47bb-0310-9956-ffa450edef68
2012-03-12 15:45:03 +00:00
Joe Orton
fd967eab44 * include/httpd.h, server/mpm/*/*.h: Tidy up doxygen tree view by moving
private interfaces into a separate group.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1211490 13f79535-47bb-0310-9956-ffa450edef68
2011-12-07 16:06:16 +00:00
Stefan Fritsch
92e366007c Add lots of unique tags to error log messages
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1209766 13f79535-47bb-0310-9956-ffa450edef68
2011-12-02 23:02:04 +00:00
Stefan Fritsch
7d0348cd78 If a child is created just before graceful restart and then exits because
of a missing lock file, don't shutdown the whole server.

PR: 39311
Submitted by: Shawn Michael <smichael rightnow com>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1180742 13f79535-47bb-0310-9956-ffa450edef68
2011-10-09 23:10:12 +00:00
Jim Jagielski
427c85bd23 Cleanup effort in prep for GA push:
Trim trailing whitespace... no func change



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1174751 13f79535-47bb-0310-9956-ffa450edef68
2011-09-23 13:39:32 +00:00
Stefan Fritsch
d4e7fad995 Install signal handlers for crashes before detaching. Previously, there
was a time span where crashes would be neither visible on the console nor
logged in the error log.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1151234 13f79535-47bb-0310-9956-ffa450edef68
2011-07-26 20:37:49 +00:00
Stefan Fritsch
344dbd4e82 Reduce period during startup and restart where a successive signal may be lost
PR: 43696
Submitted by: Arun Bhalla <arun shme net>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1151233 13f79535-47bb-0310-9956-ffa450edef68
2011-07-26 20:36:56 +00:00
Stefan Fritsch
4b3f0aaf96 Log the deprecation warning at level info, not warn
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1137813 13f79535-47bb-0310-9956-ffa450edef68
2011-06-20 22:57:24 +00:00
Stefan Fritsch
5f2cf595f0 Fix search'n'replace error: Actually warn if MaxClients is used
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1137757 13f79535-47bb-0310-9956-ffa450edef68
2011-06-20 19:47:23 +00:00
Stefan Fritsch
6d8de2ff42 Rename MaxClients to MaxRequestWorkers which describes more accurately what
it does.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1137744 13f79535-47bb-0310-9956-ffa450edef68
2011-06-20 19:00:52 +00:00
Stefan Fritsch
c9fd2623da Introduce ap_(get|set)_core_module_config() functions/macros and use them
everywhere.

We know that the core module has module_index 0. Therefore we can save
some pointer operations in ap_get_module_config(cv, &core_module) and
ap_set_module_config(cv, &core_module, val). As these are called rather often,
this may actually have some (small) measurable effect.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1132781 13f79535-47bb-0310-9956-ffa450edef68
2011-06-06 21:26:56 +00:00
Jeff Trawick
462c69e0b5 Add child_status hook for tracking creation/termination of MPM child
processes.  Add end_generation hook for notification when the last
MPM child of a generation exits.

end_generation is implemented completely by core using the
child_status hook run by the MPM.

simple and mpmt_os2 MPMs don't currently run the child_status
hook, so neither hook is invoked with those MPMs.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1096609 13f79535-47bb-0310-9956-ffa450edef68
2011-04-25 21:21:22 +00:00
Jeff Trawick
3c0476fe50 Simplify the interface to ap_reclaim_child_processes() and
ap_relieve_child_processes(): instead of requiring the MPM
to implement an otherwise-useless hook, just use a callback
function.

As I don't expect third-party MPM devs are following our day
to day progress, the API changes are considered part of
yesterday's MMN change.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1087085 13f79535-47bb-0310-9956-ffa450edef68
2011-03-30 21:32:10 +00:00
Jeff Trawick
5e3ba7d3ee mpm_common.c implements a handful of config directives; the
related state has to be re-initialized to the default values
at pre-config time, but that was handled inconsistently by
the MPMs, resulting in unexpected behavior when some of the
directives were removed across restart

move that necessary initialization from the MPMs to common 
code run from core's pre-config; MPMs that need to override
defaults can do so by running after core's pre-config (the 
NetWare MPM now does that)

the DEFAULT_MAX_REQUESTS_PER_CHILD compile setting wasn't useful
enough to keep

the simple MPM wasn't consistent in which of these directives
were respected and which weren't, and that hasn't changed
(see procmgr.max_requests_per_child vs. ap_max_requests_per_child)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1086293 13f79535-47bb-0310-9956-ffa450edef68
2011-03-28 16:25:20 +00:00
Jeff Trawick
d1ac3fd574 some non-MPM code wants to see DEFAULT_PIDLOG, so liberate the
setting from the MPM-specific mpm_default.h

now visible again via httpd -V


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1086243 13f79535-47bb-0310-9956-ffa450edef68
2011-03-28 14:04:23 +00:00
Jeff Trawick
7be2d26631 consolidate logic to remove the pidfile in a new API,
ap_remove_pid(), related to existing ap_log_pid() and
ap_read_pid()

presumably this is useful to third-party MPMs as well


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1086224 13f79535-47bb-0310-9956-ffa450edef68
2011-03-28 13:35:08 +00:00
Jeff Trawick
cc2cf0624a SCOREBOARD_MAINTENANCE_INTERVAL is gone, except for some local
usage within the NetWare and OS/2 MPMs.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1085780 13f79535-47bb-0310-9956-ffa450edef68
2011-03-26 18:37:14 +00:00
Joe Orton
239188a96b * server/mpm/prefork/prefork.c (set_signals): Ignore SIGXFSZ; have a
write() beyond 2GB fail with E2BIG rather than killing the process
  in the now hopefully rare case of non-LFS file usage on LFS systems.

* server/mpm/worker/worker.c (set_signals): Likewise.
* server/mpm/event/event.c (set_signals): Likewise.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1084000 13f79535-47bb-0310-9956-ffa450edef68
2011-03-21 22:36:45 +00:00
Jeff Trawick
4487fa925a worker, event, prefork: Correct several issues when built as
DSOs; most notably, the scoreboard was reinitialized during graceful
restart, such that processes of the previous generation were not
observable.

Other noticeable ones:
* the generation number did not increment properly
* worker's check-config hook didn't detect startup properly,
  so messages about inconsistent directives could have been sent
  to the wrong place

max_daemons_limit wasn't tracked across restart, but as the scoreboard
was always cleared this was a non-issue.

Reinitialization of idle_spawn_rate, hold_off_on_exponential_spawning,
and maxclients-message-reported may or may not have been features,
but the big picture is that the behaviour shouldn't have differed.

These changes should have been part of r758185.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1078286 13f79535-47bb-0310-9956-ffa450edef68
2011-03-05 13:36:09 +00:00
Jeff Trawick
21a628f138 zap needless reinitialization of is_graceful on the 2nd
call of the open-logs hook


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1078285 13f79535-47bb-0310-9956-ffa450edef68
2011-03-05 13:09:12 +00:00
Jeff Trawick
3b75c26516 sanity check use of volatile in prefork, worker, and event
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1078170 13f79535-47bb-0310-9956-ffa450edef68
2011-03-04 22:12:21 +00:00
Jeff Trawick
60221bdd76 prefork in ONE_PROCESS mode:
child_main() called clean_child_exit() in almost all paths,
and returned to the caller in one infrequent path; just
call clean_child_exit() always


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1076454 13f79535-47bb-0310-9956-ffa450edef68
2011-03-02 23:17:22 +00:00
Jeff Trawick
4618019d69 prefork: store pid in scoreboard for ONE_PROCESS mode
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1076382 13f79535-47bb-0310-9956-ffa450edef68
2011-03-02 21:16:57 +00:00
Jeff Trawick
46bdc28bf4 fix some logging calls to include the server_rec
(and even the conn_rec in a couple of places)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1074871 13f79535-47bb-0310-9956-ffa450edef68
2011-02-26 15:32:01 +00:00
Joe Orton
4cb4c7437f * server/mpm/prefork/prefork.c (stop_listening, sig_term, restart):
Update mpm_state in the signal handlers such that it is correct in
  children during a graceful stop/restart too.

PR: 41743
Submitted by: Andrew Punch <andrew.punch 247realmedia.com>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1068389 13f79535-47bb-0310-9956-ffa450edef68
2011-02-08 13:47:23 +00:00
Stefan Fritsch
5ad5328aa3 Fix ap_mpm_query results:
AP_MPMQ_MAX_THREADS: Single threaded means one thread per child, not zero
AP_MPMQ_MAX_DAEMONS: Max # daemons by config is determined by MaxClients, not
                     ServerLimit


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1057045 13f79535-47bb-0310-9956-ffa450edef68
2011-01-09 22:47:33 +00:00
Eric Covener
b0c950bd71 PR#47782: compiled-in default for MaxConnectionsPerChild is 10,000 vs the
recommendations in the default conf and the manual.  

Principle of least astonishment says to use a baked-in value of zero until
an admin asks for processes to exit this way.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1031657 13f79535-47bb-0310-9956-ffa450edef68
2010-11-05 16:29:08 +00:00
Jeff Trawick
5860b7bef6 fix description of the change for PR43857; it is a work-around
for a reslist problem that isn't fixed in apr-util 1.3.x

Suggested by: jorton


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1021616 13f79535-47bb-0310-9956-ffa450edef68
2010-10-12 03:55:11 +00:00
Stefan Fritsch
a527986832 remove more unused variables
revove some obsolete comments

netware file is untested


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@982050 13f79535-47bb-0310-9956-ffa450edef68
2010-08-03 22:12:19 +00:00