Closed Bug 1663981 Opened 4 years ago Closed 3 years ago

Investigate why chrome JS runs during thread manager shutdown

Categories

(Core :: XPCOM, defect)

defect

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: mccr8, Unassigned)

References

Details

In the last few releases, we've seen a few issues due to running chrome JS after we clear the CleanOnShutdown pointers (bug 1663315, bug 1656973). I've fixed a few issues causing the crashes, but the things I fixed were very old, so something must have changed in shutdown that caused us to run chrome JS later than we used to.

Here's an example crash: bp-415372bb-6106-4bef-93d5-0f0db0200909

We're crashing on this, which is right after the call to mozilla::KillClearOnShutdown(ShutdownPhase::ShutdownFinal):
nsThreadManager::get().Shutdown()

I think it is also interesting where in threadmanager shutdown we are crashing.

Specifically, it is on the line thread->Shutdown();. I think this is interesting because we do a call to NS_ProcessPendingEvents(mMainThread); earlier in the function, which I think means that the event that is running chrome JS was not pending at the start of the function, so something during thread shutdown caused it.

Anyways, I don't know much about thread shutdown, but I figured I should file a bug given that we keep seeing crashes.

Nathan, any ideas?

Flags: needinfo?(nfroyd)

(In reply to Andrew McCreight [:mccr8] from comment #1)

Nathan, any ideas?

I'm not quite sure what this question is asking -- "any ideas" as in "any ideas which threads are running chrome JS after shutdown"? I don't have solid ideas, but I'd guess workers of some kind? Or timers that are expiring and dispatch events to the main thread to run their chrome JS callbacks (sessionstore? telemetry?)?

Flags: needinfo?(nfroyd)

I guess I was wondering:

  1. What might this chrome JS be?
  2. Could we mitigate this somehow?

Maybe mozilla::KillClearOnShutdown(ShutdownPhase::ShutdownFinal) could be moved after the thread shutdown but odds are that will cause some other issue.

Severity: -- → S3

Somebody can file a new issue if they want to look into this. I just had kind of a vague idea and never followed up with it.

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.