Closed Bug 1638506 Opened 5 years ago Closed 5 years ago

Potential dispatching in ProfilerParent may happen after thread shutdown

Categories

(Core :: Gecko Profiler, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla78
Tracking Status
firefox78 --- fixed

People

(Reporter: mozbugz, Assigned: mozbugz)

References

Details

Attachments

(1 file)

Spawned from bug 1637890 and https://phabricator.services.mozilla.com/D75497#2298876

ProfilerParentTracker is destroyed during the ShutdownFinal phase, during which it closes extant channels, which may cause pending promises to be rejected, and that triggers a dispatch to handle the rejection.

We should prevent this late dispatch. Some possible solutions:
A. Destroy ProfilerParentTracker earlier (Shutdown or ShutdownThreads phase). I'm not entirely sure if it's safe to manually close channels.
B. Reject promises earlier, but we'd have to handle potential late messages -- is that even possible?
C. Disconnect promise handlers, but that's more code to keep track of them, and I'm not sure it would prevent dispatching?

The fix for bug 1637890 should solve the crash, but it would still be nice to do the right thing!

(In reply to Gerald Squelart [:gerald] (he/him) from comment #0)

C. Disconnect promise handlers, but that's more code to keep track of them, and I'm not sure it would prevent dispatching?

If you use a MozPromiseRequestHolder to hold the promise returned by IPDL; disconnecting will prevent any tasks from being dispatched.

When the tracker is destroyed, any extant channel is closed, this can trigger the rejection of pending promises, which dispatch tasks to promise handlers. So we need to ensure that this happens before threads cannot service dispatches anymore.

Assignee: nobody → gsquelart
Status: NEW → ASSIGNED
Pushed by gsquelart@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/ca6bc38ba7f7 Destroy ProfilerParentTracker before threads are shut down - r=jya,canaltinova
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla78
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: