Closed Bug 1747371 Opened 4 years ago Closed 4 years ago

NetworkEventActor throws error message in Browser Toolbox | this._sessionContext is undefined

Categories

(DevTools :: Framework, defect, P3)

defect

Tracking

(firefox-esr91 unaffected, firefox95 unaffected, firefox96 unaffected, firefox97 wontfix, firefox98 fixed)

RESOLVED FIXED
98 Branch
Tracking Status
firefox-esr91 --- unaffected
firefox95 --- unaffected
firefox96 --- unaffected
firefox97 --- wontfix
firefox98 --- fixed

People

(Reporter: nchevobbe, Assigned: ochameau)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

Here's the full message + stacktrace:

TypeError: can't access property "type", this._sessionContext is undefined network-event-actor.js:124:7
    asResource resource://devtools/server/actors/network-monitor/network-event-actor.js:124
    asResource self-hosted:1178
    httpOnImageCacheResponse resource://devtools/server/actors/resources/network-events-content.js:149
    httpOnImageCacheResponse self-hosted:1178
    updateFxAPanel chrome://browser/content/browser-sync.js:905
    updateAllUI chrome://browser/content/browser-sync.js:596
    observe chrome://browser/content/browser-sync.js:574
    notifyStateUpdated resource://services-sync/UIState.jsm:140
    refreshState resource://services-sync/UIState.jsm:127
    InterpretGeneratorResume self-hosted:1485
    AsyncFunctionNext self-hosted:695

It looks like ParentProcessTargetActor is not initialized with a sessionContext

Keywords: regression
Regressed by: 1745238
Has Regression Range: --- → yes

Set release status flags based on info from the regressing bug 1745238

Setting NI based on assignee of the regressing bug in comment 1.

Alex, can you look into this? Thanks!

Flags: needinfo?(poirot.alex)

I'm not able to reproduce the exception.
It is true that the ParentProcessTarget actor isn't receiving a session context as it is still instantiated from the parent process descriptor and not from the Watcher actor.
But it should not spawn the NetworkEventContentWatcher. Instead it should be spawn by the tabs's WindowGlobalTargets.
These ones will be spawn by the watcher actor and should receive a session context.

Given that I'm not able to reproduce this easily, I'm wondering if that's rather a race condition where we are using a destroyed target actor??

Flags: needinfo?(poirot.alex)

Nicolas, can you provide additional steps to reproduce, so Alexandre might be able to repro this? Thanks.

Flags: needinfo?(nchevobbe)

I can reproduce easily with:

  1. On a Firefox where you're logged in with your Firefox account
  2. Open the browser toolbox
  3. On the main browser window, click on the Firefox account button so it opens the popup where you can synchronize, see your sunces tabs, …

-> The error is printed multiple times in the Browser Toolbox

Flags: needinfo?(nchevobbe)

NI per comment 5.

Flags: needinfo?(poirot.alex)

(In reply to Alexandre Poirot [:ochameau] from comment #3)

It is true that the ParentProcessTarget actor isn't receiving a session context as it is still instantiated from the parent process descriptor and not from the Watcher actor.
But it should not spawn the NetworkEventContentWatcher. Instead it should be spawn by the tabs's WindowGlobalTargets.

We do call spawn NetworkEventContentWatcher with a parent process target. Here's the stacktrace I get:

NetworkEventContentWatcher#watch - targetActor: server1.conn0.parentProcessTarget4
console.trace:
resource://devtools/server/actors/resources/network-events-content.js 44 watch
resource://devtools/server/actors/resources/index.js 242 watchResources
resource://devtools/server/actors/targets/target-actor-mixin.js 161 _watchTargetResources
resource://devtools/server/actors/targets/target-actor-mixin.js 53 addSessionDataEntry
resource://devtools/server/actors/watcher.js 573 watchResources

https://searchfox.org/mozilla-central/rev/eb554e155a28ad36aca62281406757833b9c467a/devtools/server/actors/watcher.js#549-575

Assignee: nobody → poirot.alex
Flags: needinfo?(poirot.alex)

Thanks for the stracktrace, it helped me craft a mochitest to cover this and better understand this edgecase.

Because of this exception we are most likely missing cached image request and CSP blocked request done from the parent process (and only the one done from the parent process). So that it only impact the browser toolbox's netmonitor.

We were missing cached image request and probably CSP blocked request
from the parent process because of this.
We are spawning a NetworkEventContentWatcher for the parent process target.
That's semi-intentional. This might better be done via a parent process resource type,
like NETWORK_EVENT. But the current Resource framework doesn't allow to do that easily.

So that we currently spawn the NetworkEventContentWatcher (and NetworkEventStackTraceWatcher)
against the parent process target actor as a "FRAME" resource type.
This is handy as we need at least one of these two watchers for the parent process.

The severity field is not set for this bug.
:ochameau, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(poirot.alex)
Severity: -- → S3
Flags: needinfo?(poirot.alex)
Priority: -- → P3
Pushed by apoirot@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/71af3a0623c4 [devtools] Set the session context for the parent process target. r=nchevobbe
Blocks: 1751200
Regressions: 1751214
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 98 Branch
Regressions: 1751480
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: