Timo Sirainen [Fri, 3 Feb 2017 14:16:26 +0000 (16:16 +0200)]
lib-storage: Once hooks have run, set vlast to NULL to make sure it's not used
The functions can't be correctly overridden outside their own specific
hooks. It would work only if hook_build_update() is called afterwards and
currently there's no public API for that.
Stephan Bosch [Thu, 2 Feb 2017 00:36:50 +0000 (01:36 +0100)]
lib-http: client: Fixed peer reconnection failure handling.
The addressed problem occurs in a very specific situation in which the original successful connection is dropped, yet a new connection fails.
It manifests as an assertion failure or panic:
Panic: file ioloop-epoll.c: line 189 (io_loop_handler_run_internal): assertion failed: (msecs >= 0)
Panic: BUG: No IOs or timeouts set. Not waiting for infinity.
The timing is very critical. However, this doesn't mean that the occurrence of this problem is very unlikely; it can happen frequently under high load.
Stephan Bosch [Tue, 31 Jan 2017 12:41:48 +0000 (13:41 +0100)]
lib-http: server: Fix premature connection destroy in http_server_connection_output().
Added a reference to the connection object while it is sending the remainder of a response's payload.
This is necessary, since http_server_response_send_more() can destroy the connection, for example when the request has a "Connection: close" header.
This will only occur for responses with a very large payload, because otherwise the payload is fully sent in in the initial pass.
Timo Sirainen [Mon, 9 Jan 2017 21:13:03 +0000 (23:13 +0200)]
lib-storage: When logging corrupted mail size, disable logging Message-ID for now
This was causing crashes in some situations. It was originally added to
figure out if there were problems with dovecot.index.cache containing
data for wrong messages. This was never found to happen, although now
thinking about it, the problem may have been 741287129c22cadc14c05584704685b31169dbce. So perhaps this code could be
removed permanently as well.
6b44fc75c0039d1006ce4d543544552449b8e229 also attempted to fix this, but it
wasn't enough. There was still some code path that lead to recursive header
parsing.
Stephan Bosch [Mon, 9 Jan 2017 01:03:25 +0000 (02:03 +0100)]
lib-imap: imap-bodystructure: Allow alternative syntax and omitted optional elements in parser input.
This makes the parser accept any RFC-compliant BODYSTRUCTURE syntax, instead of only what Dovecot itself produces.
This way the parser could reliably be used in the lib-imap-client if ever needed.
Timo Sirainen [Sat, 28 Jan 2017 23:06:55 +0000 (01:06 +0200)]
lib-storage: Add struct mailbox_status.flags
This is similar to permanent_flags, except it tells which flags can be
changed at all in the session. Mainly it allows plugins to make changes to
IMAP's untagged FLAGS reply.
Stephan Bosch [Sun, 22 Jan 2017 22:55:24 +0000 (23:55 +0100)]
lib-http: client: Fixed handling of errors occurring for unsubmitted requests during http_client_request_send_payload().
When http_client_request_send_payload() is executed for the first time, the request is submitted.
Errors occurring during submission don't trigger a callback immediately.
Instead, these are queued in the client and will trigger a callback when an ioloop is run with the client.
However, in http_client_request_send_payload() the ioloop is never executed when the request fails that way, meaning that
the callback was never called. Since for example SOLR assumes the callback is always called for an error in
http_client_request_send_payload(), this causes all kinds of problems.
Fixed by manually handling the delayed request errors in http_client_request_send_payload() explicitly.
Timo Sirainen [Fri, 20 Jan 2017 13:54:27 +0000 (15:54 +0200)]
director: Make sure USER-KILLED isn't sent before USER-MOVE
If USER-MOVE was for a user that didn't exist, killing sent USER-KILLED
immediately before the forwarding USER-MOVE. This caused the move to get
stuck, giving errors like:
director: Error: Finishing user 3224731354 move timed out, its state may now be inconsistent (state=waiting-for-everyone)
Timo Sirainen [Fri, 20 Jan 2017 12:46:30 +0000 (14:46 +0200)]
lib-storage: Fix mailbox's vsize header check for mailboxes not in dovecot.list.index
If mailbox wasn't yet in the dovecot.list.index, mailbox_list_index_status()
for it returns FALSE and doesn't initialize the status. In some situations this
may have caused a non-empty mailbox's vsize to be returned as 0.
Stephan Bosch [Tue, 10 Jan 2017 01:12:25 +0000 (02:12 +0100)]
lib-http: client: Make sure req->conn is only not NULL when that connection holds a reference to that request.
This consolidates the management of req->conn to one place, thereby preventing mishaps.
It makes sure req->conn is always properly assigned, making it more reliable.
This fixes a problem that emerged in the http-proxy.
Timo Sirainen [Tue, 17 Jan 2017 17:49:39 +0000 (19:49 +0200)]
master: Remove unnecessary service listener start
The listening was already started later on in the same function. Also
in some cases it would have been started unnecessarily, like when service
was stopped or more processes were created immediately.