nextcloud / mail

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

SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'message_id' at row 1 #9102

Open pbek opened 9 months ago

pbek commented 9 months ago

Steps to reproduce

@ChristophWurst, as follow-up to #3154, I still get a OCA\Mail\Exception\ServiceException: Sync failed for 7:Junk: An exception occurred while executing a query: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'message_id' at row 1 in my Spam folder with Mail 3.4.4 on Nextcloud 27.1.4.

message_id in oc_mail_messages is varchar(1023) with utf8mb4_bin.

I guess there are spam mails that don't follow the spec. 😓

  1. Try to open (Spam) mail folder in Nextcloud Mail
  2. New mails will not be shown
  3. Look at logs to get exception
[mail] Error: OCA\Mail\Exception\ServiceException: Sync failed for 7:Junk: An exception occurred while executing a query: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'message_id' at row 1 at <<closure>>

0. /var/www/html/custom_apps/mail/lib/Service/Sync/SyncService.php line 120
   OCA\Mail\Service\Sync\ImapToDbSynchronizer->sync("*** sensitive parameters replaced ***")
1. /var/www/html/custom_apps/mail/lib/Controller/MailboxesController.php line 153
   OCA\Mail\Service\Sync\SyncService->syncMailbox("*** sensitive parameters replaced ***")
2. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 230
   OCA\Mail\Controller\MailboxesController->sync("*** sensitive parameters replaced ***")
3. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 137
   OC\AppFramework\Http\Dispatcher->executeController(["OCA\\Mail\\Con ... "], "sync")
4. /var/www/html/lib/private/AppFramework/App.php line 183
   OC\AppFramework\Http\Dispatcher->dispatch(["OCA\\Mail\\Con ... "], "sync")
5. /var/www/html/lib/private/Route/Router.php line 315
   OC\AppFramework\App::main("OCA\\Mail\\Cont ... r", "sync", ["OC\\AppFramewo ... "], ["95","mail.mailboxes.sync"])
6. /var/www/html/lib/base.php line 1068
   OC\Route\Router->match("/apps/mail/api/mailboxes/95/sync")
7. /var/www/html/index.php line 36
   OC::handleRequest()

Expected behavior

Show new mails in the folder.

Actual behavior

New mails will not be shown

Mail app version

3.4.4

Mailserver or service

https://github.com/docker-mailserver/docker-mailserver

Operating system

Linux (Docker)

PHP engine version

PHP 8.2

Web server

Apache (supported)

Database

MariaDB

Additional info

No response

ChristophWurst commented 9 months ago

I guess we could just cut message ids at our own limit.

pbek commented 9 months ago

I guess we could just cut message ids at our own limit.

Sounds great! 😁

benklaasen commented 8 months ago

(Subscribing as I'm experiencing this attempting to fetch emails for a Gmail account of one of my users. )

kinghat commented 1 day ago

ive tried adding my gmail account a few times and it just says "loading messages" for weeks:

image

not sure if related but there are a lot of these in the logs:

ServiceException Sync failed for 2:INBOX: An exception occurred while executing a query: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'in_reply_to' at row 1 Cron mail sync failed for account 2

ServiceException Sync failed for 2:[Gmail]/All Mail: An exception occurred while executing a query: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'in_reply_to' at row 1

the size of the mail account is about 5GB from what i can tell. if there is any other info i can provide i would love to help get this working.