Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
rohitsud opened this issue Jun 1, 2022 · 6 comments · May be fixed by #10178

Comments

@rohitsud
Copy link

rohitsud commented Jun 1, 2022

Steps to reproduce

Try to sync a Gmail account using an app password and IMAP using

php -f occ mail:account:sync -f -vvv 1

Expected behavior

Mail syncs without error

Actual behavior

www-data@nextcloud:~/html$ php -f occ mail:account:sync -f -vvv 1
[debug] Skipping mailbox sync for 1
[debug] Skipping mailbox sync for 2
[debug] Skipping mailbox sync for 3
[debug] Syncing 4
[debug] Locking mailbox 4 for new messages sync
[debug] Locking mailbox 4 for changed messages sync
[debug] Locking mailbox 4 for vanished messages sync
[debug] Running initial sync for 4
[debug] Initial sync 1:INBOX - fetch all messages from IMAP took 6s
[debug] Unlocking mailbox 4 from vanished messages sync
[debug] Unlocking mailbox 4 from changed messages sync
[debug] Unlocking mailbox 4 from new messages sync

In ImapToDbSynchronizer.php line 249:

[OCA\Mail\Exception\ServiceException]
Sync failed for 1:INBOX: An exception occurred while executing a query: SQLSTATE[22001]: String data, right truncated: 14
06 Data too long for column 'in_reply_to' at row 1

Exception trace:
at /var/www/html/custom_apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php:249
OCA\Mail\Service\Sync\ImapToDbSynchronizer->sync() at /var/www/html/custom_apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php:135
OCA\Mail\Service\Sync\ImapToDbSynchronizer->syncAccount() at /var/www/html/custom_apps/mail/lib/Command/SyncAccount.php:110
OCA\Mail\Command\SyncAccount->sync() at /var/www/html/custom_apps/mail/lib/Command/SyncAccount.php:94
OCA\Mail\Command\SyncAccount->execute() at /var/www/html/3rdparty/symfony/console/Command/Command.php:255
Symfony\Component\Console\Command\Command->run() at /var/www/html/3rdparty/symfony/console/Application.php:1009
Symfony\Component\Console\Application->doRunCommand() at /var/www/html/3rdparty/symfony/console/Application.php:273
Symfony\Component\Console\Application->doRun() at /var/www/html/3rdparty/symfony/console/Application.php:149
Symfony\Component\Console\Application->run() at /var/www/html/lib/private/Console/Application.php:211
OC\Console\Application->run() at /var/www/html/console.php:99
require_once() at /var/www/html/occ:11

In ExceptionConverter.php line 114:

[Doctrine\DBAL\Exception\DriverException (1406)]
An exception occurred while executing a query: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for colu
mn 'in_reply_to' at row 1

Exception trace:
at /var/www/html/3rdparty/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php:114
Doctrine\DBAL\Driver\API\MySQL\ExceptionConverter->convert() at /var/www/html/3rdparty/doctrine/dbal/src/Connection.php:1780
Doctrine\DBAL\Connection->handleDriverException() at /var/www/html/3rdparty/doctrine/dbal/src/Connection.php:1719
Doctrine\DBAL\Connection->convertExceptionDuringQuery() at /var/www/html/3rdparty/doctrine/dbal/src/Connection.php:1173
Doctrine\DBAL\Connection->executeStatement() at /var/www/html/lib/private/DB/Connection.php:294
OC\DB\Connection->executeStatement() at /var/www/html/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php:354
Doctrine\DBAL\Query\QueryBuilder->execute() at /var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php:281
OC\DB\QueryBuilder\QueryBuilder->execute() at /var/www/html/custom_apps/mail/lib/Db/MessageMapper.php:315
OCA\Mail\Db\MessageMapper->insertBulk() at /var/www/html/custom_apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php:305
OCA\Mail\Service\Sync\ImapToDbSynchronizer->runInitialSync() at /var/www/html/custom_apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php:226
OCA\Mail\Service\Sync\ImapToDbSynchronizer->sync() at /var/www/html/custom_apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php:135
OCA\Mail\Service\Sync\ImapToDbSynchronizer->syncAccount() at /var/www/html/custom_apps/mail/lib/Command/SyncAccount.php:110
OCA\Mail\Command\SyncAccount->sync() at /var/www/html/custom_apps/mail/lib/Command/SyncAccount.php:94
OCA\Mail\Command\SyncAccount->execute() at /var/www/html/3rdparty/symfony/console/Command/Command.php:255
Symfony\Component\Console\Command\Command->run() at /var/www/html/3rdparty/symfony/console/Application.php:1009
Symfony\Component\Console\Application->doRunCommand() at /var/www/html/3rdparty/symfony/console/Application.php:273
Symfony\Component\Console\Application->doRun() at /var/www/html/3rdparty/symfony/console/Application.php:149
Symfony\Component\Console\Application->run() at /var/www/html/lib/private/Console/Application.php:211
OC\Console\Application->run() at /var/www/html/console.php:99
require_once() at /var/www/html/occ:11

In Exception.php line 26:

[Doctrine\DBAL\Driver\PDO\Exception (1406)]
SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'in_reply_to' at row 1

Exception trace:
at /var/www/html/3rdparty/doctrine/dbal/src/Driver/PDO/Exception.php:26
Doctrine\DBAL\Driver\PDO\Exception::new() at /var/www/html/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php:94
Doctrine\DBAL\Driver\PDO\Statement->execute() at /var/www/html/3rdparty/doctrine/dbal/src/Connection.php:1163
Doctrine\DBAL\Connection->executeStatement() at /var/www/html/lib/private/DB/Connection.php:294
OC\DB\Connection->executeStatement() at /var/www/html/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php:354
Doctrine\DBAL\Query\QueryBuilder->execute() at /var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php:281
OC\DB\QueryBuilder\QueryBuilder->execute() at /var/www/html/custom_apps/mail/lib/Db/MessageMapper.php:315
OCA\Mail\Db\MessageMapper->insertBulk() at /var/www/html/custom_apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php:305
OCA\Mail\Service\Sync\ImapToDbSynchronizer->runInitialSync() at /var/www/html/custom_apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php:226
OCA\Mail\Service\Sync\ImapToDbSynchronizer->sync() at /var/www/html/custom_apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php:135
OCA\Mail\Service\Sync\ImapToDbSynchronizer->syncAccount() at /var/www/html/custom_apps/mail/lib/Command/SyncAccount.php:110
OCA\Mail\Command\SyncAccount->sync() at /var/www/html/custom_apps/mail/lib/Command/SyncAccount.php:94
OCA\Mail\Command\SyncAccount->execute() at /var/www/html/3rdparty/symfony/console/Command/Command.php:255
Symfony\Component\Console\Command\Command->run() at /var/www/html/3rdparty/symfony/console/Application.php:1009
Symfony\Component\Console\Application->doRunCommand() at /var/www/html/3rdparty/symfony/console/Application.php:273
Symfony\Component\Console\Application->doRun() at /var/www/html/3rdparty/symfony/console/Application.php:149
Symfony\Component\Console\Application->run() at /var/www/html/lib/private/Console/Application.php:211
OC\Console\Application->run() at /var/www/html/console.php:99
require_once() at /var/www/html/occ:11

In Statement.php line 92:

[PDOException (22001)]
SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'in_reply_to' at row 1

Exception trace:
at /var/www/html/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php:92
PDOStatement->execute() at /var/www/html/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php:92
Doctrine\DBAL\Driver\PDO\Statement->execute() at /var/www/html/3rdparty/doctrine/dbal/src/Connection.php:1163
Doctrine\DBAL\Connection->executeStatement() at /var/www/html/lib/private/DB/Connection.php:294
OC\DB\Connection->executeStatement() at /var/www/html/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php:354
Doctrine\DBAL\Query\QueryBuilder->execute() at /var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php:281
OC\DB\QueryBuilder\QueryBuilder->execute() at /var/www/html/custom_apps/mail/lib/Db/MessageMapper.php:315
OCA\Mail\Db\MessageMapper->insertBulk() at /var/www/html/custom_apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php:305
OCA\Mail\Service\Sync\ImapToDbSynchronizer->runInitialSync() at /var/www/html/custom_apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php:226
OCA\Mail\Service\Sync\ImapToDbSynchronizer->sync() at /var/www/html/custom_apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php:135
OCA\Mail\Service\Sync\ImapToDbSynchronizer->syncAccount() at /var/www/html/custom_apps/mail/lib/Command/SyncAccount.php:110
OCA\Mail\Command\SyncAccount->sync() at /var/www/html/custom_apps/mail/lib/Command/SyncAccount.php:94
OCA\Mail\Command\SyncAccount->execute() at /var/www/html/3rdparty/symfony/console/Command/Command.php:255
Symfony\Component\Console\Command\Command->run() at /var/www/html/3rdparty/symfony/console/Application.php:1009
Symfony\Component\Console\Application->doRunCommand() at /var/www/html/3rdparty/symfony/console/Application.php:273
Symfony\Component\Console\Application->doRun() at /var/www/html/3rdparty/symfony/console/Application.php:149
Symfony\Component\Console\Application->run() at /var/www/html/lib/private/Console/Application.php:211
OC\Console\Application->run() at /var/www/html/console.php:99
require_once() at /var/www/html/occ:11

mail:account:sync [-f|--force] [--]

Mail app version

1.12.1

Mailserver or service

Gmail

Operating system

Oracle Linux

PHP engine version

PHP 8.0

Web server

Apache (supported)

Database

MySQL

Additional info

No response

@ChristophWurst
Copy link
Member

The column is 1023 characters wide. That is as wide as the message_id and the thread_root_id. To my knowledge this should always fit an IMAP message ID.

While the ID should probably not contain any special characters, could you check https://docs.nextcloud.com/server/stable/admin_manual/configuration_database/mysql_4byte_support.html for your MySQL configuration?

@rohitsud
Copy link
Author

rohitsud commented Jun 1, 2022

Is there an easy way to figure out which email is causing the issue?

@ChristophWurst
Copy link
Member

I don't think so.

Have your checked your database configuration?

@rohitsud
Copy link
Author

Yes I checked, the DB has MB4 enabled. I also doubt though that any of my messages has such a character in the message-id since that is supposed to be a header so it should be encoded anyway.

@ChristophWurst
Copy link
Member

We have seen such long message-ids. It's rare, but they exist.

@ChristophWurst
Copy link
Member

#10178 should address this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🏗️ In progress
Development

Successfully merging a pull request may close this issue.

2 participants