Stephan Bosch [Fri, 10 Apr 2020 15:57:54 +0000 (17:57 +0200)]
m4: dovecot.m4 - Run valgrind with --error-exitcode=213 parameter in generated run-test.sh.
This way, test child processes will indicate valgrind failure with exit code
1000, making unit tests properly fail even though the actual test performed by
the child process succeeded.
Stephan Bosch [Sat, 4 Apr 2020 09:37:55 +0000 (11:37 +0200)]
Add Valgrind suppression for external problem exposed by src/lib-http/test-http-payload.
There is a memory problem in OpenSSL somewhere.
Valgrind output:
==9380== Invalid read of size 8
==9380== at 0x48635A5: check_free (dlerror.c:188)
==9380== by 0x4863AB1: free_key_mem (dlerror.c:221)
==9380== by 0x4863AB1: __dlerror_main_freeres (dlerror.c:239)
==9380== by 0x49DEB71: __libc_freeres (in /lib/x86_64-linux-gnu/libc-2.28.so)
==9380== by 0x482D19E: _vgnU_freeres (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_core-amd64-linux.so)
==9380== by 0x15C528: test_exit (test-common.c:389)
==9380== by 0x12D522: test_run_client_server.constprop.11 (test-http-payload.c:1435)
==9380== by 0x12D904: test_run_sequential (test-http-payload.c:1488)
==9380== by 0x12E5A6: test_download_server_nonblocking (test-http-payload.c:1579)
==9380== by 0x15B98D: test_run_funcs (test-common.c:282)
==9380== by 0x15C2D0: test_run (test-common.c:353)
==9380== by 0x12C647: main (test-http-payload.c:2075)
==9380== Address 0x4de7988 is 12 bytes after a block of size 12 alloc'd
==9380== at 0x483577F: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==9380== by 0x4C5C328: CRYPTO_zalloc (mem.c:230)
==9380== by 0x4C5856D: ossl_init_get_thread_local (init.c:66)
==9380== by 0x4C5856D: ossl_init_get_thread_local (init.c:59)
==9380== by 0x4C5856D: ossl_init_thread_start (init.c:465)
==9380== by 0x4C81CB9: RAND_DRBG_get0_public (drbg_lib.c:1118)
==9380== by 0x4C81CEF: drbg_bytes (drbg_lib.c:963)
==9380== by 0x486EDF2: ssl_iostream_openssl_init (iostream-openssl.c:928)
==9380== by 0x12C56A: main_init (test-http-payload.c:2031)
==9380== by 0x12C56A: main (test-http-payload.c:2058)
==9380==
Timo Sirainen [Thu, 9 Apr 2020 12:55:59 +0000 (15:55 +0300)]
lib: Reverse comment about io_loop_stop() being safe to call in signal handlers
It is not safe. First there's the issue that ioloop.running is a bitmask,
but secondly there's a race condition between io_loop_stop() and the arrival
of the last timeout and/or IO event. It can end up running epoll_wait() with
only a stale IO and no timeouts, which hangs indefinitely.
Timo Sirainen [Mon, 11 May 2020 16:00:25 +0000 (19:00 +0300)]
pop3: Use separate search queries for expunging and setting \Seen flags
Using a single shared search query causes mail prefetching to behave
inefficiently. Especially lazy_expunge plugin could have done refcount
prefetch for non-deleted mails as well.
Timo Sirainen [Thu, 14 May 2020 19:52:34 +0000 (22:52 +0300)]
dict: Fix deinitializing dict iteration if client disconnects
If the client's ostream was full at the disconnection time, the iteration
wasn't aborted. Instead, the connection was kept forever and its input
callback was kept being called rapidly, causing 100% CPU usage.
Timo Sirainen [Mon, 11 May 2020 14:23:19 +0000 (17:23 +0300)]
lib-index: Fix setting initial last_used for fields in mail_[always_]cache_fields
These fields had last_used=0 until the field was accessed. If cache was
purged before this access, the field was dropped. Fixed by assuming
(last_used=0, decision!=NO) is still the first time the field is being
used. This also causes it to trigger mail_cache_decision_changed event.
Stephan Bosch [Tue, 28 Apr 2020 17:28:48 +0000 (19:28 +0200)]
lib-http: http-server-response - Fix return value of http_server_response_send*().
Make sure 1 is returned when all that can be sent is sent. It must not return 0
when the payload input stream is blocking or when the payload output stream
buffer has no data to be sent.
Timo Sirainen [Thu, 31 Oct 2019 13:56:58 +0000 (15:56 +0200)]
lib: connection_input_resume() - Set added IO as having pending input
This makes sense, because when the connection is halted it might already
have input pending in the istream. So doing this always automatically
can prevent unexpected hangs. It shouldn't be harmful to do this even if
there's no input pending.
stats: Rename 'name' to 'metric_name' in metric { } blocks
There was a decent amount of confusion about what what the 'name' setting
meant. In short,
metric foo {
...
}
was equivalent to:
metric {
name = foo
...
}
Unfortunately, this was often misunderstood as "the name of the *event* we
are interested in". To avoid this confusion, we rename the setting to
'metric_name'. So, from now on, if you want to specify the name inside the
metric block (instead of before the '{'), you must use:
Stephan Bosch [Thu, 23 Apr 2020 13:21:06 +0000 (15:21 +0200)]
lib-http: http-server-ostream - Handle finished request as a separate event.
While waiting in the flush ioloop, the request will not be destroyed, in which
case the ioloop will potentially never end. This is fixed by notifying the
wrapper output stream about the parent output stream going away, which
interrupts the ioloop in the process.