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

Long running Db index creation process constantly pegging CPU, index error in logs #5294

Closed
Tracked by #5835
mjog opened this issue Jul 8, 2021 · 11 comments
Closed
Tracked by #5835

Comments

@mjog
Copy link

mjog commented Jul 8, 2021

Since upgrading to 1.10, my host's CPU has been pegged by Maria. On running a mysqladmin proc stat, I always see something like the following:

mysqladmin proc stat+------+---------------+-----------+---------------+---------+------+--------------------------+------------------------------------------------------------------------------------------------------+----------+
| Id   | User          | Host      | db            | Command | Time | State                    | Info                                                                                                 | Progress |
+------+---------------+-----------+---------------+---------+------+--------------------------+------------------------------------------------------------------------------------------------------+----------+
[snip]
| 6141 | nc_user | localhost | nc_db | Query   | 2537 | Creating sort index      | SELECT `m`.`id` FROM `oc_mail_messages` `m` LEFT JOIN `oc_mail_messages` `m2` ON m.mailbox_id = m2.m | 0.000    |

The id of these queries are incrementing over time, so this index is both expensive to create, and is constantly being re-created.

I'm also seeing #5231, not sure if it's related, and a lot of the following in my logs:

OCA\Mail\Exception\ServiceException: Sync failed for 27:INBOX: An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '500143-150' for key 'mail_msg_mb_uid_idx'

    /[redacted]/html/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php - line 134:

    OCA\Mail\Service\Sync\ImapToDbSynchronizer->sync(OCA\Mail\Account {}, OCA\Mail\Db\Mailbox { id: 150}, OC\AppFramew ... {}, 42, null, false, true)

    /[redacted]/html/apps/mail/lib/BackgroundJob/SyncJob.php - line 109:

    OCA\Mail\Service\Sync\ImapToDbSynchronizer->syncAccount(OCA\Mail\Account {}, OC\AppFramew ... {})

    /[redacted]/html/lib/public/BackgroundJob/Job.php - line 80:

    OCA\Mail\BackgroundJob\SyncJob->run({ accountId: 27})

    /[redacted]/html/lib/public/BackgroundJob/TimedJob.php - line 61:

    OCP\BackgroundJob\Job->execute(OC\BackgroundJob\JobList {}, OC\Log {})

    /[redacted]/html/cron.php - line 128:

    OCP\BackgroundJob\TimedJob->execute(OC\BackgroundJob\JobList {}, OC\Log {})

Caused by Doctrine\DBAL\Exception\UniqueConstraintViolationException: An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '500143-150' for key 'mail_msg_mb_uid_idx'

    /[redacted]/html/3rdparty/doctrine/dbal/src/Connection.php - line 1728:

    Doctrine\DBAL\Driver\API\MySQL\ExceptionConverter->convert(Doctrine\DBA ... {}, Doctrine\DBAL\Query {})

    /[redacted]/html/3rdparty/doctrine/dbal/src/Connection.php - line 1667:

    Doctrine\DBAL\Connection->handleDriverException(Doctrine\DBA ... {}, Doctrine\DBAL\Query {})

    /[redacted]/html/3rdparty/doctrine/dbal/src/Connection.php - line 1146:

    Doctrine\DBAL\Connection->convertExceptionDuringQuery(Doctrine\DBA ... {}, "INSERT INTO ... )", [ 500143,"<N ... "], [ 1,2,2,0,2, ... "])

    /[redacted]/html/lib/private/DB/Connection.php - line 257:

    Doctrine\DBAL\Connection->executeStatement("INSERT INTO ... )", [ 500143,"<N ... "], [ 1,2,2,0,2, ... "])

    /[redacted]/html/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php - line 213:

    OC\DB\Connection->executeStatement("INSERT INTO ... )", { 0: "And 13 ... "}, { 0: "And 13 ... 2})

    /[redacted]/html/lib/private/DB/QueryBuilder/QueryBuilder.php - line 287:

    Doctrine\DBAL\Query\QueryBuilder->execute()

    /[redacted]/html/apps/mail/lib/Db/MessageMapper.php - line 307:

    OC\DB\QueryBuilder\QueryBuilder->execute()

    /[redacted]/html/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php - line 362:

    OCA\Mail\Db\MessageMapper->insertBulk(OCA\Mail\Account {}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null})

    /[redacted]/html/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php - line 229:

    OCA\Mail\Service\Sync\ImapToDbSynchronizer->runPartialSync(OCA\Mail\Account {}, OCA\Mail\Db\Mailbox { id: 150}, OC\AppFramew ... {}, 42, null)

    /[redacted]/html/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php - line 134:

    OCA\Mail\Service\Sync\ImapToDbSynchronizer->sync(OCA\Mail\Account {}, OCA\Mail\Db\Mailbox { id: 150}, OC\AppFramew ... {}, 42, null, false, true)

    /[redacted]/html/apps/mail/lib/BackgroundJob/SyncJob.php - line 109:

    OCA\Mail\Service\Sync\ImapToDbSynchronizer->syncAccount(OCA\Mail\Account {}, OC\AppFramew ... {})

    /[redacted]/html/lib/public/BackgroundJob/Job.php - line 80:

    OCA\Mail\BackgroundJob\SyncJob->run({ accountId: 27})

    /[redacted]/html/lib/public/BackgroundJob/TimedJob.php - line 61:

    OCP\BackgroundJob\Job->execute(OC\BackgroundJob\JobList {}, OC\Log {})

    /[redacted]/html/cron.php - line 128:

    OCP\BackgroundJob\TimedJob->execute(OC\BackgroundJob\JobList {}, OC\Log {})

Caused by Doctrine\DBAL\Driver\PDO\Exception: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '500143-150' for key 'mail_msg_mb_uid_idx'

    /[redacted]/html/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php - line 84:

    Doctrine\DBAL\Driver\PDO\Exception::new(PDOException ... ]})

    /[redacted]/html/3rdparty/doctrine/dbal/src/Connection.php - line 1136:

    Doctrine\DBAL\Driver\PDO\Statement->execute()

    /[redacted]/html/lib/private/DB/Connection.php - line 257:

    Doctrine\DBAL\Connection->executeStatement("INSERT INTO ... )", [ 500143,"<N ... "], [ 1,2,2,0,2, ... "])

    /[redacted]/html/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php - line 213:

    OC\DB\Connection->executeStatement("INSERT INTO ... )", { 0: "And 13 ... "}, { 0: "And 13 ... 2})

    /[redacted]/html/lib/private/DB/QueryBuilder/QueryBuilder.php - line 287:

    Doctrine\DBAL\Query\QueryBuilder->execute()

    /[redacted]/html/apps/mail/lib/Db/MessageMapper.php - line 307:

    OC\DB\QueryBuilder\QueryBuilder->execute()

    /[redacted]/html/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php - line 362:

    OCA\Mail\Db\MessageMapper->insertBulk(OCA\Mail\Account {}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null})

    /[redacted]/html/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php - line 229:

    OCA\Mail\Service\Sync\ImapToDbSynchronizer->runPartialSync(OCA\Mail\Account {}, OCA\Mail\Db\Mailbox { id: 150}, OC\AppFramew ... {}, 42, null)

    /[redacted]/html/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php - line 134:

    OCA\Mail\Service\Sync\ImapToDbSynchronizer->sync(OCA\Mail\Account {}, OCA\Mail\Db\Mailbox { id: 150}, OC\AppFramew ... {}, 42, null, false, true)

    /[redacted]/html/apps/mail/lib/BackgroundJob/SyncJob.php - line 109:

    OCA\Mail\Service\Sync\ImapToDbSynchronizer->syncAccount(OCA\Mail\Account {}, OC\AppFramew ... {})

    /[redacted]/html/lib/public/BackgroundJob/Job.php - line 80:

    OCA\Mail\BackgroundJob\SyncJob->run({ accountId: 27})

    /[redacted]/html/lib/public/BackgroundJob/TimedJob.php - line 61:

    OCP\BackgroundJob\Job->execute(OC\BackgroundJob\JobList {}, OC\Log {})

    /[redacted]/html/cron.php - line 128:

    OCP\BackgroundJob\TimedJob->execute(OC\BackgroundJob\JobList {}, OC\Log {})

Caused by PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '500143-150' for key 'mail_msg_mb_uid_idx'

    /[redacted]/html/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php - line 82:

    PDOStatement->execute(null)

    /[redacted]/html/3rdparty/doctrine/dbal/src/Connection.php - line 1136:

    Doctrine\DBAL\Driver\PDO\Statement->execute()

    /[redacted]/html/lib/private/DB/Connection.php - line 257:

    Doctrine\DBAL\Connection->executeStatement("INSERT INTO ... )", [ 500143,"<N ... "], [ 1,2,2,0,2, ... "])

    /[redacted]/html/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php - line 213:

    OC\DB\Connection->executeStatement("INSERT INTO ... )", { 0: "And 13 ... "}, { 0: "And 13 ... 2})

    /[redacted]/html/lib/private/DB/QueryBuilder/QueryBuilder.php - line 287:

    Doctrine\DBAL\Query\QueryBuilder->execute()

    /[redacted]/html/apps/mail/lib/Db/MessageMapper.php - line 307:

    OC\DB\QueryBuilder\QueryBuilder->execute()

    /[redacted]/html/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php - line 362:

    OCA\Mail\Db\MessageMapper->insertBulk(OCA\Mail\Account {}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null}, OCA\Mail\Db\Message { id: null})

    /[redacted]/html/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php - line 229:

    OCA\Mail\Service\Sync\ImapToDbSynchronizer->runPartialSync(OCA\Mail\Account {}, OCA\Mail\Db\Mailbox { id: 150}, OC\AppFramew ... {}, 42, null)

    /[redacted]/html/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php - line 134:

    OCA\Mail\Service\Sync\ImapToDbSynchronizer->sync(OCA\Mail\Account {}, OCA\Mail\Db\Mailbox { id: 150}, OC\AppFramew ... {}, 42, null, false, true)

    /[redacted]/html/apps/mail/lib/BackgroundJob/SyncJob.php - line 109:

    OCA\Mail\Service\Sync\ImapToDbSynchronizer->syncAccount(OCA\Mail\Account {}, OC\AppFramew ... {})

    /[redacted]/html/lib/public/BackgroundJob/Job.php - line 80:

    OCA\Mail\BackgroundJob\SyncJob->run({ accountId: 27})

    /[redacted]/html/lib/public/BackgroundJob/TimedJob.php - line 61:

    OCP\BackgroundJob\Job->execute(OC\BackgroundJob\JobList {}, OC\Log {})

    /[redacted]/html/cron.php - line 128:

    OCP\BackgroundJob\TimedJob->execute(OC\BackgroundJob\JobList {}, OC\Log {})

Mail app

Mail app version: 1.10.0

Mailserver or service: Dovecot

Server configuration

Operating system: Debian 10

Web server: Apache

Database: MariaDB
PHP version: 7.x

Nextcloud Version: 21.0.3

Client configuration

Browser: Epiphany 40

Operating system: Ubuntu 21.04

@ChristophWurst
Copy link
Member

Hi @mjog!

There have been a few reports of issue with the very same index, but I could never wrap my head around why the inserts would conflict as we have application logic that would prevent just that. Ref https://github.com/nextcloud/mail/issues?q=is%3Aissue+is%3Aopen+mail_msg_mb_uid_idx. Thanks a lot for shedding more light onto this mystery.

We'll try to have a look soonish.

Is there a particular reason why you're still on Mail v1.4? All newer releases will work with Nextcloud 21. We didn't change/drop that index though as far as I know. But still might be worth upgrading.

@mjog
Copy link
Author

mjog commented Jul 8, 2021

Hey @ChristophWurst! Cheers!

I must have been working on this too late last night - the instance is indeed running Mail 1.10.0. Apologies for the confusion, I'll update the description in a moment.

The instance was also taken from NC 20 to 21, but a couple of days after Mail was upgraded, and while I'm not certain, my impression was that this issue existed with NC 20 as well.

@ChristophWurst
Copy link
Member

We just found another instance with the same problem.

@ChristophWurst
Copy link
Member

Integrity constraint violation: 1062 Duplicate entry '500143-150' for key 'mail_msg_mb_uid_idx'

That was fixed in #5440

@ChristophWurst
Copy link
Member

We just found another instance with the same problem.

There is also a possibly correlation with the deployment of #5450

@miaulalala
Copy link
Contributor

Explain on the threading query outputs some interesting stuff. It is the only query I could find that would fit the proc stat snippet.

+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| EXPLAIN                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| -> Filter: (m2.id is null)  (cost=3756.13 rows=3131) (actual time=2.888..3.063 rows=1 loops=1)
    -> Nested loop antijoin  (cost=3756.13 rows=3131) (actual time=2.887..3.062 rows=1 loops=1)
        -> Filter: ((m.mailbox_id = 436) and (m.sent_at > (select #2)))  (cost=49.76 rows=6) (actual time=0.060..0.235 rows=1 loops=1)
            -> Index range scan on m using mail_msg_sent_idx, with index condition: (m.id not in (6347,6346,6345,6344,6236,6235,6234,6233,6232,6231,6230,6229,6228,6227,6226,6225,6224,6223,6222))  (cost=49.76 rows=110) (actual time=0.059..0.227 rows=92 loops=1)
            -> Select #2 (subquery in condition; run only once)
                -> Aggregate: min(oc_mail_messages.sent_at)  (cost=9.23 rows=2) (actual time=0.055..0.055 rows=1 loops=1)
                    -> Filter: ((oc_mail_messages.mailbox_id = 436) and (oc_mail_messages.id in (6348,6347,6346,6345,6344,6236,6235,6234,6233,6232,6231,6230,6229,6228,6227,6226,6225,6224,6223,6222)))  (cost=9.03 rows=2) (actual time=0.026..0.051 rows=20 loops=1)
                        -> Index range scan on oc_mail_messages using PRIMARY  (cost=9.03 rows=20) (actual time=0.024..0.047 rows=20 loops=1)
        -> Filter: ((m2.thread_root_id = m.thread_root_id) and (m2.mailbox_id = 436) and (m.sent_at < m2.sent_at))  (cost=109.04 rows=542) (actual time=2.826..2.826 rows=0 loops=1)
            -> Index range scan on m2 (re-planned for each iteration)  (cost=109.04 rows=5419) (actual time=0.044..2.395 rows=5450 loops=1)

@miaulalala
Copy link
Contributor

\OCA\Mail\Db\MessageMapper::findNewIds

@kesselb
Copy link
Contributor

kesselb commented Sep 7, 2021

We did some debugging today. Some ideas how to improve the situation:

  1. A possible reason for "Creating sort index" could be a order by statement. MessageMapper.findNewIds check if a newer message id exist than the given message ids. It's not required for the query itself to return a sorted result.

    ->orderBy('m.sent_at', 'desc');

  2. We don't have a index on the self-join columns mailbox_id, thread_root_id and sent_at. Adding a index to thread_root_id is not possible on mysql/maria due index length constraints. However a index for only the first n bytes of a column is possible (e.g. add a prefix index to filecache.path, attempt 2 server#28541) and would also help here.

  3. For Add possibility to change sort attribute #679 MessageMapper.findNewIds will be adjusted (to work with the highest known sent_at value). It's possible that this issue is already solved then.

@kesselb
Copy link
Contributor

kesselb commented Sep 14, 2021

create index mail_msg_mb_thread_root_sent_idx on oc_mail_messages (mailbox_id, thread_root_id(64), sent_at);

Took 6 min 8.470 seconds with 1681690 rows in oc_mail_messages.

@kesselb kesselb self-assigned this Sep 14, 2021
@small1
Copy link

small1 commented Dec 13, 2021

Creating an index manually the database fixed the cpu load on the server. But still a bit of an issue.

@miaulalala
Copy link
Contributor

Closed with #6234

Repository owner moved this from 📄 To do (5-20 entries) to ☑️ Done in 💌 📅 👥 Groupware team May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

5 participants