Stephan Bosch [Sat, 18 Apr 2020 10:56:14 +0000 (12:56 +0200)]
m4: Fix configuration of libunwind on i386 (and probably other systems).
Use the standard libunwind-coredump instead of the system-dependent library.
This way, all can be configured using pkg-config, without relying on a failed
attempt to use the $build_cpu variable to find the system-dependent library.
This fails on i386 and probably other systems as well.
Timo Sirainen [Wed, 25 Mar 2020 13:52:02 +0000 (15:52 +0200)]
lib-imap: imap_arg_get/as_nstring() - fail if input is an atom
Atoms were wrongly allowed in these places.
These have been used in very few places, so this change should be pretty
safe to do. The only affected places are:
* SETMETADATA - Backwards compatibility preserved by earlier commit
* ID - It's not expected that any clients use atoms here
* imapc - Server replies are parsed more strictly now
lib: event-filter - Use p_strdup() instead of p_strdup_empty() to avoid NULLs
The code used p_strdup_empty() in an (incorrect) attempt to avoid NULLs
turning into empty strings (""). None of the strdup variants do this.
However, p_strdup_empty() converts empty strings to NULLs. This caused a
NULL pointer dereference later on.
lib: event-filter - Implement filter boolean expression unit tests
This is a exhaustive test of the boolean operators using field equality
comparisons. This test code focuses on the boolean operators (AND, OR,
NOT) and not on the comparison operators (=, <, >, <=, and >=) and their
arguments (event names, source locations, categories).
lib: event-filter - Make NOT operator right associative and higher precedence
For example, consider the filter:
event=* AND
NOT event=foo AND
NOT event=bar AND
NOT event=baz
The "NOT" operator is supposed to be bound to the comparisons to the
immediate right. That is, it supposed to be equivalent to:
event=* AND
(NOT event=foo) AND
(NOT event=bar) AND
(NOT event=baz)
Both of these should produce the following parse tree:
AND
AND
AND
EQ EVENT '*'
NOT
EQ EVENT 'foo'
NOT
EQ EVENT 'bar'
NOT
EQ EVENT 'baz'
Instead, before this commit, the NOTs were getting bound to the entire
sub-expression to the right. Therefore, the original filter expression
was being parsed as if it were:
event=* AND
NOT (event=foo AND
NOT (event=bar AND
NOT event=baz))
Which produced the following parse tree:
AND
EQ EVENT '*'
NOT
AND
EQ EVENT 'foo'
NOT
AND
EQ EVENT 'bar'
NOT
EQ EVENT 'baz'
Siavash Tavakoli [Mon, 21 Dec 2020 10:45:32 +0000 (10:45 +0000)]
indexer: Remove worker-specific request queue
- Each request is done in a single connection and indexer master disconnects
from worker after indexing job is complete.
- No need to keep a worker queue since it always have length of 1. Instead,
keep a pointer to indexer_request for each worker connection.
- If indexing is in progress for a user, don't try to use the same connection
when a new request arrives for the same user. Instead, move the request to the
back of the queue and wait for the in progress request to finish then
create a new connection and submit request to worker.
Siavash Tavakoli [Sun, 20 Dec 2020 19:45:09 +0000 (19:45 +0000)]
indexer: Cleanup idle_list from worker pool
- Indexer always disconnects from worker process, no need to keep a list
of idle processes.
- The callback already calls worker_pool_release_connection every time worker
updated percentage. Defer disconnecting from working to the callback.
It checks if the request is completed and destroys connection.
Timo Sirainen [Wed, 20 May 2020 10:42:22 +0000 (13:42 +0300)]
lib: hash - Add assert to make sure hash table doesn't grow beyond UINT_MAX nodes
hash_table_count() returns unsigned int, so the node count can't be larger.
It's internally also tracked as unsigned int currently. It should be large
enough for all practical use cases.
lib-lua: Make DLUA_REQUIRE_ARGS*() take the lua_State * directly
This is the first in a series of commits that convert a number of functions
to pass around the lua_State pointer directly and to use it instead of using
the lua_State pointed to by the struct dlua_script.
This change is needed to eventually support the 'yield' functionality and
"sequential looking, but async behind the scenes" lua scripts. To support
this, the C code needs to instantiate multiple lua_States and then operate
on the correct one - whichever one is passed back by the lua runtime. This
lays the ground work for that.
Timo Sirainen [Thu, 22 Oct 2020 19:49:56 +0000 (22:49 +0300)]
lib-storage: Detect corrupted mail size when calculating body size
When body size is calculated from message size - header size, make sure that
the message size is at least as large as the header size. Otherwise treat
the message size as corrupted.
Siavash Tavakoli [Sun, 22 Nov 2020 19:16:03 +0000 (19:16 +0000)]
stats: openmetrics: Do not duplicate counter and duration metrics for histograms
Histograms generate "_count" and "_sum" metrics either for each quantile or
for the whole distribution. This patch prevents creating a duplicate metric
with type counter which results in metric name collision.
Timo Sirainen [Mon, 21 Dec 2020 19:24:50 +0000 (21:24 +0200)]
lib-master, master: Add "worker" service type
The worker services are expected to reach their process_limit regularly.
There shouldn't be a warning logged about temporarily reaching the limit,
since it can happen due to race conditions.