Closed Bug 2089523 Opened 15 days ago Closed 10 days ago

Message pane reloads endlessly for an IMAP message containing <img src="#"> (regression in 158.0)

Categories

(MailNews Core :: Networking: IMAP, defect)

Thunderbird 158
defect

Tracking

(thunderbird_esr153 unaffected, thunderbird160 wontfix, thunderbird161? fixed, thunderbird162 affected)

RESOLVED FIXED
162 Branch
Tracking Status
thunderbird_esr153 --- unaffected
thunderbird160 --- wontfix
thunderbird161 ? fixed
thunderbird162 --- affected

People

(Reporter: mike, Assigned: welpy-cw)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 external file)

Steps to reproduce

  1. New profile, IMAP account with default settings ("Keep messages for this account on this computer" on).
  2. Put the message below into INBOX.
  3. Select it so it shows in the message pane. Remote content stays blocked.

From: probe@example.com
To: measure@example.test
Subject: R img-hash
Date: Thu, 05 Nov 2026 08:00:00 +0000
Message-ID: <r-img-hash@probe.example.com>
MIME-Version: 1.0
Content-Type: text/html; charset=utf-8

<html><body>
<p>See my results</p>
<img src="#" width="1" height="1">
</body></html>

Actual results

The message pane flashes and keeps showing "Loading Message…". It reloads several times a second and never settles.

Expected results

The message renders once, as it does in 157.0.1

Confirmed locally with a fresh complete build.

The first failing callback belongs to the image subrequest (TYPE_IMAGE):
ImapOfflineMsgStreamListener::OnDataAvailable() forwards a consumer failure
of NS_BINDING_ABORTED, and the input stream pump passes that same failure to
OnStopRequest(). The offline message bytes are intact. This is not initially
a storage read failure.

The recovery logic added in bug 1929105 treats any failed delivery as evidence
of a damaged offline copy. It calls DiscardOfflineMsg(), which clears the
Offline flag. FolderDBListener.onHdrFlagsChanged() then reloads the displayed
message, leading to repeated invalidation, downloads, mailbox growth, and UI
work.

The mozregression range also spans different Gecko revisions. Taskcluster's
Linux opt build definitions identify the Gecko window as:

  • Good: 3b08ff1879d5684fb00430411a9c38ea27e1cdc2
  • Bad: 24b31c98c7b9663cc0c098ee2bb81a7047f7479f

Sources: good build task,
bad build task.

This Gecko range includes bug 2062317, changeset
804c6b6730e65a1fff654de5eb38aea90bf0db6d (more synchronous DOMContentLoaded).
On current unmodified production code:

  • With dom.document.domcontentloaded.synchronous.enabled=true, the message
    repeatedly loses its offline copy and reloads without completing a load.
  • With that preference set to false, there is one wrongful invalidation and
    reload, after which the message settles.
  • Restoring the old numeric-ID HasMsgOffline() check from before the
    September bug 2065695 patch does not change either result in the current
    tree.

These results strongly implicate bug 2062317 as the timing change exposing the
older Thunderbird defect. They do not constitute a complete historical-build
or single-changeset backout comparison, so the precise regression attribution
remains provisional.

The local fix tracks errors returned by the offline input stream independently
of consumer failures and cancellations. Offline copies are discarded only
after a storage read failure, preserving recovery for genuinely damaged
messages.

Validation passed:

  • Complete build, with no compiler warnings.
  • Browser regression test: the hash-image message loads once, retains its
    Offline flag and storeToken, and causes no mailbox growth. The new test
    fails on the unfixed build.
  • Existing browser coverage for four damaged storeToken cases.
  • Offline-store unit tests with both mbox and maildir, covering consumer
    failures in OnStartRequest and OnDataAvailable, plus a genuine mbox read
    failure.
  • commlint on all changed files.
Status: UNCONFIRMED → NEW
Component: Message Reader UI → Networking: IMAP
Ever confirmed: true
Keywords: regression
Product: Thunderbird → MailNews Core
Target Milestone: --- → 158 Branch

Record offline-store read failures separately from consumer errors so a
failed image request cannot discard a valid copy and trigger a reload loop.

Add regression coverage for self-referencing images, consumer callback
failures, and genuine read failures, preserving damaged-message recovery.

Assignee: nobody → h.w.forms
Attachment #9675006 - Attachment description: WIP: Bug 2089523 - Preserve valid IMAP offline copies when message consumers fail. r=#thunderbird-back-end-reviewers → Bug 2089523 - Preserve valid IMAP offline copies when message consumers fail. r=#thunderbird-back-end-reviewers
Severity: -- → S3
Status: NEW → ASSIGNED
See Also: → 2089877
See Also: → 2091294
Duplicate of this bug: 2091294
See Also: 2091294 →
Target Milestone: 158 Branch → 162 Branch

Pushed by jtracey@thunderbird.net:
https://hg.mozilla.org/comm-central/rev/fe6363985650
Preserve valid IMAP offline copies when message consumers fail. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 10 days ago
Resolution: --- → FIXED
Version: Thunderbird 159 → Thunderbird 158
Duplicate of this bug: 2091997
Duplicate of this bug: 2092540

Please request uplift

Comment on attachment 9675006 [details]
Bug 2089523 - Preserve valid IMAP offline copies when message consumers fail. r=#thunderbird-back-end-reviewers

Uplift Approval Request

  • Please state case for uplift consideration and ensure bug severity is set: Recent regression affecting many users.
  • User impact if declined: Endless reloading loop when certain (not uncommon) messages are displayed.
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Daily?: Yes
  • Has the fix been verified in Beta?: N/A
  • Needs manual test from QA?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Relatively confined and straightforward fix.
  • Does the fix cause any migrations to be skipped?: No
  • String changes made/needed: None.
Attachment #9675006 - Flags: approval-comm-beta?

Comment on attachment 9675006 [details]
Bug 2089523 - Preserve valid IMAP offline copies when message consumers fail. r=#thunderbird-back-end-reviewers

[Triage Comment]
Approved for beta

Attachment #9675006 - Flags: approval-comm-beta? → approval-comm-beta+
Duplicate of this bug: 2095417
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: