| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1900024 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1899884 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
| |
stopped all processing in a child process. This is when all running
threads shall be stopped and joined.
[Stefan Eissing]
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1898369 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Replace ap_thread_current_create() by ap_thread_main_create() which is how
it's used by httpd. The former is now a local helper only to implement the
latter.
This allows to consolidate/factorize common code in the main() of httpd and
the unix MPMs.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897543 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
thread_local variables are not (always?) reset on fork(), so we need a way
to set the current_thread to NULL in the child process.
Implement and use ap_thread_current_after_fork() for that.
* include/httpd.h:
Define ap_thread_current_after_fork().
* server/util.c:
Implement ap_thread_current_after_fork().
* server/mpm/event/event.c, server/mpm/prefork/prefork.c,
server/mpm/worker/worker.c:
Use ap_thread_current_after_fork().
* server/mpm/winnt/child.c:
Windows processes are not fork()ed and each child runs the main(), so
ap_thread_current_create() was already called there.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897472 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897461 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
#define ap_thread_create, ap_thread_current_create and ap_thread_current to
their apr-1.8+ equivalent if available, or implement them using the compiler's
thread_local mechanism if available, or finally provide stubs otherwise.
#define AP_HAS_THREAD_LOCAL to 1 in the two former case or 0 otherwise, while
AP_THREAD_LOCAL is defined to the compiler's keyword iff AP_HAS_THREAD_LOCAL.
Replace all apr_thread_create() calls with ap_thread_create() so that httpd
threads can use ap_thread_current()'s pool data as Thread Local Storage.
Bump MMN minor.
* include/httpd.h():
Define AP_HAS_THREAD_LOCAL, AP_THREAD_LOCAL (eventually), ap_thread_create(),
ap_thread_current_create() and ap_thread_current().
* server/util.c:
Implement ap_thread_create(), ap_thread_current_create() and
ap_thread_current() when APR < 1.8.
* modules/core/mod_watchdog.c, modules/http2/h2_workers.c,
modules/ssl/mod_ssl_ct.c:
Use ap_thread_create() instead of apr_thread_create.
* server/main.c:
Use AP_HAS_THREAD_LOCAL and ap_thread_current_create instead of APR's.
* server/util_pcre.c:
Use AP_HAS_THREAD_LOCAL and ap_thread_current instead of APR's.
* server/mpm/event/event.c, server/mpm/worker/worker.c,
server/mpm/prefork/prefork.c:
Use ap_thread_create() instead of apr_thread_create.
Create an apr_thread_t/ap_thread_current() for the main chaild thread usable
at child_init().
* server/mpm/winnt/child.c:
Use ap_thread_create() instead of CreateThread().
Create an apr_thread_t/ap_thread_current() for the main chaild thread usable
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897460 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
mpm_{event,worker}: No need to pass num_buckets to perform_idle_server_maintenance() and server_main_loop().
mpm_worker: the last used scoreboard slot depends on pid != 0 only.
Align max_daemons_limit value on all MPMs.
That's the number of scoreboard slots in use, so it shouldn't be negative.
Fix off by one in OS/2 too.
Submitted by: ylavic <ylavic.dev@gmail.com>
Github: closes #274
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1894291 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
| |
idle_spawn_rate *= 2 can go above MAX_SPAWN_RATE at some point, and it's not
enough for MAX_SPAWN_RATE to be a power of two for MPMs event and worker since
idle_spawn_rate is per bucket (num_buckets is not necessarily a power of two).
Let's cap on the other MPMs too should MAX_SPAWN_RATE change in the future.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1893471 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
| |
change.
While at it add a comment for the rationale, including for MPM motorz.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1892595 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Change how the main process handles restarts, from:
0. <restart signal>
1. stop old generation of children processes (graceful or not)
2. reload new configuration
3. start new generation of children processes
to:
0. <restart signal>
1. reload new configuration
2. stop old generation of children processes (graceful or not)
3. start new generation of children processes
The delay between stop and start is now very short and does not depend on the
reload time (which can be quite long with many vhosts and/or complex setups
with regexps or whatever third party components to compile).
Also, while reloading, the old generation of children processes keeps accepting
and handling incoming connections until the new generation is up to take over.
* os/unix/unixd.c (sig_term, sig_restart):
Set AP_MPMQ_STOPPING only once.
* server/listen.c (ap_duplicate_listeners):
Use ap_log_error() the main server instead of ap_log_perror().
* server/mpm/{event,worker,prefork}/{event,worker,prefork}.c
({event,worker,prefork}_retained_data):
Save the generation pool pointer (gen_pool) and all the buckets here, they
won't be cleared before the reload like pconf so they need a persitent
storage accross restarts (i.e. retained->gen_pool).
* server/mpm/{event,worker,prefork}/{event,worker,prefork}.c
(perform_idle_server_maintenance, child_main, make_child):
Change usage of all_buckets (previously with global/static scope) to the new
retained->buckets array.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1892587 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
| |
stopping a child process. The additional `graceful` parameter allows
registered hooks to free resources early during a graceful shutdown.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1891919 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
| |
* server/mpm/event/event.c: Set the new signal handler before unblocking the
signal as otherwise queued signals get delivered to the old handler
immediately when the signal is unblocked.
* server/mpm/worker/worker.c: Same thing as with event.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1882370 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1874062 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
| |
Follow-up to r1874011 which did the same for the event MPM.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1874055 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1873985 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We need not remember each child's bucket number in SHM for restarts, for the
lifetime of the httpd main process the bucket number can be bound to the slot
number such that: bucket = slot % num_buckets.
This both simplifies the logic and helps children maintenance per bucket in
threaded MPMs, where previously perform_idle_server_maintenance() could create
or kill children processes for the buckets it was not in charge of.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1855306 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since [mpm]_note_child_killed uses the scoreboard's generation number for
child_status hook (MPM_CHILD_EXITED), we must initialize it early (i.e. in
[mpm]_note_child_started where MPM_CHILD_STARTED is set) to avoid race
conditions on restart (e.g. storm/loop of restarts) leading to AH00546.
PR 62658.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1839571 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1837356 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Follow up to r1835845.
If a signal is received early when the MPM children start, signal_threads() may
be called concurrently with start_streads() thus before the latter (or its
underlying threads like the listener_thread) had a chance to create and init
the queues, mutexes, pollset and sockets array used by the former.
So move those initializations to a new setup_threads_runtime() function called
before start_threads(), where the pruntime pool is also created.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1837354 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
MPMs event and worker both need a dedicated pool to handle the creation of
the threads (listener, workers) and synchronization objects (queues, pollset,
mutexes...) in the start_threads() thread, with at least the lifetime of
the connections they handle, and thus survive pchild destruction (notably
in ONE_PROCCESS mode, but SIG_UNGRACEFUL is concerned too).
For instance, without this fix, the below backtrace can happen in ONE_PROCCESS
mode and a signal/^C is received (with active connections):
Thread 1 "httpd" received signal SIGSEGV, Segmentation fault.
(gdb) bt
#0 <BOOM>
#1 0x00007ffff7c7e016 in apr_file_write (thefile=0x0, ...)
^ NULL (cleared)
at file_io/unix/readwrite.c:230
#2 0x00007ffff7c7e4a7 in apr_file_putc (ch=1 '\001', thefile=0x0)
^ NULL (cleared)
at file_io/unix/readwrite.c:377
#3 0x00007ffff7c8da4a in apr_pollset_wakeup (pollset=0x55555568b870)
^ already destroyed by pchild
at poll/unix/pollset.c:224
#4 0x00007ffff7fc16c7 in decrement_connection_count (cs_=0x7fff08000ea0)
at event.c:811
#5 0x00007ffff7c83e15 in run_cleanups (cref=0x7fffe4002b78)
at memory/unix/apr_pools.c:2672
#6 0x00007ffff7c82c2f in apr_pool_destroy (pool=0x7fffe4002b58)
^ master_conn
at memory/unix/apr_pools.c:1007
#7 0x00007ffff7c82c12 in apr_pool_destroy (pool=0x7fff08000c28)
^ ptrans
at memory/unix/apr_pools.c:1004
#8 0x00007ffff7c82c12 in apr_pool_destroy (pool=0x555555638698)
^ pconf
at memory/unix/apr_pools.c:1004
#9 0x00007ffff7c82c12 in apr_pool_destroy (pool=0x555555636688)
^ pglobal
at memory/unix/apr_pools.c:1004
#10 0x00005555555f4709 in ap_terminate ()
at unixd.c:522
#11 0x00007ffff6dbc8f1 in __run_exit_handlers (...)
at exit.c:108
#12 0x00007ffff6dbc9ea in __GI_exit (status=<optimized out>)
at exit.c:139
#13 0x00007ffff7fc1616 in clean_child_exit (code=0)
at event.c:774
^ pchild already destroyed here
#14 0x00007ffff7fc5ae4 in child_main (child_num_arg=0, child_bucket=0)
at event.c:2869
...
While at it, add comments about the lifetimes of MPMs pools and their objects,
and give each pool a tag (e.g. "pchild" accordingly to other MPMs).
(follow up for event_pollset in r1835846).
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1835845 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1822535 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
| |
Export ap_queue_*() fonctions, so that they are accessible from MPMs, but
don't provide "mpm_fdqueue.h" in the API (include/).
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1822366 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
| |
Make the allocation and zero-ing in ap_queue_init() => ap_queue_create().
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1821660 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
| |
Be explicit in the naming about what's push/pop-ed.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1821651 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
| |
Free idle pools while stopping.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1821650 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
| |
Use common [mpm_]fdqueue.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1821639 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
| |
Use common fdqueue.
[Reverted by r1821619]
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1821608 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
| |
PR 62009, so that they don't receive (implicitely) the ones meant for the MPM.
Inspired by: Armin Abfalterer <a.abfalterer gmail.com>
Proposed by: Yann Ylavic
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1821504 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1821503 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
| |
PR 62009, so that they don't receive (implicitely) the ones meant for the MPM.
Inspired by: Armin Abfalterer <a.abfalterer gmail com>
Proposed by: Yann Ylavic
[Reverted by r1821503]
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1821499 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This tweaks accept() failure processing by having ap_unixd_accept
pass more errors up, and having the MPM's check against a macro
to see if they are in a whitelist of non ENETDOWN/EMFILE kind
of potential process-wide errors.
Default behavior is still to exit.
edit: MMN bump in 1820099.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1820098 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
| |
We can't destroy ap_pglobal because clean_child_exit() runs in DSO which would
be unloaded under us, so use atexit() to defer the final apr_terminate().
[Reverted by 1822535]
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1814112 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
(reverts r1783808)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1783895 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
No functional change.
PR 59990
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1756038 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
| |
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
|