nextcloud / mail

💌 Mail app for Nextcloud
https://apps.nextcloud.com/apps/mail
GNU Affero General Public License v3.0
831 stars 257 forks source link

Mailaccount in an infinite loading loop & spamming the log #5998

Open MiningPickaxe opened 2 years ago

MiningPickaxe commented 2 years ago

Expected behavior

After setting up a mail account I would expect the messages to load

Actual behavior

Infinite loading loop, never finishes. The log gets spammed with this:

{
   "reqId":"Mw5i4oBj8zZexq6z4vCX",
   "level":3,
   "time":"2022-01-29T14:48:32+01:00",
   "remoteAddr":"XXX.XXX.XXX.19",
   "user":"someuser",
   "app":"mail",
   "method":"POST",
   "url":"/apps/mail/api/mailboxes/1/sync",
   "message":"Sync failed for 1:INBOX: mb_convert_encoding(): Argument #3 ($from_encoding) contains invalid encoding \"unknown\"",
   "userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36",
   "version":"23.0.0.10",
   "exception":{
      "Exception":"OCA\\Mail\\Exception\\ServiceException",
      "Message":"Sync failed for 1:INBOX: mb_convert_encoding(): Argument #3 ($from_encoding) contains invalid encoding \"unknown\"",
      "Code":0,
      "Trace":[
         {
            "file":"/var/www/nextcloud/apps/mail/lib/Service/Sync/SyncService.php",
            "line":127,
            "function":"sync",
            "class":"OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer",
            "type":"->"
         },
         {
            "file":"/var/www/nextcloud/apps/mail/lib/Controller/MailboxesController.php",
            "line":161,
            "function":"syncMailbox",
            "class":"OCA\\Mail\\Service\\Sync\\SyncService",
            "type":"->"
         },
         {
            "file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
            "line":217,
            "function":"sync",
            "class":"OCA\\Mail\\Controller\\MailboxesController",
            "type":"->"
         },
         {
            "file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
            "line":126,
            "function":"executeController",
            "class":"OC\\AppFramework\\Http\\Dispatcher",
            "type":"->"
         },
         {
            "file":"/var/www/nextcloud/lib/private/AppFramework/App.php",
            "line":157,
            "function":"dispatch",
            "class":"OC\\AppFramework\\Http\\Dispatcher",
            "type":"->"
         },
         {
            "file":"/var/www/nextcloud/lib/private/Route/Router.php",
            "line":302,
            "function":"main",
            "class":"OC\\AppFramework\\App",
            "type":"::"
         },
         {
            "file":"/var/www/nextcloud/lib/base.php",
            "line":1006,
            "function":"match",
            "class":"OC\\Route\\Router",
            "type":"->"
         },
         {
            "file":"/var/www/nextcloud/index.php",
            "line":36,
            "function":"handleRequest",
            "class":"OC",
            "type":"::"
         }
      ],
      "File":"/var/www/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php",
      "Line":249,
      "Previous":{
         "Exception":"ValueError",
         "Message":"mb_convert_encoding(): Argument #3 ($from_encoding) contains invalid encoding \"unknown\"",
         "Code":0,
         "Trace":[
            {
               "file":"/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Util/Horde/String.php",
               "line":160,
               "function":"mb_convert_encoding"
            },
            {
               "file":"/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Util/Horde/String.php",
               "line":96,
               "function":"_convertCharset",
               "class":"Horde_String",
               "type":"::"
            },
            {
               "file":"/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Mime/Horde/Mime.php",
               "line":259,
               "function":"convertCharset",
               "class":"Horde_String",
               "type":"::"
            },
            {
               "file":"/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Mime/Horde/Mime/Headers/Element/Single.php",
               "line":62,
               "function":"decode",
               "class":"Horde_Mime",
               "type":"::"
            },
            {
               "file":"/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Mime/Horde/Mime/Headers/Element.php",
               "line":79,
               "function":"_setValue",
               "class":"Horde_Mime_Headers_Element_Single",
               "type":"->"
            },
            {
               "file":"/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Mime/Horde/Mime/Headers/Element.php",
               "line":56,
               "function":"setValue",
               "class":"Horde_Mime_Headers_Element",
               "type":"->"
            },
            {
               "file":"/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Mime/Horde/Mime/Headers/Subject.php",
               "line":31,
               "function":"__construct",
               "class":"Horde_Mime_Headers_Element",
               "type":"->"
            },
            {
               "file":"/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Mime/Horde/Mime/Headers.php",
               "line":201,
               "function":"__construct",
               "class":"Horde_Mime_Headers_Subject",
               "type":"->"
            },
            {
               "file":"/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Data/Envelope.php",
               "line":160,
               "function":"addHeader",
               "class":"Horde_Mime_Headers",
               "type":"->"
            },
            {
               "file":"/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Socket.php",
               "line":3518,
               "function":"__set",
               "class":"Horde_Imap_Client_Data_Envelope",
               "type":"->"
            },
            {
               "file":"/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Socket.php",
               "line":3168,
               "function":"_parseEnvelope",
               "class":"Horde_Imap_Client_Socket",
               "type":"->"
            },
            {
               "file":"/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Socket.php",
               "line":4778,
               "function":"_parseFetch",
               "class":"Horde_Imap_Client_Socket",
               "type":"->"
            },
            {
               "file":"/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Socket.php",
               "line":4575,
               "function":"_serverResponse",
               "class":"Horde_Imap_Client_Socket",
               "type":"->"
            },
            {
               "file":"/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Socket.php",
               "line":4314,
               "function":"_getLine",
               "class":"Horde_Imap_Client_Socket",
               "type":"->"
            },
            {
               "file":"/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Socket.php",
               "line":4242,
               "function":"_sendCmdChunk",
               "class":"Horde_Imap_Client_Socket",
               "type":"->"
            },
            {
               "file":"/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Socket.php",
               "line":2837,
               "function":"_sendCmd",
               "class":"Horde_Imap_Client_Socket",
               "type":"->"
            },
            {
               "file":"/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Base.php",
               "line":2722,
               "function":"_fetch",
               "class":"Horde_Imap_Client_Socket",
               "type":"->"
            },
            {
               "file":"/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Base.php",
               "line":2478,
               "function":"_fetchWrapper",
               "class":"Horde_Imap_Client_Base",
               "type":"->"
            },
            {
               "file":"/var/www/nextcloud/apps/mail/lib/IMAP/MessageMapper.php",
               "line":226,
               "function":"fetch",
               "class":"Horde_Imap_Client_Base",
               "type":"->"
            },
            {
               "file":"/var/www/nextcloud/apps/mail/lib/IMAP/MessageMapper.php",
               "line":195,
               "function":"findByIds",
               "class":"OCA\\Mail\\IMAP\\MessageMapper",
               "type":"->"
            },
            {
               "file":"/var/www/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php",
               "line":294,
               "function":"findAll",
               "class":"OCA\\Mail\\IMAP\\MessageMapper",
               "type":"->"
            },
            {
               "file":"/var/www/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php",
               "line":226,
               "function":"runInitialSync",
               "class":"OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer",
               "type":"->"
            },
            {
               "file":"/var/www/nextcloud/apps/mail/lib/Service/Sync/SyncService.php",
               "line":127,
               "function":"sync",
               "class":"OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer",
               "type":"->"
            },
            {
               "file":"/var/www/nextcloud/apps/mail/lib/Controller/MailboxesController.php",
               "line":161,
               "function":"syncMailbox",
               "class":"OCA\\Mail\\Service\\Sync\\SyncService",
               "type":"->"
            },
            {
               "file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
               "line":217,
               "function":"sync",
               "class":"OCA\\Mail\\Controller\\MailboxesController",
               "type":"->"
            },
            {
               "file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
               "line":126,
               "function":"executeController",
               "class":"OC\\AppFramework\\Http\\Dispatcher",
               "type":"->"
            },
            {
               "file":"/var/www/nextcloud/lib/private/AppFramework/App.php",
               "line":157,
               "function":"dispatch",
               "class":"OC\\AppFramework\\Http\\Dispatcher",
               "type":"->"
            },
            {
               "file":"/var/www/nextcloud/lib/private/Route/Router.php",
               "line":302,
               "function":"main",
               "class":"OC\\AppFramework\\App",
               "type":"::"
            },
            {
               "file":"/var/www/nextcloud/lib/base.php",
               "line":1006,
               "function":"match",
               "class":"OC\\Route\\Router",
               "type":"->"
            },
            {
               "file":"/var/www/nextcloud/index.php",
               "line":36,
               "function":"handleRequest",
               "class":"OC",
               "type":"::"
            }
         ],
         "File":"/var/www/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Util/Horde/String.php",
         "Line":160
      },
      "CustomMessage":"Sync failed for 1:INBOX: mb_convert_encoding(): Argument #3 ($from_encoding) contains invalid encoding \"unknown\""
   },
   "id":"61f545b10a952"
}

Mail app

Mail app version: 1.11.6

Mailserver or service: iCloud

Server configuration

Operating system: Debian 11

Web server: Apache2 2.4.52-1~deb11u2

Database: MariaDB 1:10.5.12-0+deb11u1

PHP version: 8.0.14-1+0\~20211220.28+debian11~1.gbpad68c7

Nextcloud Version: 23.0.0

Client configuration

Browser: Chrome 97

Operating system: Mac OS X 10.13

miaulalala commented 2 years ago

Any special language or RTL encoding in this email? Because there is a similar issue here: #5845

miaulalala commented 2 years ago

Oh, I also see you're using iCloud. There's known issues with iCloud accounts too. But interesting that this fails on the encoding, not the SEARCH_MAX query.

MiningPickaxe commented 2 years ago

Any special language or RTL encoding in this email?

Not that I know of - there are mails of 20 years in there, so there might be some odd encodings. Polish characters might be in some of the mails and there might be a spam mail here or there that hasn't been deleted and could contain special characters.

It was finally able to load after ~1h or so, might have been just the amount of emails that took so long

Luncheon3462 commented 10 months ago

Bump