Yann Ylavic [Fri, 11 Dec 2020 14:49:12 +0000 (14:49 +0000)]
Merge r1884169, r1884170 from trunk:
mod_http2: Rename server_pool as pchild in h2_workers_create()
To clarify which parent pool the workers threads have.
And add a comment about workers_pool_cleanup()'s role and when it runs.
No functional change.
mod_http2: stop/wait the workers threads before their pool is killed.
There shouldn't be any worker thread active when pchild is destroyed (thus each
thread's pool), so register workers_pool_cleanup as a pre_cleanup of pchild.
This is to avoid races like the below stacktrace, where slot_run() threads
are still running when clean_child_exit() is called.
Thread 23 (Thread 0x7f4865b79800 (LWP 3740)):
#0 0x00007f4864dec449 in pthread_cond_destroy@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
#1 0x00007f4865020117 in run_cleanups (cref=<optimized out>) at memory/unix/apr_pools.c:2629
#2 pool_clear_debug (pool=pool@entry=0x558a5297e4a0, file_line=0x558a5237456b "event.c:757") at memory/unix/apr_pools.c:1830
#3 0x00007f486501ffee in pool_destroy_debug (pool=0x558a5297e4a0, file_line=<optimized out>) at memory/unix/apr_pools.c:1915
#4 0x00007f48650200f0 in pool_clear_debug (pool=pool@entry=0x558a52a41070, file_line=0x558a5237456b "event.c:757") at memory/unix/apr_pools.c:1827
#5 0x00007f486501ffee in pool_destroy_debug (pool=0x558a52a41070, file_line=<optimized out>) at memory/unix/apr_pools.c:1915
#6 0x00007f486502085c in apr_pool_destroy_debug (pool=<optimized out>, file_line=<optimized out>) at memory/unix/apr_pools.c:1957
#7 0x0000558a52326cfc in clean_child_exit (code=0) at event.c:757
#8 0x0000558a52327969 in child_main (child_num_arg=child_num_arg@entry=1, child_bucket=child_bucket@entry=0) at event.c:2926
#9 0x0000558a52327ce5 in make_child (s=0x558a52c9f840, slot=slot@entry=1, bucket=0) at event.c:2992
#10 0x0000558a52327d4c in startup_children (number_to_start=2, number_to_start@entry=3) at event.c:3015
#11 0x0000558a523289ac in event_run (_pconf=<optimized out>, plog=0x558a5273ce00, s=0x558a52c9f840) at event.c:3374
#12 0x0000558a5233e91e in ap_run_mpm (pconf=0x558a5270cbe0, plog=0x558a5273ce00, s=0x558a52c9f840) at mpm_common.c:100
#13 0x0000558a5231b763 in main (argc=<optimized out>, argv=<optimized out>) at main.c:844
Thread 2 (Thread 0x7f4840b70700 (LWP 3836)):
#0 0x00007f4864dec9f3 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
#1 0x00007f486501f65d in apr_thread_cond_wait (cond=<optimized out>, mutex=<optimized out>) at locks/unix/thread_cond.c:68
#2 0x00007f484e14ae4a in get_next (slot=0x558a528d5fe0) at h2_workers.c:209
#3 slot_run (thread=0x558a52828b30, wctx=0x558a528d5fe0) at h2_workers.c:228
#4 0x00007f4864de66db in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#5 0x00007f4864b0f88f in clone () from /lib/x86_64-linux-gnu/libc.so.6
Thread 1 (Thread 0x7f4841b72700 (LWP 3834)):
#0 0x00007f4864a2ce97 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007f4864a2e801 in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007f4865020865 in apr_pool_destroy_debug (pool=<optimized out>, file_line=<optimized out>) at memory/unix/apr_pools.c:1955
#3 0x00007f486502b536 in apr_thread_exit (thd=thd@entry=0x558a52ba8980, retval=retval@entry=0) at threadproc/unix/thread.c:206
#4 0x00007f484e14aec6 in slot_run (thread=0x558a52ba8980, wctx=0x558a528d6060) at h2_workers.c:248
#5 0x00007f4864de66db in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#6 0x00007f4864b0f88f in clone () from /lib/x86_64-linux-gnu/libc.so.6
Yann Ylavic [Fri, 11 Dec 2020 13:15:00 +0000 (13:15 +0000)]
Merge r1879441, r1879448, r1879594, r1883854, r1884136, r1884292 from trunk:
Add additional test suite runs for the prefork & event pool-debug builds:
- run with SSLSessionCache defined (after r1879430)
- run with "SSLProtocol TLSv1.2"
Adjust for r1879447 to specify shmcb is tested when
TEST_SSL_SESSCACHE is defined. [skip ci]
For TEST_SSL=1 runs, test SSLSessionCache with shmcb, memcached
and redis socache providers. Force TLSv1.2 for these runs since
TLSv1.3 doesn't use the cache.
Stop testing if a core dump was generated during the main test suite run.
Add ASan (AddressSanitizer) build and tests to ci.
+if test -v TEST_SSL; then
+ pushd test/perl-framework
+ ./scripts/memcached-init.sh
+ ./scripts/redis-init.sh
+ popd
+fi
+
if test -v APR_VERSION; then
install_apx apr ${APR_VERSION} "${APR_CONFIG}"
APU_CONFIG="$APU_CONFIG --with-apr=$HOME/root/apr-${APR_VERSION}"
Index: test/travis_run_linux.sh
===================================================================
--- test/travis_run_linux.sh (revision 1884310)
+++ test/travis_run_linux.sh (working copy)
@@ -77,6 +77,10 @@ if ! test -v SKIP_TESTING; then
export UBSAN_OPTIONS="log_path=$PWD/ubsan.log"
fi
+ if test -v TEST_ASAN; then
+ export ASAN_OPTIONS="log_path=$PWD/asan.log"
+ fi
+
if test -v WITH_TEST_SUITE; then
make check TESTS="${TESTS}" TEST_CONFIG="${TEST_ARGS}"
RV=$?
@@ -88,8 +92,25 @@ if ! test -v SKIP_TESTING; then
RV=$?
popd
fi
- if test -v LITMUS; then
+
+ # Skip further testing if a core dump was created during the test
+ # suite run above.
+ if test $RV -eq 0 -a -f test/perl-framework/t/core; then
+ RV=4
+ fi
+
+ if test -v TEST_SSL -a $RV -eq 0; then
pushd test/perl-framework
+ for cache in shmcb redis:localhost:6379 memcache:localhost:11211; do
+ SSL_SESSCACHE=$cache ./t/TEST -sslproto TLSv1.2 -defines TEST_SSL_SESSCACHE t/ssl
+ RV=$?
+ test $RV -eq 0 || break
+ done
+ popd
+ fi
+
+ if test -v LITMUS -a $RV -eq 0; then
+ pushd test/perl-framework
mkdir -p t/htdocs/modules/dav
./t/TEST -start
# litmus uses $TESTS, so unset it.
@@ -123,9 +144,18 @@ if ! test -v SKIP_TESTING; then
RV=3
fi
+ if test -v TEST_ASAN && ls asan.log.* &> /dev/null; then
+ cat asan.log.*
+
+ # ASan can report memory leaks, fail on errors only
+ if grep -q "ERROR: AddressSanitizer:" `ls asan.log.*`; then
+ RV=4
+ fi
+ fi
+
if test -f test/perl-framework/t/core; then
gdb -ex 'thread apply all backtrace' -batch ./httpd test/perl-framework/t/core
- RV=4
+ RV=5
fi
Jim Jagielski [Tue, 17 Nov 2020 15:04:40 +0000 (15:04 +0000)]
Merge r1883097 from trunk:
mpm_event: don't reset connections after lingering close timeout
While httpd is supposed to do lingering close for incoming data, it has no
control anyway over outgoing/pending data once they are handled by the
system.
So don't reset the connection after lingering close times out, otherwise the
system won't do its own lingering close to flush un-acked data.
The connection reset was introduced by r1802875 and backported to 2.4.28.
Submitted by: ylavic
Reviewed by: ylavic, jorton, jim
Jim Jagielski [Tue, 17 Nov 2020 15:04:12 +0000 (15:04 +0000)]
Merge r1883096 from trunk:
mpm_event: don't kill keepalive connections on connections_above_limit().
Before r1819855 (backported to 2.4.30), mpm_event killed keepalive connections
only when workers were exhausted, while this commit set workers_were_busy for
connections_above_limit().
Restore prior to r1819855 behaviour, and since ap_queue_info_num_idlers() is
now part of connections_above_limit(), let's update workers_were_busy there
only when necessary.
Submitted by: ylavic
Reviewed by: ylavic, jorton, jim
Jim Jagielski [Tue, 17 Nov 2020 14:59:04 +0000 (14:59 +0000)]
Merge r1776290, r1869399 from trunk:
let wstunnel run first
Since wstunnel can step aside based on the Upgrade: header.
mod_proxy: Add proxy check_trans hook.
This allows proxy modules to decline request handling at early stage.
Then mod_proxy_wstunnel can implement that hook to verify that an Upgrade
is requested, and otherwise hand over to mod_proxy_http.
Ruediger Pluem [Mon, 16 Nov 2020 12:24:12 +0000 (12:24 +0000)]
Merge r1881620, r1881635 from trunk:
Process early errors via a dummy HTTP/1.1 request as well
Process early errors via a dummy HTTP/1.1 request as well to ensure
that the request gets logged correctly and possible custom error
pages are considered. The previous way of directly sending a HTTP/2
answer with the HTTP status code appropriate for the error is more
efficient, but does not log the request nor sents a possible custom
error page.
* modules/http2/h2.h: Add http_status to h2_request struct and define
H2_HTTP_STATUS_UNSET.
* modules/http2/h2_request.c(h2_request_create_rec): Check if
http_status is set for the request and die with the
status code it contains if set.
* modules/http2/h2_session.c(on_header_cb): Adjust the error condition
now that we mark early errors via http_status: Only return an error
if the status is not success and http_status is not H2_HTTP_STATUS_UNSET.
* modules/http2/h2_stream.c(set_error_response): Set http_status
on the request instead of creating headers for a response and a
respective brigade.
Backport:
- r1859106: Axe some outdated compatibility notes
- r1878824: Add some html syntax highlight to a piece of code. + some missing links
- r1878825: Fix typo in r1878824
Joe Orton [Tue, 15 Sep 2020 08:50:59 +0000 (08:50 +0000)]
Merge r1880602, r1881396 from trunk: [under CTR for Travis changes]
Fail for more abort() errors in error_log.
Fail if a core dump is produced, and dump the backtrace if so.
(e.g. during parent or child process shutdown, core dumps will
not show up as test case failures so would not otherwise be caught)
* Makefile.in: Define the update-changes target to merge the change files
from the changes directory to the top of the CHANGES file and remove
them afterwards. If a Subversion binary was found during configure try
to svn rm them otherwise just delete them.
* configure.in: Search for the Subversion binary.
* acinclude.m4: Set the corresponding Makefile variable for the Subversion
binary.
* README.CHANGES: New file to document the new approach.
Can we have mercy with people working on case-preserving file systems?
Consider case insensitive filessystems
Consider case insensitive filessystems and thus choose a new non conflicting
name for the directory to store CHANGES entries.
Joe Orton [Mon, 14 Sep 2020 13:16:54 +0000 (13:16 +0000)]
Merge r1870095, r1870097, r1880927 from trunk:
Buffer HTTP request bodies for TLSv1.3 PHA in the same way as for
TLSv<1.3 renegotiation.
* modules/ssl/ssl_engine_kernel.c (fill_reneg_buffer): Factor
out...
(ssl_hook_Access_classic): ... from here.
(ssl_hook_Access_modern): Use it here too.
Add logno.
* modules/ssl/ssl_engine_kernel.c (ssl_hook_Access_modern): Move
fill_reneg_buffer() call down after r->connection->master
check.
mod_proxy: add ap_proxy_define_match_worker() and use it for ProxyPassMatch
and ProxyMatch section to distinguish between normal workers and workers
with regex substitutions in the name. Implement handling of such workers
in ap_proxy_get_worker(). PR 43513
mod_proxy: better check for worker->s->is_name_matchable
Return a match whenever we get to the end of the worker name, regardless
of whether there is URL left.
ProxyPassMatch had been using the default worker in trunk.
Follow up to r1609680: simpler/faster ap_proxy_strcmp_ematch().
No functional change.
Follow up to r1609680: further simplify/optimize ap_proxy_strcmp_ematch().
While at it, same treatment for its mother ap_strcmp_match().
make sure the $n of the regular expressions is not included the name of the worker.
for example, the example:
ProxyPassMatch "^(/.*\.gif)$" "http://backend.example.com:8000$1"
was giving:
AH00526: Syntax error on line nnn of bla/conf/httpd.conf:
ProxyPass Unable to parse URL: http://backend.example.com:8000$1
ap_proxy_define_match_worker: don't copy the url unnecessarily.
And save a few cycles, when the duplication is needed, by not copying
the ignored part.
ap_proxy_define_match_worker: disable connection reuse by default.
To avoid compat issues with dns/connection reuse now that a worker with
dollar substitution can be elected.
CHANGES entry for ap_proxy_define_match_worker().
Oups, axe spurious copypasta.
mod_proxy: unfail mixed ProxyPass/<Proxy> and ProxyPassMatch/<ProxyMatch>.
It is not a failure in current 2.4.x, so to ease backport and to avoid compat
breakage simply warn about the second directive being ignored.
This commit can be reverted in trunk if we want next versions to fail in this
case.