mail-in-a-box / mailinabox

Mail-in-a-Box helps individuals take back control of their email by defining a one-click, easy-to-deploy SMTP+everything else server: a mail server in a box.
https://mailinabox.email/
Creative Commons Zero v1.0 Universal
13.87k stars 1.43k forks source link

"Server Error: Failed to send UID SEARCH command" when searching large mailboxes #1715

Open ctrlaltdel opened 4 years ago

ctrlaltdel commented 4 years ago

See this forum post for an occurrence of this issue.

I'm experiencing the same issue while trying to find e-mail in a 6.2 GB folder (yeah... I know!).

Here's what dovecot logs in this case:

Jan 23 15:17:45 imap(XXX): Info: Connection closed (UID SORT running for 15.849 + waiting input for 0.001 secs, 0.001 in locks, 139 B in + 0 B out, state=wait-external) in=178 out=763

And roundcube displays a popup with the following message:

Server Error: Failed to send UID SEARCH command

A 15 seconds timeout looks a bit small, so I'll propose to raise it to something like 5 minutes. I don't see any obvious drawbacks in doing it by default.

jvolkenant commented 4 years ago

what is the search backend being used? afaik a FTS plugin is needed for searching now that lucene is gone after 14.04. Apparently dovecot does have an internal search https://doc.dovecot.org/configuration_manual/fts/ (Which I've never found to work on my 25k emails)

I run my own solr FTS backend from which I do search with dovecot. I modified php.ini's timeout and not nginx's config. https://github.com/mail-in-a-box/mailinabox/compare/master...jvolkenant:solr-jetty

The forum post above mentions the php.ini change but not one for nginx. Are both needed, or one or the other?

xenithorb commented 3 years ago

I am also seeing this. Maybe time to implement FTS by default?

Pattern in mail.log is (with dovecot debug enabled)

...
Sep 20 01:18:25 imap(server): Debug: Mailbox INBOX: Opened mail UID=19936 because: search
Sep 20 01:18:25 imap(server): Debug: Mailbox INBOX: Opened mail UID=19937 because: search
Sep 20 01:18:25 imap(server): Debug: Mailbox INBOX: Opened mail UID=19938 because: search
Sep 20 01:18:25 imap(server): Debug: Mailbox INBOX: Opened mail UID=19939 because: search
Sep 20 01:18:25 imap(server): Fatal: master: service(imap): child 4275 killed with signal 11 (core dumped)

With the following in the kernel logs:

[ 1245.581617] imap[4275]: segfault at 8 ip 00007f8d94068973 sp 00007ffd8d2586a0 error 4 in libdovecot.so.0.0.0[7f8d93fdf000+128000]

FYI the title's error msg is from within Roundcube, (so what most users will see) but this is not were the problem resides, as it's internal to dovecot. Only really seeing this after v0.48, but maybe I increased by mail count enough since the upgrade..

Any temporary fixes?

xenithorb commented 3 years ago

Note, In a hail-mary effort I just rebased @jvolkenant 's https://github.com/jvolkenant/mailinabox/tree/solr-jetty with v0.48 and all is well and searching now works for me after re-applying the install (start.sh). Thanks! Hopefully this is another +1 for returning a feature we lost with Bionic.

myfirstnameispaul commented 3 years ago

Just wondering if anyone has looked at creating a PR to add Solr to MiaB?

I have one mailbox that the search is getting a little slow for devices that don't store locally IMAP (Thunderbird seems to store IMAP locally, but Android.... no).

I suspect that as time goes on, this will be come an issue for more MiaB users.

Have to admit that I've never configured it before, so I don't know the requirements or other potential issues.

jvolkenant commented 3 years ago

You can use solr from my tree here https://github.com/jvolkenant/mailinabox/tree/solr-jetty , but it's not supported. Solr (really jetty) is a resource hog, but it works on my 1GB memory VM (with not much to spare)

myfirstnameispaul commented 3 years ago

Just out of curiosity, have you experimented with changing files format maildir to sdbox?

jvolkenant commented 3 years ago

I have not. I try to keep it as stock as possible since I use my MIAB box for testing patches I submit here.