Searching results in "Could not open inbox" most of the time (approx. 9/10 cases)
Steps to reproduce
- Go to inbox
- Type something into the search input field
- Wait (approx. 30s)
- Get error message "Could not open inbox" most of the time (approx. 9/10 cases)
Expected behavior
See the actual mails which match the search.
Actual behavior
I get the message "Could not open inbox".
Mail app version
3.6.1
Mailserver or service
Dovecot 2.3.20
Operating system
GNU/Linux
PHP engine version
PHP 8.2
Web server
Apache (supported)
Database
PostgreSQL
Additional info
I assume this is some kind of timeout related problem. In the least of cases (i.e. one out of ten attempts), I get the expected search result quite fast (after 2-3 seconds). However, most of the time I only get "could not open inbox" after approx. 30s of waiting.
Nextcloud Mail and Dovecot are hosted on the same server and communicating via the loopback interface. So, network latency should not be part of the problem. Also, the server is rather potent (AMD EPYC 7702P, 128G RAM).
When I run the same query via IMAP from another mail client (Thunderbird on Windows, KMail on Linux), I always receive the search result after a couple of seconds. And there is actual network communication involved between my home ISP and the hoster.
I've seen this before. It could be related to #9168 especially if you've deleted/moved the email using a different email client.
I have the same issue if I have the body search enabled or if I search in the body field in advanced search. But really the search results are always poor for me unless I can do the body search. Especially since the From search in the advanced search is not pulling addresses that are in my inbox but not in my contact lists.
At the same time that I get the Could Not Open Inbox message, this seems to be the corresponding results in the log:
{
"reqId": "d99XZ697RpkYqovI952X",
"level": 3,
"time": "2024-12-13T14:45:50+00:00",
"remoteAddr": "10.10.10.35",
"user": "m.coulter",
"app": "mail",
"method": "GET",
"url": "/index.php/apps/mail/api/messages?mailboxId=142&filter=subject:peter%2520+body:peter&limit=20",
"message": "Could not get message IDs: Error when communicating with the mail server.",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:133.0) Gecko/20100101 Firefox/133.0",
"version": "29.0.4.1",
"exception": {
"Exception": "OCA\\Mail\\Exception\\ServiceException",
"Message": "Could not get message IDs: Error when communicating with the mail server.",
"Code": 0,
"Trace": [
{
"file": "/var/www/nextcloud/apps/mail/lib/Service/Search/MailSearch.php",
"line": 177,
"function": "findMatches",
"class": "OCA\\Mail\\IMAP\\Search\\Provider",
"type": "->"
},
{
"file": "/var/www/nextcloud/apps/mail/lib/Service/Search/MailSearch.php",
"line": 135,
"function": "getIdsLocally",
"class": "OCA\\Mail\\Service\\Search\\MailSearch",
"type": "->"
},
{
"file": "/var/www/nextcloud/apps/mail/lib/Controller/MessagesController.php",
"line": 169,
"function": "findMessages",
"class": "OCA\\Mail\\Service\\Search\\MailSearch",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
"line": 232,
"function": "index",
"class": "OCA\\Mail\\Controller\\MessagesController",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
"line": 138,
"function": "executeController",
"class": "OC\\AppFramework\\Http\\Dispatcher",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
"line": 184,
"function": "dispatch",
"class": "OC\\AppFramework\\Http\\Dispatcher",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/private/Route/Router.php",
"line": 338,
"function": "main",
"class": "OC\\AppFramework\\App",
"type": "::"
},
{
"file": "/var/www/nextcloud/lib/base.php",
"line": 1050,
"function": "match",
"class": "OC\\Route\\Router",
"type": "->"
},
{
"file": "/var/www/nextcloud/index.php",
"line": 49,
"function": "handleRequest",
"class": "OC",
"type": "::"
}
],
"File": "/var/www/nextcloud/apps/mail/lib/IMAP/Search/Provider.php",
"Line": 59,
"Previous": {
"Exception": "Horde_Imap_Client_Exception",
"Message": "Error when communicating with the mail server.",
"Code": 28,
"Trace": [
{
"file": "/var/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php",
"line": 4560,
"function": "read",
"class": "Horde_Imap_Client_Socket_Connection_Socket",
"type": "->"
},
{
"file": "/var/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php",
"line": 4319,
"function": "_getLine",
"class": "Horde_Imap_Client_Socket",
"type": "->"
},
{
"file": "/var/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php",
"line": 4243,
"function": "_sendCmdChunk",
"class": "Horde_Imap_Client_Socket",
"type": "->"
},
{
"file": "/var/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php",
"line": 2478,
"function": "_sendCmd",
"class": "Horde_Imap_Client_Socket",
"type": "->"
},
{
"file": "/var/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Base.php",
"line": 2282,
"function": "_search",
"class": "Horde_Imap_Client_Socket",
"type": "->"
},
{
"file": "/var/www/nextcloud/apps/mail/lib/IMAP/Search/Provider.php",
"line": 56,
"function": "search",
"class": "Horde_Imap_Client_Base",
"type": "->"
},
{
"file": "/var/www/nextcloud/apps/mail/lib/Service/Search/MailSearch.php",
"line": 177,
"function": "findMatches",
"class": "OCA\\Mail\\IMAP\\Search\\Provider",
"type": "->"
},
{
"file": "/var/www/nextcloud/apps/mail/lib/Service/Search/MailSearch.php",
"line": 135,
"function": "getIdsLocally",
"class": "OCA\\Mail\\Service\\Search\\MailSearch",
"type": "->"
},
{
"file": "/var/www/nextcloud/apps/mail/lib/Controller/MessagesController.php",
"line": 169,
"function": "findMessages",
"class": "OCA\\Mail\\Service\\Search\\MailSearch",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
"line": 232,
"function": "index",
"class": "OCA\\Mail\\Controller\\MessagesController",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
"line": 138,
"function": "executeController",
"class": "OC\\AppFramework\\Http\\Dispatcher",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
"line": 184,
"function": "dispatch",
"class": "OC\\AppFramework\\Http\\Dispatcher",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/private/Route/Router.php",
"line": 338,
"function": "main",
"class": "OC\\AppFramework\\App",
"type": "::"
},
{
"file": "/var/www/nextcloud/lib/base.php",
"line": 1050,
"function": "match",
"class": "OC\\Route\\Router",
"type": "->"
},
{
"file": "/var/www/nextcloud/index.php",
"line": 49,
"function": "handleRequest",
"class": "OC",
"type": "::"
}
],
"File": "/var/www/nextcloud/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket/Connection/Socket.php",
"Line": 241
},
"message": "Could not get message IDs: Error when communicating with the mail server.",
"exception": [],
"CustomMessage": "Could not get message IDs: Error when communicating with the mail server."
},
"id": "675c48a191d5b"
}
@BiglifeMatt
Looks like the app is having an issue connecting to your mail server.
"Could not get message IDs: Error when communicating with the mail server."
Any chance you can turn on debugging and try to capture this in the hored_imap.log?