Jim Jagielski [Fri, 2 Dec 2016 11:46:38 +0000 (11:46 +0000)]
Merge r1738631, r1738633, r1738635, r1757030, r1757031, r1770752, r1770768 from trunk:
Don't take over scoreboard slots from gracefully finishing threads
Otherwise the old and the new thread will both update the same scoreboard slot
with undefined results.
add comments
Document which directives set which variables
Make ap_find_child_by_pid() look at all slots that have ever been used.
This is preparation to allow to use more scoreboard slots in mpm event.
mpm_event: minor code simplification
- move variable initializations into declarations
- use max_workers variable
mpm_event: don't re-use scoreboard slots that are still in use
This causes inconsistent data in the scoreboard (due to async
connections) and makes it difficult to determine what is going on.
Therefore it is not a useful fix for the scoreboard-full issues (PR
53555).
The consent on the dev list is that we should allocate/use more
scoreboard entries instead.
Use all available scoreboard slots
Allow to use all slots up to ServerLimit. This makes 'scoreboard full'
errors much less likely.
And if ther is a situation where the scoreboard is full, don't make any
more processes finish gracefully due to reduced load until some old
processes have terminated. Otherwise, the situation would get worse once
the load increases again.
ap_daemon_limit is renamed to the more descriptive active_server_limit,
to make sure that all its uses are taken care of.
Jim Jagielski [Fri, 2 Dec 2016 11:44:57 +0000 (11:44 +0000)]
Merge r1705922, r1706523, r1738464, r1738466, r1738486 from trunk:
When shutting down a process, free resources early
Due to lingering connections, shutting down a process may take a very
long time. Free all recycled pools early in the hope that we can already
give some memory back to the OS.
rename some variables to be more descriptive
pid -> pslot
tid -> tslot
remove unused 'sd'
Terminate keep-alive connections when dying
When shutting down a process gracefully, terminate keep-alive connections so
that we don't get any new requests which may keep the dying process alive
longer.
Exit threads early during shutdown
During graceful shutdown, if there are more running worker threads than open
connections, terminate some threads. This frees resources faster, which may be
needed for new processes.
Exit threads early during shutdown, part 2
Follow up to r1738466: During graceful shutdown, when the listener thread is
closing a connection, it needs to wake up a worker thread so that it may
terminate.
Jim Jagielski [Fri, 2 Dec 2016 11:43:55 +0000 (11:43 +0000)]
Merge r1738628, r1757009, r1756848, r1757029 from trunk:
Display process slot number in the async overview
Fix the number of column for 'Async connections'.
There are only 3 columns (writing, keep-alive, closing), not 4.
Try to improve the code layout for it to be more readable.
Each <th> is on its own line so keep the corresponding "colspan" <td> fields grouped together.
r1738628 introduced a new column, 'Slot'.
Add an empty cell for it in the last line of the table, in order to fix the layout of the Totals.
Replace tab by spaces to be consistent
mod_status: note stopping procs in async info table
* add new column "stopping", denoting if a process is shutting down
* add additional "(old gen)", if a process is from before a graceful reload
* add counts of processes and stopping processes to summary line
Submitted by: sf, jailletc36, jailletc36, sf
Reviewed/backported by: jim
* mod_cache: Preserve the Content-Type in case of 304 response.
304 does not contain Content-Type and mod_mime regenerates
the Content-Type based on the r->filename. This later leads to original
Content-Type to be lost (overwriten by whatever mod_mime generates).
mod_cache: Use the actual URI path and query-string for identifying the
cached entity (key), such that rewrites are taken into account when
running afterwards (CacheQuickHandler off). PR 21935.
mod_cache: follow up to r1756553: log the real/actual cached URI (debug).
better s-maxage support
+ *) mod_cache: Consider Cache-Control: s-maxage in expiration
+ calculations. [Eric Covener]
+
+ *) mod_cache: Allow caching of responses with an Expires header
+ in the past that also has Cache-Control: max-age or s-maxage.
+ PR55156. [Eric Covener]
remove dead code leftover from r1023387.
Prior to this revision, there was an apr_atoi64 in this context.
Now, ap_cache_control() sets control.max_age (which is checked here) when
the maxage value was parsed OK.
duplicate debug-level AH00764 in the just-validated path.
Rename ap_casecmpstr[n]() to ap_cstr_casecmp[n](), update with APR doxygen
Submitted by: jkaluza, jorton, jkaluza, ylavic, ylavic, covener, covener, covener, wrowe
Reviewed/backported by: jim
Stefan Fritsch [Mon, 21 Nov 2016 21:47:16 +0000 (21:47 +0000)]
Split proposal for PR 53555 into smaller chunks
Replace jim's proposal into smaller chunks that are IMHO easier to review.
The end result is the same, except for the CHANGES entry and one comment that I
added to r1770752 vs. the Bugzilla patch and that was missing in jim's patch.
Jim Jagielski [Mon, 21 Nov 2016 12:18:18 +0000 (12:18 +0000)]
Merge r1752331, r1752332, r1752333 from trunk:
CMake: use CMAKE_REQUIRED_INCLUDES to find APR macros
When using CMake with Visual Studio on Windows, invoking the
CHECK_SYMBOL_EXISTS macro with the full paths to the include files seems
to always result in failure.
Instead, use the documented CMAKE_REQUIRED_INCLUDES variable to set the
include directory, and pass only the headers' base names to
CHECK_SYMBOL_EXISTS.
CMake: use generator expressions to find output files
Multi-configuration generators, like Visual Studio, use a different
output directory (Debug, Release, etc.) for each configuration. To find
the output files reliably, switch to using generator expressions instead
of hardcoding the file paths for PDBs, export files, etc.
CMake: quote installation paths
Deal with installation paths with spaces in them (e.g. "C:\Program
Files") by quoting the arguments to perl and xcopy.
Submitted by: jchampion
Reviewed/backported by: jim
Jim Jagielski [Mon, 21 Nov 2016 12:17:46 +0000 (12:17 +0000)]
Merge r1769332 from trunk:
ssl: clear the error queue before SSL_read/write/accept()
If other modules or libraries do not clear the OpenSSL error queue after
a failed operation, other code that relies on SSL_get_error() -- in
particular, code that deals with SSL_ERROR_WANT_READ/WRITE logic -- will
malfunction later on. To prevent this, explicitly clear the error queue
before calls like SSL_read/write/accept().
PR: 60223
Submitted by: Paul Spangler <paul.spangler ni.com>
Submitted by: jchampion
Reviewed/backported by: jim
After a chat in #httpd-dev it seems that the issue boils down to how %{CONTENT_TYPE}
is evaluated in util_expr_eval.c (r->content_type) vs how setifempty is (only a check
of the response headers). This particular behavior might be a bug or feature,
but it is worth to alert our users.
Luca Toscano [Tue, 15 Nov 2016 16:16:43 +0000 (16:16 +0000)]
Documentation rebuild
This commit also revert my last one about H2PushResource.
After a chat on #http-dev we decided to make it public since
it holds a Compatibility section.
mod_http2: new directive 'H2PushResource' to enable early pushes before
processing of the main request starts. Resources are announced to the
client in Link headers on a 103 early hint response.
All responses with status code <400 are inspected for Link header and
trigger pushes accordingly. 304 still does prevent pushes.
'H2PushResource' can mark resources as 'critical' which gives them higher
priority than the main resource. This leads to preferred scheduling for
processing and, when content is available, will send it first. 'critical'
is also recognized on Link headers.
mod_proxy_http2: uris in Link headers are now mapped back to a suitable
local url when available. Relative uris with an absolute path are mapped
as well. This makes reverse proxy mapping available for resources
announced in this header.
With 103 interim responses being forwarded to the main client connection,
this effectively allows early pushing of resources by a reverse proxied
backend server.
adding support for newly proposed 103 status code.
Jim Jagielski [Tue, 1 Nov 2016 11:55:34 +0000 (11:55 +0000)]
Merge r1688399 from trunk:
mod_remoteip: Use r->useragent_addr as the root trusted address for verifying.
This fixes issue resulting in setting of bad useragent_ip when internal
redirection has been generated as response to the request (typically as
result of "ErrorDocument 40x").
In this case, the original request has been handled by mod_remoteip and its
useragent_ip has been changed properly, but when internal redirection
to ErrorDocument has been generated later, the mod_remoteip's handler has been
executed again with *the same* c->client_addr as in the original request. If
c->client_addr IP is trusted, this results in bad useragent_ip being set.
When using r->useragent_addr as the root trusted address instead of
c->client_addr, the internal redirection uses the first non-trusted
IP in this particular case, so it won't change the r->useragent_ip during
the internal redirection to ErrorDocument.
Jim Jagielski [Wed, 26 Oct 2016 13:44:36 +0000 (13:44 +0000)]
Merge r1764040 from trunk:
mod_dav: Fix a potential cause of unbounded memory usage or incorrect
behavior in a routine that sends <DAV:response>'s to the output filters.
The dav_send_one_response() function accepts the current head of the output
filter list as an argument, but the actual head can change between calls to
ap_pass_brigade(). This can happen with self-removing filters, e.g., with
the filter from mod_headers or mod_deflate. Consequently, executing an
already removed filter can either cause unwanted memory usage or incorrect
behavior.
This patch changes the signature of the existing mod_dav's public API,
dav_send_one_response(), because this API is not yet a part of any 2.4.x
release.
* modules/dav/main/mod_dav.c
(dav_send_one_response): Accept a request_rec instead of an ap_filter_t.
Write the response to r->output_filters.
(dav_send_multistatus, dav_stream_response): Update these calling sites
of dav_send_one_response().