Closed doits closed 1 month ago
One thing I noticed which maybe helps: When I delete the dovecot.index{,.log}
files and access the virtual folder, the first access is successful and it displays the messages according to the imap filter. The dovecot.index
is created on access. But accessing the folder a second time leads to the panic mentioned above.
Sorry, one more information, actually it is like this:
dovecot.index{,.log}
files allows to access the virtual folderdovecot.index
gets recreated on access and the folder can be accessed multiple timesdovecot.index{,.log}
restores access again and the e-mails are still marked as read (so this information is not lost), until the next e-mail is marked as read: then the folder cannot be accessed againDisabling indexes with location = virtual:~/virtual:LAYOUT=maildir++:INDEX=MEMORY
is a work around and fixes the error, though I get a lot of different imap: Error: terminate called after throwing an instance of 'std::bad_alloc'
when accessing the folders (I guess out of memory or something), and one of my email clients (thunderbird) redownloads the whole folder on every access – so no usable workaround
And I got another panic on file index-search-result.c: line 174 (index_search_result_update_appends): assertion failed: (result->search_args->args == &search_arg), which seems to be the same assertion.
Is there anything I can do to help you debug it? Can you reproduce it? AFAIK to reproduce it, it should be enough to create some virtual folders with the above imap filters.
I haven't been able to look at this yet. Maybe soon.
This is not a flatcurve bug - it is a bug within Dovecot's indexing/fts handling.
(Detailed debug below, so that core team can understand the problem.)
As discussed above, this bug is triggered with virtual mailboxes on subsequent accesses. The initial access will work fine; the assert crash only happens when the Dovecot lib-storage index code reads the indexes created for the virtual mailboxes.
index_search_result_update_appends()
in lib-storage/index/index-search-result.c
i_assert(result->search_args->args == &search_arg);
The search args are being altered in plugins/fts/fts-search.args.c, fts_search_args_expand()
. Specifically, in that function, either fts_search_args_expand_language_top_level()
or fts_search_args_expand_tree()
is being called, which can replace the current args parameter with a new pointer.
fts_search_args_expand()
is being called in plugins//fts/fts-search.c by fts_search_try_lookup()
when the FTS backend has the FTS_BACKEND_FLAG_TOKENIZED_INPUT flag set. Flatcurve has this flag set.
This flag is defined in plugins/fts/fts-api-private.h. Comments say:
/* Tokenize all the input. update_build_more() will be called a single
directly indexable token at a time. Searching will modify the search
args so that lookup() sees only tokens that can be directly
searched. */
Thus, the comments explicitly say the search args will be modified if this flag is set. This modification is incompatible with the assert check in index_search_result_update_appends()
, which requires that the search args not be modified.
The core team will have to determine whether this behavior is correct, or if the assert check is invalid.
Closing here, as this appears to be triggered by flatcurve simply because it sets the FTS_BACKEND_FLAG_TOKENIZED_INPUT flag. But that's not a bug.
Thanks for the investigations and detailed feedback!
Do you know how to contact the dovecot team about this since https://github.com/dovecot/core has issues disabled? 🤔
(Maybe you should leave this issue open so others with the same problem find it, even if it has to be fixed at dovecot core)
Ah sorry, found it, I'll write a bug report by https://www.dovecot.org/bugreport-mail/
Ah, sorry, should have posted here: I already created an internal Bug ticket for this issue (internal ID DOP-3616). It's waiting for the team to triage.
Any news about this? Is it maybe possible to view the internal issue for me, so I can follow it myself?
I have to following panics with flatcurve enabled:
Panic line 132
``` Panic: file index-search-result.c: line 132 (index_search_result_update_flags): assertion failed: (result->search_args->args == &search_arg) Error: Raw backtrace: /usr/lib/dovecot/libdovecot.so.0(backtrace_append+0x46) [0x74e9890a2846] -> /usr/lib/dovecot/libdovecot.so.0(backtrace_get+0x22) [0x74e9890a2962] -> /usr/lib/dovecot/libdovecot.so.0(+0x10d81b) [0x74e9890af81b] -> /usr/lib/dovecot/libdovecot.so.0(+0x10d8b7) [0x74e9890af8b7] -> /usr/lib/dovecot/libdovecot.so.0(+0x5e2e2) [0x74e9890002e2] -> /usr/lib/dovecot/libdovecot-storage.so.0(+0x518a4) [0x74e9891d38a4] -> /usr/lib/dovecot/modules/lib20_virtual_plugin.so(virtual_storage_sync_init+0x274e) [0x74e988bf8a9e] -> /usr/lib/dovecot/libdovecot-storage.so.0(mailbox_sync_init+0x5c) [0x74e9891eff9c] -> /usr/lib/dovecot/libdovecot-storage.so.0(mailbox_sync+0x39) [0x74e9891f0039] -> dovecot/imap(cmd_select_full+0x1df) [0x62354bd8326f] -> dovecot/imap(command_exec+0xa4) [0x62354bd8b444] -> dovecot/imap(+0x22392) [0x62354bd89392] -> dovecot/imap(+0x22444) [0x62354bd89444] -> dovecot/imap(client_handle_input+0x1bd) [0x62354bd8989d] -> dovecot/imap(client_input+0x74) [0x62354bd89e64] -> /usr/lib/dovecot/libdovecot.so.0(io_loop_call_io+0x6d) [0x74e9890c603d] -> /usr/lib/dovecot/libdovecot.so.0(io_loop_handler_run_internal+0x13a) [0x74e9890c77aa] -> /usr/lib/dovecot/libdovecot.so.0(io_loop_handler_run+0x54) [0x74e9890c60e4] -> /usr/lib/dovecot/libdovecot.so.0(io_loop_run+0x40) [0x74e9890c62a0] -> /usr/lib/dovecot/libdovecot.so.0(master_service_run+0x17) [0x74e989036ad7] -> dovecot/imap(main+0x570) [0x62354bd7ad20] -> /lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x74e988c29d90] -> /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80) [0x74e988c29e40] -> dovecot/imap(_start+0x25) [0x62354bd7ade5] ```It happens when accessing some virtual mailboxes.
Example of
dovecot-virtual
virtual mailboxes that produce this error:Example where it works:
When I comment out
fts = flatcurve
in dovecot configuration, the error is gone.Configuration of flatcurve:
Configuration of virtual folders:
Error feels similar to #61.
Dovecot 2.3.21 (47349e2482) and flatcure compiled from 0748ec9c4949275ad2dc6a6979ff2cc404fc5187.
Can you maybe reproduce the problem with this information? How can we debug this further?