Open Bug 1617015 Opened 5 years ago Updated 4 years ago

Ghost window when closing about:debugging tab while still connected to a device

Categories

(DevTools :: about:debugging, defect, P2)

All
macOS
defect

Tracking

(Not tracked)

People

(Reporter: mstange, Unassigned)

Details

Attachments

(1 file)

Steps to reproduce:

  1. Set memory.ghost_window_timeout_seconds to 0 on about:config.
  2. Click Measure on about:memory, and make sure that the ghost-windows measurement for the Main Process reports zero.
  3. Open about:debugging, connect to an Android Firefox browser on a USB-connected Android device, and select that device.
  4. Close the about:debugging tab, without disconnecting from the device.
  5. Go to about:memory again, wait a second, click the buttons GC, CC, GC, CC, wait ten more seconds, and click Measure.

Expected results:
There should be no ghost windows.

Actual results:

1 (100.0%) -- ghost-windows
└──1 (100.0%) ── about:debugging#/runtime/ZY322HN5D2|%40org.mozilla.fenix.debug%2Ffirefox-debugger-socket

If I reopen the about:debugging tab, click Disconnect, and close the tab, then the ghost window goes away.

There's some documentation of ghost windows in nsWindowMemoryReporter.h:
https://searchfox.org/mozilla-central/rev/5a10be606f2d76ef22f1f44565749490de991d35/dom/base/nsWindowMemoryReporter.h#22-54

Thanks for the detailed report! Interestingly, this only reproduces with USB runtimes (local network runtime didn't leak any window).

I attached a small work in progress that fixes the issue. It looks that mainly, the async destroy prevents from cleanly removing events when destroying the page. I've wanted to make this sync for a long time but never got around doing it. The current patch is really not a clean take on this, but illustrates the idea.

Priority: -- → P3
Severity: normal → S2

S1 or S2 bugs needs an assignee - could you find someone for this bug?

Flags: needinfo?(jdescottes)
Severity: S2 → S3
Flags: needinfo?(jdescottes)
Priority: P3 → P2
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: