Closed Bug 1583859 Opened 5 years ago Closed 5 years ago

Refreshing tab when on Slack, crashes the browser

Categories

(Core :: DOM: Service Workers, defect, P1)

Desktop
macOS
defect

Tracking

()

RESOLVED FIXED
mozilla72
Tracking Status
firefox-esr68 --- wontfix
firefox67 --- wontfix
firefox68 --- wontfix
firefox69 --- wontfix
firefox70 --- wontfix
firefox71 --- fixed
firefox72 --- fixed

People

(Reporter: jonalmeida, Assigned: asuth)

References

Details

(Keywords: crash, regression)

Crash Data

Attachments

(1 file, 2 obsolete files)

STR

  1. Log into a Slack group.
  2. When the page loads, refresh the page (I used Cmd + R, it that makes a difference).

Expected

  • Refresh and don't crash.

Actual

  • 💥
  • Maybe a separate issue, but sites don't all load doesn't seem to work well.

This doesn't seem to happen on other pages in my brief testing.

Version: 71.0a1 (2019-09-25) (64-bit)
Crash log: https://crash-stats.mozilla.org/report/index/e298aa31-dcba-4308-8f71-7c6850190925

Disabled extensions and the issue stopped showing up. It seems it was related to the fx_cast extension I have which has a native component to it that might be related.

Feel free to close if there is nothing actionable to do on the browser side to avoid these kinds of crashes.

Ignore comment 1, the issue returned after disabling every extension individually. This is not related to any particular addon. Restarting in safe mode (which I had originally tried but didn't mention) seems to solve the problem.

Not sure what the difference is between safe mode and all addons disabled. ¯\_(ツ)_/¯

Seems similar to Bug 1370005, which was fixed a while back. The moz crash reason is MOZ_DIAGNOSTIC_ASSERT(!IsExclusive || !mHaveRequest) (Using an exclusive promise in a non-exclusive fashion). Not sure if this should move to Core | AV Playback, similar to Bug 1370005.

Crash Signature: [@ mozilla::MozPromise<T>::ThenInternal ]
Keywords: crash, regression
Version: 71 Branch → Trunk

Dolske, can you help find an owner for this ? Sounds like it's easily reproducible. Or, do you think this should be in a different component?

Flags: needinfo?(dolske)
Component: General → DOM: Core & HTML
Product: Firefox → Core

Hsin-Yi, we think this is more a dom issue, could you take a look at this please (or getting someone to look at it as per comment 4).

Flags: needinfo?(dolske) → needinfo?(htsai)

Not a DOM Core issue. ClientManager is more service worker related. And this isn't happening on the main thread.

Component: DOM: Core & HTML → DOM: Service Workers
Flags: needinfo?(htsai) → needinfo?(jstutte)

This looks like another case of GenericPromise (IsExclusive=true) being a bad name and default for an abstraction that imitates an abstraction with no such limitation.

Assignee: nobody → bugmail
Status: NEW → ASSIGNED
Flags: needinfo?(jstutte)
Priority: -- → P1

(In reply to Andrew Sutherland [:asuth] (he/him) from comment #7)

This looks like another case of GenericPromise (IsExclusive=true) being a bad name and default for an abstraction that imitates an abstraction with no such limitation.

Does this regress from https://bugzilla.mozilla.org/show_bug.cgi?id=1456995?

(In reply to Hsin-Yi Tsai [:hsinyi] from comment #8)

Does this regress from https://bugzilla.mozilla.org/show_bug.cgi?id=1456995?

Not directly, no. There could be some level of correlation, but this is Clients API stuff which is largely unaffected by parent-intercept. As such, uplift is likely appropriate.

This crash signature is too broad, but I'm not sure how to refine it appropriately. For example, it's also picking up:

It seems like perhaps the frames that start with "mozilla::MozPromise" should be filtered out? Or at least those with the GenericPromise "T" value giving a prefix of mozilla::MozPromise<bool, nsresult, true>, also the GenericNonExclusivePromise case of mozilla::MozPromise<bool, nsresult, false>. In the media crashes, their template parameters are implementation specific, so could be differentiated on, although they're also fairly chatty. NI'ing :willkg for Socorro.

Flags: needinfo?(willkg)

Andrew: I wrote up bug #1590194 to add mozilla::MozPromise<T>::ThenInternal to the signature prefix list.

Flags: needinfo?(willkg)

Although many Clients API usages are inherently exclusive (a specific claim
or control request), the execution-ready promise is shared by all requests
to get the state of a client that is not yet execution ready.

GenericPromise is a somewhat dangerous typedef because its name conceals that
it is exclusive, and an exclusive promise is in contradiction to the presumed
Promise semantics given that all JS Promises are non-exclusive.

This adds a GenericExclusivePromise typedef that's equivalent to the existing
GenericPromise typedef and tries to provide guidance to the existing
GenericPromise comments to use the more explicitly named version.

Depends on D49976

GenericExclusivePromise is a more explicitly named GenericPromise. The goal of
this conversion is to make it clear that these uses:

  1. Have been audited to some approximation and appear to be correctly and
    intentionally exclusive.
  2. Make it clear when we're writing new code that attempts to reuse these
    promises may result in runtime problems. It's easy to gloss over
    the type GenericPromise and not realize that it's exclusive.

In general, the ServiceWorker and Clients usages tend to fall into two usage
patterns:

  1. Single-use promise for a specific request. If content code makes multiple
    requests, multiple promises are created.
  2. Promises used under the hood, but are converted back to explicit callbacks
    before the crossing into bindings.

Depends on D49977

Attachment #9103076 - Attachment description: Bug 1583859 - Add GenericExclusivePromise typedef, improve comments. r=nika → Bug 1583859 - Add GenericExclusivePromise typedef, improve comments. r=bholley
Whiteboard: keep-open
Pushed by bugmail@asutherland.org:
https://hg.mozilla.org/integration/autoland/rev/87c82b01a388
ExecutionReadyPromise should not be exclusive. r=perry
Backout by shindli@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/2cd1797819f4
Backed out changeset 87c82b01a388 for causing bustages in /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/RefPtr.h CLOSED TREE
Flags: needinfo?(bugmail)
Keywords: leave-open
Whiteboard: keep-open

One of my changes meant to be in D49976 ended up in D49980, and I was only landing D49976 but I'd tested with the full stack, so it went awry. Apologies.

Pushed by bugmail@asutherland.org:
https://hg.mozilla.org/integration/autoland/rev/165ae98171b3
ExecutionReadyPromise should not be exclusive. r=perry
Attachment #9103076 - Attachment is obsolete: true
Attachment #9103079 - Attachment is obsolete: true

After feedback from :bholley and some introspection I'm abandoning the patches related to the conversion of "GenericPromise" to "GenericExclusivePromise". I think it probably makes sense for us to consider a combination of:

  • Using explicit types/typedefs that are less homogeneous than Generic(Exclusive)Promise and use a naming convention that avoids implying JS Promise semantics.
  • Just using direct lambda callbacks more and/or explicit callback interfaces. Since most of our uses turn out to be fine with exclusive promises and we frequently only have 1 or 2 threads in-play (versus MozPromises' media-motivated creation that can potentially have a ton of threads and the AbstractThread affinity concepts), this could potentially be beneficial overall.

I'm going to put this on my brain's back-burner though because I think various searchfox things stewing will address most of my concerns.

Keywords: leave-open
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla72

Comment on attachment 9103075 [details]
Bug 1583859 - ExecutionReadyPromise should not be exclusive. r=perry

Beta/Release Uplift Approval Request

  • User impact if declined: MOZ_DIAGNOSTIC_ASSERT crashes on beta. The crashes won't happen on release, just beta.
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: No
  • Needs manual test from QE?: 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): This changes a low-level async abstraction from the "assert if used by more than 1 caller" mode to the "I expect to be called by multiple callers" mode. This is type-checked and otherwise doesn't change application logic beyond not crashing.
  • String changes made/needed:
Attachment #9103075 - Flags: approval-mozilla-beta?

Comment on attachment 9103075 [details]
Bug 1583859 - ExecutionReadyPromise should not be exclusive. r=perry

Fix for a low volume crash on beta, we don't have enough volume on nightly to know if it is effective so let's land it early in beta and see theeffect. Uplift approved for 71 beta 5, thanks.

Attachment #9103075 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

Adding another signature spotted in crash stats.

Crash Signature: [@ mozilla::MozPromise<T>::ThenInternal ] → [@ mozilla::MozPromise<T>::ThenInternal ] [@ mozilla::MozPromise<T>::ThenInternal | mozilla::dom::ClientManagerService::GetInfoAndState ]

I just got this (similar case, during a slack refresh) on a Nightly 11/11 build, so we're still hitting this (or something very closely related). I got the new signature Marcia added a couple of weeks ago.
Seems to be mac only

SHould we reopen, or file a followup?

Flags: needinfo?(bugmail)

Can you provide a link to your crash on crash-stats? I'm not seeing any.

Flags: needinfo?(bugmail) → needinfo?(rjesup)
Flags: needinfo?(rjesup)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: