Closed Bug 1539071 Opened 8 months ago Closed 8 months ago

Blank page when reloading about:devtools-toolbox using remote debugging

Categories

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

68 Branch
defect

Tracking

(firefox66 wontfix, firefox67 wontfix, firefox68 verified)

VERIFIED FIXED
Firefox 68
Tracking Status
firefox66 --- wontfix
firefox67 --- wontfix
firefox68 --- verified

People

(Reporter: hani.yacoub, Assigned: jdescottes)

References

(Blocks 1 open bug)

Details

(Whiteboard: [remote-debugging-reserve])

Attachments

(1 file, 1 obsolete file)

[Affected versions]:
Nightly 68.0a1, Firefox Dev Edition 67.0b4 and Firefox 66.0.1

[Affected platforms]:
Platforms: Windows 10 x 64, Mac OS X 10.14, and Ubuntu 16.04 x64.

[Steps to reproduce]:

  1. Make sure that you are connected to a local Firefox using about:debugging following these instructions:
    https://gist.github.com/juliandescottes/b0d3d83154d9ea8a84db5d32aa35d2c1
    https://www.youtube.com/watch?v=YI0plrxWHf4
  2. Have both profiles "Client Firefox and Server Firefox" running.
  3. From "Tabs" section, click on "Inspect" button for any of the open tabs (ex. reddit.com)
  4. Click on "Memory/Performnce/Console" panel.
  5. Close this about:devtools-toolbox tab.
  6. Reload the about:devtools-toolbox tab (keyboard shortcut, reload button, etc...)

[ Expected result]:
about:devtools-toolbox should be reloaded.

[Actual result]:
The page is reloaded but it returns a blank page.

[Note]:

  • I observed that only on the following panels the issue is reproducible (Memory/Performnce/Console/Inspector).
  • After a couple of reloads "about:devtools-toolbox" page could be displayed correctly.
Summary: Blank page when reloading about:devtools-toolbox → Blank page when reloading about:devtools-toolbox using remote debugging

The difference with similar Bug 1521440 is that while the UI is blank, we remain on about:devtools-toolbox (and as Hani said, if you keep reloading, you will eventually get the page to display correctly).

We suspect this is linked to async destroy in panels. We have a bug logged dedicated to clean this up https://bugzilla.mozilla.org/show_bug.cgi?id=1529621.

In this bug we should see if we can make about:devtools-toolbox resilient to panels with async destroy. If not this will be blocked on Bug 1529621.

Assignee: nobody → jdescottes
Status: NEW → ASSIGNED
Priority: -- → P1
Whiteboard: [remote-debugging-reserve]

After investigating a bit, this is the combination of several issues. They are not related to a particular panel being async, the whole toolbox destroy being async is the problem here.

The first issue is that the devtools's map _toolboxes is updated too late.

When we reload the page, devtools.js::showToolbox will check if the target already has a toolbox:
client/framework/devtools.js#455

But the entry in the map is only cleared when toolbox fires the "destroyed" event, which is almost the last step of the async destroy.
client/framework/devtools.js#554-557
client/framework/toolbox.js#3048

So instead of creating a new Toolbox we try to reuse the one that is being destroyed.

If we fix that, by invalidating the entry in the map earlier or any other workaround, then we have a second issue. When debugging remote clients, we are always reusing the same client (to avoid connection prompts). But if we use the same client, we will also get the same target fronts when we ask the front for a debug target. The toolbox destroy is also destroying the target front at the end of its destroy:
client/framework/toolbox.js#3046

But when we try to get the target after the reload,
client/framework/toolbox-init.js#110
client/framework/target-from-url.js#65
The target has not been destroyed yet, so client.mainRoot.getTab({ outerWindowID: id }); will return the target front instance that is about to be destroyed. This second issue would also not occur if the toolbox destroy was synchronous.

I will post a workaround to illustrate this. The correct fix is definitely to make everything in the destroy sequence for the toolbox synchronous.

I don't intend to land this, this is just to illustrate the investigation posted in the bug.

See Also: → 1542702
Pushed by jdescottes@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/e2fdd460d7b1
Wait for toolbox destroy to finish before reloading toolbox tab;r=daisuke
Status: ASSIGNED → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 68

Is this patch worth uplift consideration for Beta or can it ride the trains?

Flags: needinfo?(jdescottes)
Flags: in-testsuite+

This one can ride the trains, about:devtools-toolbox should be mostly unused until Fx 68 when we ship the new remote debugging.

Flags: needinfo?(jdescottes)

Verified as fixed on Firefox Nightly 68.0a1 (2019-04-17) on Windows 10 x 64, Mac OS X 10.14 and on Ubuntu 16.04 x64.

Status: RESOLVED → VERIFIED
Attachment #9053974 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.