Closed Bug 1649188 Opened 4 years ago Closed 4 years ago

Race condition on Thunderbird initial startup when opening a tab

Categories

(Thunderbird :: General, defect)

defect

Tracking

(thunderbird_esr78 fixed, thunderbird79 fixed)

RESOLVED FIXED
Thunderbird 80.0
Tracking Status
thunderbird_esr78 --- fixed
thunderbird79 --- fixed

People

(Reporter: neil, Assigned: neil)

Details

Attachments

(1 file)

Steps to reproduce problem:

  1. Compile Thunderbird 78 with a custom source for Owl, so that it picks up a version that actually runs in Thunderbird 78
  2. Start a new profile
  3. Set up an account which requires Owl to log in using a browser
  4. Complete account setup
  5. Dismiss the default mail dialog

Expected results: After account setup is complete, Owl logs in to the account in a tab, and discovers folders

Actual results: Exception thrown in calendar code.

What happens here is that the default mail dialog is modal, which means that Thunderbird's onload handler has not yet completed, and therefore calendar's main window onload handler has not even started to execute. However, Owl is trying to authenticate in the background by opening a browser tab. This action causes Calendar to try to update its UI, which fails because its onload handler has not yet executed.

Actually any extension can trigger the bug by opening a tab while the default client dialog is open.

Assignee: nobody → neil
Attachment #9163033 - Flags: feedback?(ben.bucksch)

Even though there's Owl appearing in the reproduction steps, the bug here is not in Owl. Owl is merely opening a tab, nothing more. That mere opening of the tab is completely breaking Thunderbird. That shouldn't happen.

This is the right fix for the problem.

The concept of observers is to decouple modules. An observer, from the perspective of the main module, is by definition always optional. An observer should never ever be able to break other, later observers, nor the main module. Imagine if a broken event listener would break the entire browser. Likewise, an optional module like the calendar should not break the mail reading.

Firefox in its <tabbrowser> implementation does the same thing, it's wrapping the call to the listeners in a try/catch. tabmail should do the same.

https://searchfox.org/mozilla-central/source/browser/base/content/tabbrowser.js#814 function _callListeners()

Attachment #9163033 - Flags: review?(geoff)
Attachment #9163033 - Flags: feedback?(ben.bucksch)
Attachment #9163033 - Flags: feedback+
Attachment #9163033 - Flags: review+
Attachment #9163033 - Attachment description: Possible patch → Catch errors in listeners
Summary: Race condition on Thunderbird startup when installing (currently pre-release) Owl as part of initial startup → Race condition on Thunderbird initial startup when opening a tab
Comment on attachment 9163033 [details] [diff] [review]
Catch errors in listeners

Seems reasonable. I hate tabmail. :-)
Attachment #9163033 - Flags: review?(geoff) → review+

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/b2fc6b0388b8
Wrap calls to tab monitors in try/catch to prevent them from breaking tabmail. r=darktrojan DONTBUILD

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 80.0
Comment on attachment 9163033 [details] [diff] [review]
Catch errors in listeners

[Approval Request Comment]
Regression caused by (bug #): tabmail XBL rewrite
User impact if declined:
Any error in any tab observer of any kind, anywhere in the app, even in optional components, can completely break the Thunderbird app and the tabs and the main window.
Testing completed (on c-c, etc.):
Risk to taking this patch (and alternatives if risky):
Just adding a try/catch. Very safe.
Attachment #9163033 - Flags: approval-comm-esr78?
Comment on attachment 9163033 [details] [diff] [review]
Catch errors in listeners

Approved for esr78
Attachment #9163033 - Flags: approval-comm-esr78? → approval-comm-esr78+

Thank you, Neil, Geoff and Wayne!

Comment on attachment 9163033 [details] [diff] [review]
Catch errors in listeners

[Triage Comment]
Taking for 79.0b2 for consistency.
Attachment #9163033 - Flags: approval-comm-beta+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: