Timo Sirainen [Fri, 14 Sep 2018 10:19:16 +0000 (13:19 +0300)]
dict-client: Avoid excessive CPU usage while waiting commands to finish
client_dict_add_timeout() adds the timeout thinking that the dict no longer
has any work to do, so it can be freed soon. However, if other work is
added before that, the timeout just keeps getting called over and over
again. This is especially bad with the default idle timeout of 0.
Timo Sirainen [Mon, 6 Aug 2018 09:39:25 +0000 (12:39 +0300)]
imap: Fix command ambiguity checking with special plugins
If the tagged line is already sent, that command can't result in ambiguity
anymore.
A cleaner fix would be to add a new _WAIT_SYNC_OUTPUT state, but that
requires all the existing code to understand that new state correctly, so it
has a higher chance of breaking something. So at least for now don't add it.
Stephan Bosch [Mon, 13 Aug 2018 17:23:31 +0000 (19:23 +0200)]
lib-http: test-http-client-errors: Make "peer reuse failure" test reliable.
It was highly timing-sensitive, since it required a particular error status to
be returned. Sometimes, it would yield a different error based on a
slightly different order of events, making the test fail. Such failures aren't
relevant though, since this regression test is about triggering a segfault that
used to occur.
Timo Sirainen [Tue, 2 Oct 2018 07:22:11 +0000 (10:22 +0300)]
lib-master: ipc-client: Don't free command too early
When multiple replies were received by IPC only the final reply should free
the command. This may have caused e.g. "doveadm proxy list" to crash.
Broken by 435f0545b200767c25a5daee17cd6b4998d03710
Timo Sirainen [Thu, 26 Apr 2018 18:07:31 +0000 (21:07 +0300)]
cassandra: Add proper log levels to logged messages
If logging to "internal handler", i.e. to log process, write the log prefix
that includes the log level. This way Cassandra's trace/debug/info messages
won't end up in error log.
Stephan Bosch [Wed, 26 Sep 2018 10:25:59 +0000 (12:25 +0200)]
lib-smtp: client: Make the initialization of the connection after SSL handshake reliable.
Before, the connection was not guaranteed to be fully initialized after the SSL
handshake. The problem would occur when the handshake finished while writing the
SSL output stream. In a similar HTTP client issue, this caused a segfault.
Stephan Bosch [Tue, 25 Sep 2018 22:26:32 +0000 (00:26 +0200)]
lib-http: client: Fix segfault by making the initialization of the connection after SSL handshake reliable.
Before, the connection was not guaranteed to be fully initialized after the SSL
handshake. The problem would occur when the handshake finished while writing the
SSL output stream.
Timo Sirainen [Fri, 29 Jun 2018 11:37:36 +0000 (14:37 +0300)]
director: Fix assert-crash when doveadm disconnects immediately after sending command
Any command that requires a ring sync should cause the doveadm connection to
wait until the ring is synced. However, if the disconnection happened early
enough the connection is deinitialized before the ring sync is finished.
Timo Sirainen [Fri, 7 Sep 2018 17:04:48 +0000 (20:04 +0300)]
doveadm: Make sure to stop running commands requiring synced ring when ring is no longer synced
A command could desync the ring, and no more commands should be run
afterwards.
This also fixes a bug where a command that desyncs the ring is supposed to
wait for the ring being synced before returning OK, but returns it
immediately instead.
Timo Sirainen [Fri, 17 Aug 2018 08:34:02 +0000 (11:34 +0300)]
lib: Mark signal waiting IO as "never wait alone"
This signal is being automatically moved to nested ioloops. It can't be the
only IO being waited, since there's no code that simply wants to wait for a
signal.
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.
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).