Timo Sirainen [Thu, 6 Sep 2018 14:04:00 +0000 (17:04 +0300)]
global: Replace MASTER_SERVICE_FLAG_SEND_STATS with _DONT_SEND_STATS
Most services want to send statistics, so it's better to reverse the flag
behavior. Mark the few services that don't want stats with
MASTER_SERVICE_FLAG_DONT_SEND_STATS.
Timo Sirainen [Thu, 6 Sep 2018 16:48:09 +0000 (19:48 +0300)]
master: Start service processes only after adding all service listeners
Otherwise the processes could try to connect to services that aren't being
listened on, causing errors. Especially stats-writer socket needs to be
available early on.
Stephan Bosch [Thu, 6 Sep 2018 13:22:30 +0000 (15:22 +0200)]
lib-http: client: peer: Notify all peers in a peer pool about a successful connection.
This allows peers for which the last connection attempt failed (which was not
the last pending attempt in the pool) to try again. This solves a problem that
could potentially cause a hang with multiple parallel clients creating serveral
new connections at once.
Stephan Bosch [Thu, 6 Sep 2018 01:11:18 +0000 (03:11 +0200)]
lib-http: client: peer: Always run http_client_queue_connection_failure() upon definitive connection failure.
The recorded peer->connecting flag was highly unreliable in a scenario involving
starting parallel connections. This way, the linked queues can update their
state accordingly. Also, this will not cause empty queues to initiate new
connection, because empty queues will do nothing after updating the connection
state.
This problem caused a client ioloop hang in high-load conditions.
Stephan Bosch [Thu, 6 Sep 2018 00:51:09 +0000 (02:51 +0200)]
lib-http: client: peer: Determine number of pending peers in http_client_peer_shared_connection_failure() itself.
Before, the number of pending peers was a parameter, but that was only for a
single peer pool. This is wrong, since the one peer can have many different
pools (depending on how many clients with incompatible configs share this
peer).
Timo Sirainen [Fri, 31 Aug 2018 11:57:13 +0000 (14:57 +0300)]
log: Move data stack frame allocation to parent function
This simplifies the next commit, which requires data stack nearly always
when logging. The data stack frames are cheap enough that we don't really
need to optimize for avoiding the cases when they're not needed.
Sergey Kitov [Mon, 26 Feb 2018 14:33:19 +0000 (16:33 +0200)]
lib: Add some event handling functions.
event_has_all_categories() - checks if given event contains all the
categories of an another event.
event_has_all_fields() - checks if given event contains all the fields
of an another event.
event_dup() - duplicates an event.
event_copy_categories_fields() - copies all categories and fields from
source to dest.
Timo Sirainen [Fri, 31 Aug 2018 10:04:53 +0000 (13:04 +0300)]
lib: Fix matching parent categories in event filter
So far this hasn't caused problems, because parent events had been using
parent categories. However, if the parent category wasn't used by an event
or its parents, an event filter wouldn't have matched it.
Phil Carmody [Wed, 29 Aug 2018 12:28:31 +0000 (15:28 +0300)]
lib/array - give arrays the non-freeing deinit that strings and buffers have
Buffers provide the ability to free the control block but preserve and
return the previously controlled data to the caller: buffer_free_without_data().
As wrapped buffers, strings also have this functionality: str_free_without_data().
(They have to do that, as their buffer implementation is encapsulated away
out of sight to the str.h user.)
Arrays, also wrapped buffers, are missing this capability under the 'array'
name, you have to use the buffer function call, which involves diving into
the guts of the array implementation (because arrays do not hide their
implementation like strings do), and also sacrifices array's type safety.
With this inline helper, it should be simple, obvious, clean and safe.
Phil Carmody [Tue, 19 Jun 2018 12:30:36 +0000 (15:30 +0300)]
m4/dovecot.m4: rename valgrind output file to hide it from certain tests
Some lib-http tests use readdir() to create test cases, and sometimes
object to the contents of test.out.$$. However, as lib-http is also
sensitive to certain characters in the filenames of the files it uses,
we can hide the valgrind output by chosing its filename to exclude it
from the lib_http tests. Non-initial '~' is not known to cause any issues
for either the shell or any known operating system, so is the safest of
lib-http's 'dodgy' characters to use as the separator.
Phil Carmody [Tue, 19 Jun 2018 10:29:46 +0000 (13:29 +0300)]
lib-http: increase pool sizes in tests
Pool growth messages spam the test output, just dive in with a slightly
larger default to shut them up. Only affects these individual tests,
not any other users of the library.
Phil Carmody [Thu, 14 Jun 2018 05:51:37 +0000 (08:51 +0300)]
lib-http: harden payload tests against dodgy filenames
Tests use files from readdir() as input, but do no sanitation of the
names, and therefore things like editor temp files can cause havoc
with the HTTP request parser.
The solution is to trap dodgy characters in the filenames, and ignore
those files. Initially, trap HTTP's "unsafe" and "reserved" characters.
Timo Sirainen [Wed, 29 Aug 2018 19:09:57 +0000 (22:09 +0300)]
lib-master, master: Initialize stats-client via environment variables
That way it's initialized before settings are read, and it can catch events
earlier. It also doesn't require all services to read settings if they
otherwise don't need them.
Phil Carmody [Wed, 29 Aug 2018 12:15:30 +0000 (15:15 +0300)]
lib-dns - struct member cleanup in dns_lookup
The index was never used anyway. Now we're using an alloconly pool,
there's no need for the dns_lookup to keep a freeable pointer to the
fields also int result.