mail icon indicating copy to clipboard operation
mail copied to clipboard

Searching results in "Could not open inbox" most of the time (approx. 9/10 cases)

Open nagmat84 opened this issue 1 year ago • 2 comments

Steps to reproduce

  1. Go to inbox
  2. Type something into the search input field
  3. Wait (approx. 30s)
  4. 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.

nagmat84 avatar May 23 '24 18:05 nagmat84

I've seen this before. It could be related to #9168 especially if you've deleted/moved the email using a different email client.

meichthys avatar May 23 '24 19:05 meichthys

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.

BiglifeMatt avatar Aug 02 '24 13:08 BiglifeMatt

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 avatar Dec 13 '24 16:12 BiglifeMatt

@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?

SebastianKrupinski avatar Dec 13 '24 16:12 SebastianKrupinski