Folder-status pass opens a fresh IMAP login per account every minute (~22k logins/day with 9 accounts)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 50/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- javascript
- Domain
- backend, networking
Research direction
Start in folderStatus.js, where STATUS_INTERVAL_MS and the refresh call live, then in imapManager.js at _withCountClient, which opens a fresh connection with 'Folder status connect' unless the provider profile sets secondaryOverPool. Only the Yahoo profile sets that flag today, so the open question is whether Strato and Google can reuse the pooled or IDLE session. Done when a folder-status cycle on those providers no longer adds new connections to port 993, which you can check by counting SYNs during a few minutes of polling.
Written by the indexing model from the issue text.
Description
What happens
The folder-status monitor opens a fresh IMAP login per account every minute, on every provider except Yahoo. With nine accounts (seven on Strato, one Gmail, one Hetzner your-server.de) that is a steady ~15 new IMAP connections a minute, ~22,000 a day, ~13,000 of them against Strato, while every account already holds a healthy persistent IDLE connection.
We noticed it from the DNS side: each fresh login resolves the host, so the MailFlow box became one of the busiest DNS clients on the network (~45,000 queries/day, almost all imap.strato.de, imap.gmail.com, mail.your-server.de) and tripped our "one device is using an unusual share of DNS" alert.
Measured (v4.0.2, self-hosted, Docker)
ssinside the backend container's network namespace: ~20 established connections to :993 at any time (the persistent IDLE sessions plus pool) — stable.tcpdumpof SYNs to :993 for 120 s: 31 new connections, in a fixed 60 s rhythm — each minute ~11 to Strato, 2 to Gmail, 2 to Hetzner.- The log line for the path is
IMAP connect stalled for … (Folder status connect). - Occasional
connect ETIMEDOUT 81.169.145.103:993against Strato, which I'd rather not provoke into a rate limit.
Where it comes from
folderStatus.js:STATUS_INTERVAL_MS = 60000, fixed.ImapManagerconstructor:_folderStatusTimercallsfolderStatusMonitor.refresh(account)for every enabled IMAP account._withCountClient: unless the profile hassecondaryOverPool: true, it doesconnectImapClient(..., 'Folder status connect')— a new login each cycle.- Only
PROVIDERS.yahoosetssecondaryOverPool, added in #474 after Yahoo started refusing exactly this churn.strato,googleandgenericdon't.
Unchanged on main as of v4.4.0 (imapManager.js still has the 'Folder status connect' fresh path and secondaryOverPool only on Yahoo).
Suggestion
Any of these would fix it; the first looks smallest:
- Use the pooled/persistent session for the folder-status pass on all providers (make
secondaryOverPoolthe default, or optstrato/google/genericin), so a fresh login only happens when no session exists. - Make the folder-status interval configurable (env or the existing sync-interval preference), so an instance with many accounts can slow it down.
- At least skip the STATUS pass for INBOX on accounts whose IDLE session is live, since IDLE already reports EXISTS there.
Happy to test a build against Strato/Gmail/Hetzner accounts and report connection counts.
- Dominant language
- JavaScript
- Stars
- 518
- Forks
- 50
- Avg merge
- 4d 45m
- Merged PRs (30d)
- 43
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from maathimself/mailflow
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
maathimself/mailflow#801 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
maathimself/mailflow#784 ·
Maintainers usually reply within 1 day
-
defaultShortcuts tests fail on macOSPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
maathimself/mailflow#783 ·
Maintainers usually reply within 1 day
-
Stored mail loses blockquote type=cite, so AI actions read Apple Mail and Thunderbird quoted historyOpen
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
maathimself/mailflow#782 ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
maathimself/mailflow#799 ·
Maintainers usually reply within 1 day
All issues in maathimself/mailflow
Similar issues
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
blixvip/solana-token-meta#17 ·
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
blixvip/solana-tx-parse#18 ·
-
bug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
blixvip/solana-rpc-bench#18 ·
-
bug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100