Commit Graph

253 Commits

Author SHA1 Message Date
4356cbd5b3 Silence a sparse warning about inconsistent indenting + some minor style issues
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1700336 13f79535-47bb-0310-9956-ffa450edef68
2015-08-31 20:44:55 +00:00
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
609dbae292 Tab vs space
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1657949 13f79535-47bb-0310-9956-ffa450edef68
2015-02-06 20:25:21 +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
55701bdc09 We really need some place where we can place a whole
bunch of data/info-that-should-be-logged-by-all-mpms.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1599601 13f79535-47bb-0310-9956-ffa450edef68
2014-06-03 15:22:37 +00:00
ebfa4e231d Follow-up to r1512819:
Don't include "\" in the printable form of the data because
it will be escaped later in processing, and the extra escaping
throws off the alignment.  Just filter it out like unprintable
characters.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1565777 13f79535-47bb-0310-9956-ffa450edef68
2014-02-07 19:54:06 +00:00
d26fb3d0d9 Follow-up to r1539988:
Make sure an error log provider has initialized before trying to log to it.
(A log function may be called in a window between closing stderr and opening logs.)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1543979 13f79535-47bb-0310-9956-ffa450edef68
2013-11-20 22:54:37 +00:00
75525b82e5 Do not lose log messages with NULL server_rec when error log provider is used.
- set stderr_log to NULL after it is redirected to /dev/null
- use log provider of ap_server_conf in log_error_core when no server_rec
  is provided and std_err_log is NULL


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1539988 13f79535-47bb-0310-9956-ffa450edef68
2013-11-08 11:41:08 +00:00
a8fbe8c2f0 don't ignore some apr_procattr failures (clang scan-build)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1534995 13f79535-47bb-0310-9956-ffa450edef68
2013-10-23 11:59:35 +00:00
86014a1423 Follow-up to r1525597:
Initialize error log providers in vhosts, solving crashes
when logging from those vhosts as well as allowing a different
provider (or provider configuration) for vhosts.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1532344 13f79535-47bb-0310-9956-ffa450edef68
2013-10-15 14:09:29 +00:00
4073515aa5 avoid needless apr_pstrdup()
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1532122 13f79535-47bb-0310-9956-ffa450edef68
2013-10-14 22:51:44 +00:00
86b710bb80 Fix the null device name on Windows so that stderr can be sent
to the bit bucket.  (This logic is always hit when using an error
log provider.)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1527008 13f79535-47bb-0310-9956-ffa450edef68
2013-09-27 18:01:15 +00:00
f89aa5c2a2 When adding APR_EOL_STR in the error log record before calling
the writer, include that trailer in the length.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1527005 13f79535-47bb-0310-9956-ffa450edef68
2013-09-27 17:55:00 +00:00
528855d544 Error log providers need to be able to trigger a startup error from their
init() function.  A NULL return code is the trigger.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1527003 13f79535-47bb-0310-9956-ffa450edef68
2013-09-27 17:52:13 +00:00
6a062fcc84 Suppress formatting of startup messages written to the console when
ErrorLogFormat is used.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1525931 13f79535-47bb-0310-9956-ffa450edef68
2013-09-24 15:57:07 +00:00
904b3f8d8b Add AP_ERRORLOG_PROVIDER_ADD_EOL_STR flag for ap_errorlog_provider, bump MMN.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1525845 13f79535-47bb-0310-9956-ffa450edef68
2013-09-24 11:03:55 +00:00
84d106dec4 allow the provider to decide whether or not APLOG_NOTICE
messages should be logged


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1525664 13f79535-47bb-0310-9956-ffa450edef68
2013-09-23 18:15:32 +00:00
59bb55791e Add ap_errorlog_provider to make ErrorLog logging modular. Move
syslog support from core to new mod_syslog.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1525597 13f79535-47bb-0310-9956-ffa450edef68
2013-09-23 14:02:27 +00:00
0d02cd5c6d Add ap_log_data(), ap_log_rdata(), etc. for logging buffers.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1512819 13f79535-47bb-0310-9956-ffa450edef68
2013-08-10 19:50:58 +00:00
a68ec08398 use ap_log_error's facility to print the apr error string instead of
calling apr_strerror() explicitly


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1463052 13f79535-47bb-0310-9956-ffa450edef68
2013-03-31 21:12:00 +00:00
9429e7b6cd only write the first len chars to syslog, as the buffer may have additional
text added speculatively


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1399708 13f79535-47bb-0310-9956-ffa450edef68
2012-10-18 15:55:46 +00:00
f4eac06dc5 style tweak
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1399687 13f79535-47bb-0310-9956-ffa450edef68
2012-10-18 15:02:24 +00:00
5a3782a9fe Add a few AP_DEBUG_ASSERT()s for the benefit of clang
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1384913 13f79535-47bb-0310-9956-ffa450edef68
2012-09-14 20:44:01 +00:00
b6f86b92c2 The Pidfile directive and ap_log_pid()/ap_remove_pid()/ap_read_pid()
now respect DefaultRuntimeDir


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1369808 13f79535-47bb-0310-9956-ffa450edef68
2012-08-06 12:15:03 +00:00
07d44a6c44 Fix segfault in logging if r->useragent_addr or c->client_addr is unset
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1328950 13f79535-47bb-0310-9956-ffa450edef68
2012-04-22 19:41:59 +00:00
cb21a0dbcc Further clarify the naming of the entity that directly connects to us by
calling that entity a client instead of a peer.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1214015 13f79535-47bb-0310-9956-ffa450edef68
2011-12-14 01:10:52 +00:00
ad489c105b Further clarify the naming of the entity that originates the request by
calling that entity a useragent instead of a client.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1214005 13f79535-47bb-0310-9956-ffa450edef68
2011-12-14 00:33:46 +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
394e5594d6 Introduce a per connection "peer_ip" and a per request "client_ip" to
distinguish between the raw IP address of the connection and the effective
IP address of the request.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1206291 13f79535-47bb-0310-9956-ffa450edef68
2011-11-25 19:42:04 +00:00
d98a314d98 Align the format variable for the raw IP between the error_log and the
access_log.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1205061 13f79535-47bb-0310-9956-ffa450edef68
2011-11-22 16:16:51 +00:00
4ee7eea4cf Introduce a per request version of the remote IP address, which can be
optionally modified by a module when the effective IP of the client
is not the same as the real IP of the client (such as a load balancer).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1204968 13f79535-47bb-0310-9956-ffa450edef68
2011-11-22 13:10:39 +00:00
e0184da329 Pass ap_errorlog_info to error_log hook.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1204614 13f79535-47bb-0310-9956-ffa450edef68
2011-11-21 17:36:26 +00:00
add3418303 Fix logic when to call error_log hook
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1204595 13f79535-47bb-0310-9956-ffa450edef68
2011-11-21 17:01:10 +00:00
7cc67a8c39 add conn_rec to error log hook
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1203634 13f79535-47bb-0310-9956-ffa450edef68
2011-11-18 13:10:06 +00:00
4a69a843de Fix per-request / per-conn logging, probably broken by r1041140
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1199591 13f79535-47bb-0310-9956-ffa450edef68
2011-11-09 01:36:19 +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
07b7057cb1 Fix logging of the log id of subrequests
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1142160 13f79535-47bb-0310-9956-ffa450edef68
2011-07-02 06:45:54 +00:00
bde65f90cb Add support to ErrorLogFormat for logging the system unique
thread id under Linux


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1138616 13f79535-47bb-0310-9956-ffa450edef68
2011-06-22 20:22:24 +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
86d7dd25c4 allow error log formatters to peek at the message format
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1101143 13f79535-47bb-0310-9956-ffa450edef68
2011-05-09 18:43:50 +00:00
7be2d26631 consolidate logic to remove the pidfile in a new API,
ap_remove_pid(), related to existing ap_log_pid() and
ap_read_pid()

presumably this is useful to third-party MPMs as well


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1086224 13f79535-47bb-0310-9956-ffa450edef68
2011-03-28 13:35:08 +00:00
40f5690256 Check for s->module_config before using it, as the faked server_rec from
mod_cgid does not have it.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1060245 13f79535-47bb-0310-9956-ffa450edef68
2011-01-18 09:01:19 +00:00
efa98ce0f0 Fix warning about comparing signed/unsigned
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1041140 13f79535-47bb-0310-9956-ffa450edef68
2010-12-01 19:25:15 +00:00
286c8622b6 Add a generic pool cleanup function that sets a pointer to NULL and use
it to replace various pool cleanup functions.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1032167 13f79535-47bb-0310-9956-ffa450edef68
2010-11-06 22:12:41 +00:00
2768a20d29 Added header include for getpid() prototype on Win32.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1025496 13f79535-47bb-0310-9956-ffa450edef68
2010-10-20 11:03:01 +00:00
39262df913 info.file, info.line, and info.status should not be defined for per-request or
per-conn info


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1021904 13f79535-47bb-0310-9956-ffa450edef68
2010-10-12 20:01:53 +00:00
2e4a59c5e1 add %v and %V to ErrorLogFormat
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1005208 13f79535-47bb-0310-9956-ffa450edef68
2010-10-06 19:14:44 +00:00
b65066c6ac Add generate_log_id hook to allow to use the ID generated by mod_unique_id as
error log ID for requests.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1002125 13f79535-47bb-0310-9956-ffa450edef68
2010-09-28 11:53:17 +00:00
107c5573e1 In ErrorLogFormat, make it possible to log an item only if the loglevel
of the message is higher than a specified value. This allows to achive
the old behaviour for the source file name/line number of being only
logged for debug and higher.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1001381 13f79535-47bb-0310-9956-ffa450edef68
2010-09-26 07:40:15 +00:00
d0bc2d2cfb add errorlog formats for request notes and env vars
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@996307 13f79535-47bb-0310-9956-ffa450edef68
2010-09-12 12:59:10 +00:00