nextcloud / nextcloud/mail

Mail Cleanup Job fails with Postgres error

Open
#5,716 14 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

1. to develop bug good first issue
Dominant language
JavaScript
Stars
1k
Forks
348
Avg merge
12h 28m
Merged PRs (30d)
91

Description

Expected behavior

No errors in the logs.

Actual behavior

I deleted a rather large mail account. The next day I found the following in the logs:

Doctrine\DBAL\Query\QueryException: The number of parameters must not exceed 65535. Restriction by PostgreSQL.
/var/www/vhosts/xyz/abc/apps/mail/lib/Db/MessageMapper.php - line 1135:
OC\DB\QueryBuilder\QueryBuilder->execute()
/var/www/vhosts/xyz/abc/apps/mail/lib/Service/CleanupService.php - line 66:
OCA\Mail\Db\MessageMapper->deleteOrphans()
/var/www/vhosts/xyz/abc/apps/mail/lib/BackgroundJob/CleanupJob.php - line 46:
OCA\Mail\Service\CleanupService->cleanUp()
/var/www/vhosts/xyz/abc/lib/public/BackgroundJob/Job.php - line 80:
OCA\Mail\BackgroundJob\CleanupJob->run()
/var/www/vhosts/xyz/abc/lib/public/BackgroundJob/TimedJob.php - line 61:
OCP\BackgroundJob\Job->execute()
/var/www/vhosts/xyz/abc/cron.php - line 128:
OCP\BackgroundJob\TimedJob->execute()

Mail app

Mail app version: 1.10.5

Mailserver or service: self-hosted (Postfix/Dovecot)

Server configuration

Operating system: Ubuntu 18.04.6 LTS

Web server: Apache 2.4.29-1ubuntu4.14

Database: MySQL 1:10.1.48-0ubuntu0.18.04.1

PHP version: 7.4

Nextcloud Version: 21.0.0

Client configuration

Browser: Firefox 94.0.1

Operating system: Ubuntu 21.10

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at apps/mail/lib/Db/MessageMapper.php line 1135, then trace the cleanup flow through CleanupService.php line 66 and CleanupJob.php line 46. Reproduce cleanup after deleting a large mail account and verify that the job completes without PostgreSQL's parameter-limit error.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, php, postgresql
Domain
backend, database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.