1
0
mirror of https://github.com/apache/httpd.git synced 2026-10-23 22:49:01 +03:00
Commit Graph

339 Commits

Author SHA1 Message Date
Yann Ylavic
afea2aad65 mpm_worker: no mutex needed at ptrans' allocator level.
(reverts r1783808)



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1783895 13f79535-47bb-0310-9956-ffa450edef68
2017-02-21 14:24:14 +00:00
Yann Ylavic
f46d03312e MPMs unix: Place signals handlers and helpers out of DSOs to avoid
a possible crash if a signal is caught during (graceful) restart.
PR 60487.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1783849 13f79535-47bb-0310-9956-ffa450edef68
2017-02-21 09:07:42 +00:00
Yann Ylavic
5b8c9f7a26 mpm_worker: follow up to r1783755.
Use a mutex for ptrans' allocator to be safe with concurrent
creation and destruction of its subpools, like with mod_http2.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1783808 13f79535-47bb-0310-9956-ffa450edef68
2017-02-20 22:49:05 +00:00
Rainer Jung
d79b514c4b Fix spelling in comments and text files.
No functional change.
PR 59990


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1756038 13f79535-47bb-0310-9956-ffa450edef68
2016-08-11 19:50:02 +00:00
Yann Ylavic
7932f3c76b Follow up to r1737447: fix max_spare_threads lower bound.
Suggested by: Rick Houser <rick.houser jackson.com>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1750218 13f79535-47bb-0310-9956-ffa450edef68
2016-06-25 18:56:28 +00:00
William A. Rowe Jr
160eef0a0c Ensure http2 follows http in the meaning of
status WRITE (meaning 'in the request processing
  phase' even if still consuming the request body,
  not literally in a 'now writing' state).

  Ensure a number of MPMs and the h2 connection io
  no longer clobber the request status line during
  state-only changes.  While at it, clean up some
  very ugly formatting and unnecessary decoration,
  and avoid the wordy _from_conn() flavor when we
  are not passing a connection_rec.

  Ensure the useragent_ip is only used in the case
  where it has been initialized, fall back on the
  connection's remote_ip if the status is accidently
  updated from an uninitialized request_rec.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1741310 13f79535-47bb-0310-9956-ffa450edef68
2016-04-27 18:41:49 +00:00
Yann Ylavic
f2c1d8931b mpm_worker: follow up to r1737449.
Same spurious (duplicated) local variable removal, this time for mpm_worker.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1737451 13f79535-47bb-0310-9956-ffa450edef68
2016-04-01 22:59:21 +00:00
Yann Ylavic
bfff244e51 mpm_event, mpm_worker: No functional change.
Remove one spurious (duplicated) local variable and split some long lines.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1737449 13f79535-47bb-0310-9956-ffa450edef68
2016-04-01 22:51:11 +00:00
Yann Ylavic
59d1e2aa8e mpm_event, mpm_worker: Fix computation of MinSpareThreads' lower bound
according the number of listeners buckets.

We want the number of children processes to be a multiple of the number of
buckets so to optimally accept connections (the system will distribute them
accross all the buckets/listeners anyway, thus children must follow).

For MinSpareThreads, this means that we need neither more nor less than one
thread above 'threads_per_child * (num_buckets - 1)' to achieve this, since
each created child adds threads_per_child workers.

Actually, given that perform_idle_server_maintenance() is called per bucket,
and hence checks 'threads_per_child / num_buckets' for one bucket, let's lower
bound MinSpareThreads to 'threads_per_child * (num_buckets - 1) + num_buckets'.

Previously we used 'threads_per_child * num_buckets' which caused one spurious
child to be created from the very first busy worker thread of each newly added
child.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1737447 13f79535-47bb-0310-9956-ffa450edef68
2016-04-01 22:18:58 +00:00
Yann Ylavic
9ed858cd50 mpms: follow up to r1629925: more error reports.
Failing to setup (or no) listeners is also an error.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1733173 13f79535-47bb-0310-9956-ffa450edef68
2016-03-01 22:29:50 +00:00
Yann Ylavic
4beeb250a5 mpms: follow up to r1629925: more error reports.
We want to be able to distinguish errors from stops to exit() with non-zero.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1733162 13f79535-47bb-0310-9956-ffa450edef68
2016-03-01 22:02:14 +00:00
Yann Ylavic
43d45b073d Revert changes on mpm_event and mpm_worker from r1711479.
The POD is not used in one process mode for those MPMs.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1733064 13f79535-47bb-0310-9956-ffa450edef68
2016-03-01 13:38:18 +00:00
Rainer Jung
fad21a6dbc Join multi-line MPM startup log messages into
single long lines.

Followup to r1725394 and r1725548.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1731929 13f79535-47bb-0310-9956-ffa450edef68
2016-02-23 19:03:00 +00:00
Rainer Jung
0eddea67ac Added some more log numbers to log statements that
had none.

Those were not detected by the coccinelle script.
Only a few hard cases are remaining now.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1725548 13f79535-47bb-0310-9956-ffa450edef68
2016-01-19 15:43:17 +00:00
Rainer Jung
496a614645 Added many log numbers to log statements that
had none.

Handled all files in server/mpm/.

I used the coccinelle script provided by Stefan.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1725394 13f79535-47bb-0310-9956-ffa450edef68
2016-01-19 00:20:55 +00:00
Stefan Eissing
d32c0ff682 fixing compile errors due to if assignment warnings
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1711919 13f79535-47bb-0310-9956-ffa450edef68
2015-11-02 09:14:50 +00:00
Jan Kaluža
f2dd2c6dda Fix crash in ap_mpm_pod_check call caused by NULL dereference of its parameter
when starting httpd as single process (httpd -X).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1711479 13f79535-47bb-0310-9956-ffa450edef68
2015-10-30 14:07:28 +00:00
Yann Ylavic
b2d6eab07a mpm_event/worker: make ap_queue_term() atomic (acquire/release the mutex once).
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1703241 13f79535-47bb-0310-9956-ffa450edef68
2015-09-15 16:05:31 +00:00
Yann Ylavic
f0cbf97307 core: Follow up to r1599601: s/ap_log_common/ap_log_mpm_common/.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1679714 13f79535-47bb-0310-9956-ffa450edef68
2015-05-16 09:17:29 +00:00
Yann Ylavic
9aa869ec41 mpm_{worker,prefork}: save some cycles by not copying the listener's pollfds
for each pollset operation.

We don't need a copy when poll()ing if those are allocated with the correct
lifetime (the listener thread) at the very beginning.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1662437 13f79535-47bb-0310-9956-ffa450edef68
2015-02-26 12:54:23 +00:00
Yann Ylavic
62da621f82 mpm_worker: replace apr_atomic_cas32(+1) loop with the more performant
apr_atomic_inc32().
Also declare fd_queue_info_t's idlers member as volatile since it is
used outside atomic functions (or it could be optimized out by the
compiler).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1643282 13f79535-47bb-0310-9956-ffa450edef68
2014-12-05 13:54:30 +00:00
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
9d670bcfdf mpm_event(opt), mpm_worker: follow up to r1635521.
Allocate retained idle_spawn_rate vector on the process pool.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1640161 13f79535-47bb-0310-9956-ffa450edef68
2014-11-17 13:59:36 +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
7ecfc45fdf core: follow up to r1629909: fix min_spare_threads lower bound and check wrt num_buckets.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1629990 13f79535-47bb-0310-9956-ffa450edef68
2014-10-07 21:59:02 +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
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
3bd97552e9 worker MPM: Fix null-dereference crash when using -DFOREGROUND with worker MPM
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1620569 13f79535-47bb-0310-9956-ffa450edef68
2014-08-26 11:05:37 +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
Mike Rumph
ebd3ed2bf8 Fix some comment typos
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1594301 13f79535-47bb-0310-9956-ffa450edef68
2014-05-13 17:50:39 +00:00
Jeff Trawick
d7a099b80c worker MPM: Don't forcibly kill worker threads if the child process is
exiting gracefully.

Submitted by: Oracle, via trawick

This modification was made some years ago for Oracle HTTP Server
by an Oracle employee.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1526220 13f79535-47bb-0310-9956-ffa450edef68
2013-09-25 16:23:28 +00:00
Christophe Jaillet
08b6d16ffc Log a warning if ThreadStackSize has an inappropriate value.
PR : 54311
Submitted by: Tianyin Xu <tixu cs ucsd edu>

Only event.c has been compiled on my system. The 2 others are just cut and paste.
I have left the same value for APLOGNO in event and eventopt has for the other logged messages. I don't know if it is the right way to do.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1433682 13f79535-47bb-0310-9956-ffa450edef68
2013-01-15 21:53:07 +00:00
Jim Jagielski
1d0042a397 missed one
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1410004 13f79535-47bb-0310-9956-ffa450edef68
2012-11-15 20:57:23 +00:00
Jim Jagielski
3452941de8 no longer needed
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1409273 13f79535-47bb-0310-9956-ffa450edef68
2012-11-14 17:45:42 +00:00
Jim Jagielski
a24b85145b Pull out the "extended" pod functions used by event and worker
to core, since it will be used by Simple and Lean and
likely other MPMs. Avoid duplication.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1409214 13f79535-47bb-0310-9956-ffa450edef68
2012-11-14 14:26:26 +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
4f5b52d406 Follow up to r1363557:
Refactor with some existing code to slightly optimize thread tracking.

Fix an implementation problem affecting statically linked MPMs which 
would break the ability to fail restart if a resource shortage was
found immediately.

Found by: rjung


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1364601 13f79535-47bb-0310-9956-ffa450edef68
2012-07-23 12:15:39 +00:00
Jeff Trawick
932dec80a8 mpm_event, mpm_worker: Remain active amidst prevalent child process
resource shortages.

This is a somewhat different direction than r168182 ("transient thread
creation errors shouldn't take down the whole server").

r168182: If APEXIT_CHILDSICK is received and there aren't any
         active children at the time, exit.

Now:     If APEXIT_CHILDSICK is received and we never successfully
         initialized a child, exit.

The issue seen with the r168182 handling is that it is rather easy
to be left with no active child processes (which causes the server
to exit completely) during a resource shortage that lasts for some
measurable period of time, as contrasted with a resource shortage 
that results in only a handful of allocation failures.

Now the server will remain active, though as long as the resource
shortage exists children may continually fail and the parent will
try once per second to create a replacement.  The existing logic
to reduce the spawn rate after such errors will prevent the 
parent from trying to create children more rapidly.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1363557 13f79535-47bb-0310-9956-ffa450edef68
2012-07-19 21:31:52 +00:00
Jeff Trawick
7b1e88d285 mpm_event, mpm_worker: Fix cases where the spawn rate wasn't reduced
after child process resource shortages.

The broken scenario:

  child X exits with APEXIT_CHILDSICK
  another child Y is created and reuses child X's scoreboard slot
  child X's exit status is processed

The case that worked is when child X's scoreboard slot hadn't
been reused by the time that its exit status was processed.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1363440 13f79535-47bb-0310-9956-ffa450edef68
2012-07-19 17:54:13 +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
Jeff Trawick
00b4adb3b1 revert accidental commit 1200129
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1200140 13f79535-47bb-0310-9956-ffa450edef68
2011-11-10 04:19:21 +00:00