Stephan Bosch [Mon, 20 Oct 2014 15:54:27 +0000 (08:54 -0700)]
lib-http: client: Fixed behavior of connection backoff timer when multiple IPs are returned for hostname.
Peer backoff data was lost because peer was destroyed quickly. Now the peer
object is retained during the backoff period, so that new connection
attempts adhere to the backoff period.
Stephan Bosch [Mon, 20 Oct 2014 15:54:26 +0000 (08:54 -0700)]
lib-http: client: Fixed handling of connection timeouts.
A timeout caused an assert failure, because the connection status was
altered before the peer_connection_failure handler was called.
Timo Sirainen [Fri, 17 Oct 2014 22:55:02 +0000 (01:55 +0300)]
lib-storage: If we detect a broken cached message size, log more information about it.
Also try to include one of the cached headers in the message, which could
allow detecting if the cached data pointed to a completely different
message.
Timo Sirainen [Thu, 16 Oct 2014 15:19:03 +0000 (08:19 -0700)]
lib-storage: LAYOUT=index doesn't reserve '~' as internal separator anymore.
The index doesn't reserve any character as hierarchy separator, so the
internal separator can change at any time. Use the namespace's configured
hierarchy separator as the internal separator to avoid reserving any
characters. If namespace separator isn't configured, fallback to the
original '~' so this change shouldn't break anything.
Timo Sirainen [Wed, 15 Oct 2014 14:37:05 +0000 (07:37 -0700)]
doveconf: Allow settings plugins to print comments to the output header.
If plugin contains <plugin name>_doveconf_comment string, it's written as
part of the doveconf output. The idea mainly being that the major plugins
(such as Pigeonhole) could print their version number there to avoid having
to ask for it separately.
Timo Sirainen [Tue, 14 Oct 2014 23:57:13 +0000 (16:57 -0700)]
imap-zlib: Removed check for disallowing COMPRESS to be used with TLS compression.
Clients shouldn't be doing this in any case, and this check doesn't work
properly with proxies.
We could solve the check properly for Dovecot proxies by having them send
the TLS compression state to backends, but it would still leave non-Dovecot
proxies broken. Although we could just not advertise COMPRESS=DEFLATE
extension if TLS compression is enabled and non-Dovecot proxies at least
wouldn't cause failures. Still, overall seems like a lot of work for such a
small and probably unnecessary extra check.
Timo Sirainen [Mon, 13 Oct 2014 15:50:44 +0000 (08:50 -0700)]
lib-index: Automatically grow header size on header updates.
This fixes assert-crashes when it didn't happen.
For example an old Maildir index could have had a header size 24. Dovecot
crashed then when trying to update it, because the new header size is 36 and
there wasn't an explicit mail_index_ext_resize_hdr() call.
Stephan Bosch [Fri, 10 Oct 2014 21:43:38 +0000 (00:43 +0300)]
lib-dns: The dns_lookup() call caused a crash upon a connect error, because dns_client_disconnect() can indirectly call itself recursively.
Solved by dropping the list of lookups from the client object before the
lookups are destroyed.
Timo Sirainen [Fri, 10 Oct 2014 15:11:58 +0000 (18:11 +0300)]
maildir: Don't limit uidlist line lengths to 4096 bytes.
Although this always indicates corruption, the current code doesn't handle
that very nicely. One fix would be to just ignore such long lines, but this
is easier to implement..
Stephan Bosch [Thu, 9 Oct 2014 21:46:15 +0000 (00:46 +0300)]
lib-http: client: Fixed assert crash occurring when DNS lookup fails immediately during request submission.
In that situation, the request was not dropped from the queue immediately, triggering the assert crash.
Timo Sirainen [Thu, 9 Oct 2014 15:23:41 +0000 (18:23 +0300)]
lib-index: Replaced some automatic transaction log unlocks with asserts.
Some earlier Dovecot versions were read-locking transaction logs and this
was useful there. But now we only do exclusive locking for the log head, so
it's an error not to explicitly unlock the files.
Timo Sirainen [Thu, 9 Oct 2014 15:19:11 +0000 (18:19 +0300)]
maildir: Use MAIL_TRANSACTION_LOG_LOCK_WARN_SECS as threshold for logging a "long sync" warning.
This is because the index syncing keeps the log locked, and other processes
trying to lock the log will start logging warnings as well.
Timo Sirainen [Thu, 9 Oct 2014 15:14:43 +0000 (18:14 +0300)]
lib: o_stream_send_istream() shouldn't ignore EINTRs for file ostreams.
Also added extra asserts to make sure that either we return an error or we
write everything from input stream to output stream. This should make it
safe to write to files using just:
if (o_stream_send_istream(ostream, istream) < 0) {
// failed
} else {
// everything in istream was written to ostream
}
Timo Sirainen [Thu, 9 Oct 2014 13:42:01 +0000 (16:42 +0300)]
lib-storage: If uncached header unfolding fails, panic instead of returning error.
This really shouldn't be happening. This also makes it clear that return
value -1 means some kind of I/O error instead of corruption.
Timo Sirainen [Thu, 9 Oct 2014 13:41:23 +0000 (16:41 +0300)]
lib-storage: Fixed header parsing when there were multiple same header names.
For example if a mail had:
Name1: a
Name1: b
Name2: c
If the Name1: was initially added to cache and Name2: not, but later on both
were attempted to be added to cache, the Name2: lookup would have been added
with "b" instead of "c" value.
Timo Sirainen [Tue, 7 Oct 2014 17:13:36 +0000 (20:13 +0300)]
lib-index: Fixed assert-crash in some cache locking race conditions.
If mail_index_map() is being called, we can't refresh the index or it'll
crash. It wouldn't help anyway, since the index was just refreshed.
Timo Sirainen [Tue, 7 Oct 2014 16:07:16 +0000 (19:07 +0300)]
lib-index: Delay unlocking cache compression until changes to transaction log are committed.
This should fix race condition with two processes compressing the file at
the same time with same file_seq and becoming confused.
Timo Sirainen [Tue, 7 Oct 2014 16:04:36 +0000 (19:04 +0300)]
lib-index: Added path parameter to mail_index_create_tmp_file()
This allows using it for creating any kind of a new index file with proper
file permissions.
Some of the old code should probably be changed to use this. Maybe even move
this function to public mail-index.h
Timo Sirainen [Tue, 7 Oct 2014 15:58:01 +0000 (18:58 +0300)]
lib-index: Try to minimize race conditions while compressing cache.
There are some unavoidable race conditions, but try to keep their time
window as small as possible.
Timo Sirainen [Tue, 7 Oct 2014 15:47:09 +0000 (18:47 +0300)]
lib-index: mail_cache_lock() partial rewrite.
require_same_reset_id is no longer needed, if it ever was. If we're locking
the cache file, we always want the latest one. The logic of locking in
general was somewhat confusing and it probably didn't always successfully
lock when it should have, because the reset_id happened to match an old
file.
Timo Sirainen [Mon, 6 Oct 2014 23:35:41 +0000 (02:35 +0300)]
lib-index: Fixed cache file creation race condition.
If two processes are creating the index files at the same time, don't have
one of them delete the dovecot.index.cache that the other one just created.
This means we never should be calling mail_cache_create(), so it was removed
entirely.
Timo Sirainen [Mon, 6 Oct 2014 23:33:03 +0000 (02:33 +0300)]
lib-index: Don't keep cache file locked for as long while syncing index.
The earlier code was required for updating the cache offsets, but this code
no longer exists. Now we just need to update the record counts in the
header, which can be done quickly at the end of the sync.
Timo Sirainen [Mon, 6 Oct 2014 09:21:24 +0000 (12:21 +0300)]
doveadm backup: When deleting a mailbox, log a warning, not just a debug message.
Because we're also returning temporary failure in any case, so there needs
to be some kind of a warning/error logged.
Stephan Bosch [Sat, 4 Oct 2014 14:32:48 +0000 (17:32 +0300)]
lib-http: Fixed detecting disconnection when ioloop is running only intermittently.
This fix only applies to ioloops created and run by lib-http itself.
Stephan Bosch [Sat, 4 Oct 2014 14:31:38 +0000 (17:31 +0300)]
lib: Fixed io_loop_move_timeout() to retain the next_run time, so that the timeout is not implicitly reset.
This problem became with timeout_add_absolute(), since resetting an
absolute timeout causes it to fire immediately (msecs == 0).
Stephan Bosch [Sat, 4 Oct 2014 14:30:54 +0000 (17:30 +0300)]
lib-http: client: Fixed problem occuring when a nested ioloop was run inside a request callback using the same client.
If requests in the nested ioloop would use the same connection as the one
that called the callback, the requests would (in the best scenario) all be
doomed to time out.