nextcloud / nextcloud/mail

Mail app hangs when moving messages to large mailboxes

Open
#7,473 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Steps to reproduce
  1. Have an "Archive" folder with > 7000 threads / 9500 messages.
  2. Open the mail app.
  3. Click on a message 3-dot menu.
  4. Move it to "Archive".
  5. Do the same for another message (or a couple more).
Expected behavior

Messages are moved and app behaves normally.

Actual behavior

App hangs browser for around 5 min.

Mail app version

1.14.1

Mailserver or service

dovecot

Operating system

freebsd 13.1

PHP engine version

PHP 8.1

Web server

Apache

Database

MariaDB

Additional info

Nextcloud logs warnings of the type:

[mail] Warning: Controller OCA\Mail\Controller\MailboxesController::sync executed 169 queries.

POST /apps/mail/api/mailboxes/32/sync
from ***.***.***.*** by *** at 2022-10-21T07:56:42+00:00

Firefox profiler shows addEnvelope being called more than 7000 times (capture only ran around half a minute).

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

The reported path is POST /apps/mail/api/mailboxes/32/sync; start by tracing MailboxesController::sync and the addEnvelope calls shown in the Firefox profiler. Reproduce with a mailbox over 7,000 threads and verify that moving several messages no longer hangs the browser or triggers thousands of repeated calls or queries.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, php
Domain
api, backend, frontend, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.