mozStorageConnection can crash on shutdown

RESOLVED FIXED in Firefox 68

Status

()

defect
P1
normal
RESOLVED FIXED
3 months ago
2 months ago

People

(Reporter: baku, Assigned: baku)

Tracking

Trunk
mozilla68
Points:
---

Firefox Tracking Flags

(firefox68 fixed)

Details

Attachments

(1 attachment, 2 obsolete attachments)

Assignee

Description

3 months ago

NS_GetCurrentThread() can return null during the shutdown and in mozStorageConnection we have many assertion such as:
MOZ_ASSERT(threadOpenedOn == NS_GetCurrentThread())

https://searchfox.org/mozilla-central/rev/14dc5b7d8a6da1854b2f9f33f1da77a97368cd54/storage/mozStorageConnection.cpp#978

:baku and I are discussing/investigating this further on IRC (specifically the consumer), but I think this will be a WONTFIX because it's too late to drop a connection reference at ShutdownPhase::ShutdownFinal from mozStorage's perspective.

mozStorage shuts down at xpcom-shutdown-threads, which is already very late. Arguably, all its consumers should have shutdown at profile-before-change, profile-before-change-qm, or profile-before-change-telemetry. (And indeed, the consumer in question is trying to shutdown mozStorage at profile-before-change, so there's something weird going on.)

Component: DOM: Web Storage → Storage
Product: Core → Toolkit

And omitted context: the consumer is nsPermissionManager that gets its singleton cleared by ClearOnShutdown()'s default of ShutdownFinal and it has retained a database reference that it should not have.

Attachment #9055901 - Attachment is obsolete: true

Moving components since the fix is now in permission manager.

Component: Storage → Permission Manager
Product: Toolkit → Core
Assignee: nobody → amarchesini
Status: NEW → ASSIGNED
Priority: -- → P1
Attachment #9055930 - Attachment is obsolete: true

Comment 7

2 months ago
Pushed by amarchesini@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6e87244c4b89
mozStorageConnection can crash on shutdown, r=asuth
Assignee

Updated

2 months ago
Flags: needinfo?(amarchesini)

Comment 9

2 months ago
Pushed by amarchesini@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/9a8e3ac367f8
mozStorageConnection can crash on shutdown, r=asuth

Comment 10

2 months ago
bugherder
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
You need to log in before you can comment on or make changes to this bug.