Push notifications can still be received during shutdown

NEW
Unassigned

Status

()

defect
P3
normal
2 years ago
11 months ago

People

(Reporter: dao, Unassigned, NeedInfo)

Tracking

(Blocks 2 bugs)

Trunk
All
Linux
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [fxperf:p3])

Reporter

Description

2 years ago
I was suffering from some bad shutdown hangs recently in Nightly. In one particularly bad instance, when Firefox was hung for more than a minute and the browser window was already long gone, I still received notifications from IRCCloud.
Hi Kit, would you please take a look?
Flags: needinfo?(kit)
Hmm, IRCCloud doesn't use service workers, so IIUC it can show web notifications only as long as scripts are still running on the page. We also close all open notifications for the page when the DOM window is frozen or destroyed. I'm at a loss to explain why that didn't work here. Maybe the window wasn't fully destroyed? Have you been able to reproduce the hang, Dão?
Flags: needinfo?(kit) → needinfo?(dao+bmo)
Reporter

Comment 3

2 years ago
I haven't seen the hang in the last few days.

Are you sure waiting for the window to be fully destroyed is the right thing to do? Is there some earlier event this should listen to instead?
Flags: needinfo?(dao+bmo) → needinfo?(kit)
I think so, but I'm out of my depth here. `EventSource` (http://searchfox.org/mozilla-central/rev/9a7fbdee1d54f99cd548af95b81231d80e5f9ad1/dom/base/EventSource.cpp#635-637) and `WebSocket` (http://searchfox.org/mozilla-central/rev/9a7fbdee1d54f99cd548af95b81231d80e5f9ad1/dom/base/WebSocket.cpp#2587-2591) use the same events to clean up.

Could it be that the `Notification` is somehow keeping the DOM window alive? I see `Close` takes ownership before dispatching in http://searchfox.org/mozilla-central/rev/9a7fbdee1d54f99cd548af95b81231d80e5f9ad1/dom/notification/Notification.cpp#2204-2207, but the observer just calls `CloseInternal` in http://searchfox.org/mozilla-central/rev/9a7fbdee1d54f99cd548af95b81231d80e5f9ad1/dom/notification/Notification.cpp#2696-2697,2708.

Baku, do you have any ideas? I see William is on PTO until Friday.
Flags: needinfo?(kit) → needinfo?(amarchesini)
Is dom/notification/NotificationDB.jsm somehow related? I stumbled on it in a shutdown profile today. It's unregistering its listeners very late during shutdown, when receiving the xpcom-shutdown notification (I think it should observe quit-application-granted instead).
Kit, that code looks to me. I suspect the problem is elsewhere. If there are workers involved, have you released all the WorkerHolder correctly? This is usually the reason of a bad shutdown.
Flags: needinfo?(amarchesini)
William may have thoughts as he's knowledgeable about general web notifications.
Flags: needinfo?(wchen)
Whiteboard: [fxperf]
Priority: -- → P3
Priority: P3 → --
Whiteboard: [fxperf] → [fxperf:p3]

Updated

11 months ago
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.