Commit Graph

53 Commits

Author SHA1 Message Date
f6e5fbf7b7 * server/mpm_unix.c (ap_reclaim_child_processes, ap_relieve_child_processes):
Fix use after free warning with gcc -fanalyzer.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1892413 13f79535-47bb-0310-9956-ffa450edef68
2021-08-18 09:57:48 +00:00
f461bcf12c Add missing pool tags to help debugging.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1876599 13f79535-47bb-0310-9956-ffa450edef68
2020-04-16 12:32:33 +00:00
85760859ca Fix spelling errors found by codespell. [skip ci]
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1873985 13f79535-47bb-0310-9956-ffa450edef68
2020-02-13 18:15:57 +00:00
ff2d0af6cb Revert r1821526, r1821527, r1821534, r1821538, r1821539, r1821541, r1821605, r1821607, r1821608.
Instead of copying event/fdqueue.c code into existing mpm_unix.c, losing all
contributors (blame, since r105919...), will restart the series by svn-moving
event/fdqueue.[ch] to server/mpm_fdqueue.[ch] first.

The code is not really unix specific either, so this sounds better.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1821619 13f79535-47bb-0310-9956-ffa450edef68
2018-01-19 11:29:00 +00:00
56cfe4c25f mpm_unix: Follow up to r1821526.
Prepare mpm_worker to use common fdqueue.

[Reverted by r1821619]


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1821607 13f79535-47bb-0310-9956-ffa450edef68
2018-01-19 09:39:29 +00:00
5cf277ef5d mpm_unix: Follow up to r1821526.
Clear recycled_pools_count in ap_free_idle_pools().

[Reverted by r1821619]


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1821605 13f79535-47bb-0310-9956-ffa450edef68
2018-01-19 09:32:53 +00:00
85695a624a Follow up to r1821526: rename ap_queue_info_get_idlers to ap_queue_info_num_idlers.
[Reverted by r1821619]


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1821541 13f79535-47bb-0310-9956-ffa450edef68
2018-01-18 18:40:09 +00:00
d35f2f7675 Follow up to r1821526: style, no functional change.
[Reverted by r1821619]


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1821539 13f79535-47bb-0310-9956-ffa450edef68
2018-01-18 18:35:20 +00:00
b31ba4c83c Follow up to r1821526: opacify fdqueue types.
[Reverted by r1821619]


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1821538 13f79535-47bb-0310-9956-ffa450edef68
2018-01-18 18:28:25 +00:00
ed1e3421f0 Follow up to r1821526: mpm_unix.h needs this includes only for now.
[Reverted by r1821619]


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1821534 13f79535-47bb-0310-9956-ffa450edef68
2018-01-18 18:05:37 +00:00
a4d180680f Follow up to r1821526: mpm_unix.h
The fdqueue code is not for WIN32 (per mpm_unix.c), and does not seem to
require all the #includes (system) it claimed (at least in .h).

[Reverted by r1821619]


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1821527 13f79535-47bb-0310-9956-ffa450edef68
2018-01-18 17:54:41 +00:00
1c5106c6bf Share fdqueue code between MPMs event and worker.
This first step moves the content of server/mpm/event/fdqueue.c to
the existing server/mpm_unix.c file, and the server/mpm/event/fdqueue.h file
to trunk/server/mpm_unix.h (untouched for now, simple svn move).

Will follow up with the necessary changes to mpm_unix.* for common code.

[Reverted by r1821619]


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1821526 13f79535-47bb-0310-9956-ffa450edef68
2018-01-18 17:45:40 +00:00
a16360a61f core, MPMs unix: follow up to r1809881.
Deregister all hooks first (in pre_cleanup), by doing it last we could still
have had them run when DSOs were unloaded.

Likewise, avoid double faults when handling fatal signals by restoring the
default handler before pconf is cleared (we can't ap_log_error there).

Finally, we need to ignore sig_term/restart (do nothing) when the main
process is exiting (i.e. ap_pglobal is destroyed), since retained_data are
freed.

Aimed to fix all faults in PR 61558.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1809973 13f79535-47bb-0310-9956-ffa450edef68
2017-09-28 11:08:09 +00:00
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
6699f4e509 Revert r1783759: really more things than intended :p
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1783760 13f79535-47bb-0310-9956-ffa450edef68
2017-02-20 13:53:16 +00:00
37ebaff84d Follow up to r1783755: update APLOGNO.
[Reverted by r1783760]

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1783759 13f79535-47bb-0310-9956-ffa450edef68
2017-02-20 13:50:49 +00:00
7d6d92947b ap_reclaim_child_processes(): Implement terminate immediately
The behavior for terminate == 1 was documented but not implemented. Do
that now.




git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1770750 13f79535-47bb-0310-9956-ffa450edef68
2016-11-21 20:32:40 +00:00
0e1423f247 mpm_unix: Apache fails to start if previously crashed then restarted with
the same PID (e.g. in container).  PR 60261.

Proposed by: Val <valentin.bremond gmail.com>
Reviewed by: ylavic


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1766160 13f79535-47bb-0310-9956-ffa450edef68
2016-10-21 21:44:29 +00:00
7903412fe1 ap_reclaim_child_processes() ignores its first argument
note this in the docs, add comment


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1757061 13f79535-47bb-0310-9956-ffa450edef68
2016-08-21 14:09:00 +00:00
f4cc76ee71 Rename ap_casecmpstr[n]() to ap_cstr_casecmp[n](), update with APR doxygen
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1747469 13f79535-47bb-0310-9956-ffa450edef68
2016-06-09 00:06:42 +00:00
c80e6b2a34 Use new ap_casecmpstr[n]() functions where appropriate (not exhaustive).
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1715876 13f79535-47bb-0310-9956-ffa450edef68
2015-11-23 16:46:01 +00:00
3c9ddf44bf Revert r1715789: will re-commit without spurious functional changes.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1715869 13f79535-47bb-0310-9956-ffa450edef68
2015-11-23 16:28:36 +00:00
29843dc73f Use new ap_casecmpstr[n]() functions where appropriate (not exhaustive).
[Reverted by r1715869]


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1715789 13f79535-47bb-0310-9956-ffa450edef68
2015-11-23 12:33:09 +00:00
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
c8aadf8659 prepend 0
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1625953 13f79535-47bb-0310-9956-ffa450edef68
2014-09-18 12:14:05 +00:00
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
baa588a08b Remove useless spaces that are not in 2.4.x
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1542799 13f79535-47bb-0310-9956-ffa450edef68
2013-11-17 19:42:41 +00:00
62bb83d16f PR: 54852. Only use a dummy_connection for idle processes
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1542379 13f79535-47bb-0310-9956-ffa450edef68
2013-11-15 19:29:11 +00:00
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
ce7fd84e7e * server/mpm_unix.c (dummy_connection): Fix spello.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1327080 13f79535-47bb-0310-9956-ffa450edef68
2012-04-17 13:01:04 +00:00
172439f1fd * server/mpm_unix.c (dummy_connection): Use a TLS 1.0 close_notify
alert if the chosen listener is configured for https; not perfect
  but better than sending an HTTP request.  Adjust comments.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1327036 13f79535-47bb-0310-9956-ffa450edef68
2012-04-17 10:45:53 +00:00
b794edf687 * Partly revert r1303435 and rename pconf back to in_pconf to avoid shadowing
the global variable with the same name and create a bogus assignment.

Pointed out by: Eric Covener


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1303827 13f79535-47bb-0310-9956-ffa450edef68
2012-03-22 15:15:26 +00:00
2ee35476b3 * Fix changes in parameter names in function definitions done in r1303201
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1303435 13f79535-47bb-0310-9956-ffa450edef68
2012-03-21 15:18:28 +00:00
2e728d6ee5 Revert r1294936 (Jeff's revert) and fix NetWare / Win32 build.
Added the missing AP_DECLARE* decorations for the function 
implementations and variables.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1303201 13f79535-47bb-0310-9956-ffa450edef68
2012-03-20 23:15:05 +00:00
3a53586c76 * server/mpm_unix.c (dummy_connection): Destroy temp pool and return
on connect() failure.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1300171 13f79535-47bb-0310-9956-ffa450edef68
2012-03-13 15:03:54 +00:00
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
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
01ed21af9d Add wrappers for malloc, calloc, realloc that check for out of memory
situations.  Use them in most places where malloc, and friends are used.
This results in clean error messages in an out of memory situation instead of
segfaulting or silently malfunctioning. In some places, it just allows to
remove some logging code.

PR 51568, PR 51569, PR 51571.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1172686 13f79535-47bb-0310-9956-ffa450edef68
2011-09-19 16:25:42 +00:00
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
f974cdc216 When shutting down with worker or event with active processes
which had lost their scoreboard slot during a prior graceful 
restart, calls to ap_unregister_extra_mpm_process() were hidden
if AP_DEBUG (maintainer mode) wasn't defined.

This resulted in an uninitialized generation variable being
passed through to the child_status hook.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1103932 13f79535-47bb-0310-9956-ffa450edef68
2011-05-16 22:33:59 +00:00
61a0413706 Use APR_STATUS_IS_... in some more cases.
While this is not strictly necessary everywhere, it makes it much easier
to find the problematic cases.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1102124 13f79535-47bb-0310-9956-ffa450edef68
2011-05-11 22:51:46 +00:00
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
e5d1eb382f Fix some MinGW build issues...
mpm_winnt.c:  MinGW doesn't currently define the Windows
              STACK_SIZE_PARAM_IS_A_RESERVATION symbol

mpm_unix.c:   Bypass all this code on Windows  (too much trouble
              to keep it out of Makefile)

mpm_common.h: Skip over definitions of functions not available on
              Windows to keep references out of exports.c.

PR: 49535
Submitted by: John Vandenberg <jayvdb gmail.com>
Minor tweaks by: trawick

Other commits for this PR: r1089950, r1089951, r1089954


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1090614 13f79535-47bb-0310-9956-ffa450edef68
2011-04-09 15:56:27 +00:00
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
b1e1cff7f9 the mpm-note-child-killed hook was just for use by
ap_{reclaim,relieve}_child_processes; those functions can
invoke the hook directly; the function ap_mpm_note_child_killed()
is useless


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1086953 13f79535-47bb-0310-9956-ffa450edef68
2011-03-30 13:42:00 +00:00
d185fd5f57 PR50350: When no -k option is provided on the httpd command line, the server
was starting without checking for an existing pidfile.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1039989 13f79535-47bb-0310-9956-ffa450edef68
2010-11-29 00:10:22 +00:00
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
ebb62867fb Use the new APLOG_USE_MODULE/AP_DECLARE_MODULE macros everywhere to take
advantage of per-module loglevels


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@951895 13f79535-47bb-0310-9956-ffa450edef68
2010-06-06 16:59:50 +00:00
7fe574e381 OK, might as well finish this... Allow ServerTokens Off
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@808895 13f79535-47bb-0310-9956-ffa450edef68
2009-08-28 14:31:00 +00:00
35e3599b25 the mpm_get_child_pid hook is unnecessary, as was the per-MPM MPM_CHILD_PID() macro which it replaced
axe this new hook, and use ap_get_scoreboard_process() instead


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@759757 13f79535-47bb-0310-9956-ffa450edef68
2009-03-29 19:30:17 +00:00