Closed Bug 1730919 Opened 4 months ago Closed 4 months ago

Ensure that an "Extension Suspend" profiler marker is also collected when an extension suspend a request but didn't resumed it yet

Categories

(WebExtensions :: Request Handling, enhancement, P3)

enhancement

Tracking

(firefox95 fixed)

RESOLVED FIXED
95 Branch
Tracking Status
firefox95 --- fixed

People

(Reporter: rpl, Assigned: rpl)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

The network "Extension Suspent" profiler markers introduced some times ago from Bug 1625006 are currently added from the ChannelWrapper::Resume method.

Unfortunately this also means that there will be no "Extension Suspend" marker in a Gecko profile collected before the suspended web request has been resumed.

The extension may even be never resuming the request (e.g. an exception that the extension may not be expecting may have prevented the extension from resolving a promise returned from a blocking webRequest listener, which would leave the request suspended for the entire lifetime of that extension), and it would be helpful to be able to see if that is happening while investigating an issue through a Gecko profile.

This issue goal is to look into the changes needed to make sure we add the marker when the request has been suspended, and then another marker from the resume method to close the marker interval (starting from the pointers Florian provided me some times ago when we briefly discussed about this issue, in particular the way nsDOMNavigationTiming.cpp is adding this kind of markers here).

Test extension and scenario

This attachment contains a small test extension I used to collect some sample profiles with and without the changes to the "Extension Suspend" profiler marker attached to this bug.
The extension intercepts with a blocking webRequest listener of main_frame requests for developer.mozilla.org urls, and provide a browserAction button with a few actions (suspend all intercepted requests, resume/cancel/redirect all suspended requests).

The scenario manually recreated while collecting the two sample profiles that follows:

  • install the attached test extension temporarily
  • open 4 tabs with developer.mozilla.org url loaded in all of them
  • start the Gecko Profiler
  • open the test extension browserAction popup and click "suspend all requests" button
  • reload the first tab, and after a few seconds click "resume all suspended requests" button in the browserAction popup, then click "suspend all requests" again
  • reload the second tab, and after a few seconds click "cancel all suspended requests" in the browserAction popup, then click "suspend all requests" again
  • reload the third tab, and after a few seconds click "redirect all suspended requests" in the browserAction popup, then click "suspend all requests" again
  • reload the forth tab, and after a few seconds capture the profile without resuming the suspended channel

Profiles Collected (with and without the attached patch)

The following are two profiles collected with and without the attached patch:

  • sample profile without the changes attached

    • the forth suspended request, the one never resumed, does not have an Extension Suspend marker and so it isn't clear in the profile what was preventing the Network Request to complete
    • the Extension Suspend marker also include in the text if the request was canceled or redirected, but it can't tell us exactly which was of the extension did cancel or redirect it (because the marker does always include the list of all suspenders)
  • sample profile with the changes attached

    • the forth suspended request has an Extension Suspend marker without an end (suggesting us that the marker for the Network Requests that also doesn't have an end timestamp and overlaps the Extension Suspend marker is due to the extension)
    • Extension Cancel and Extension Redirect are separate marker, in this case they tell us exactly which extension was responsible for the request being canceled or redirected (with the previous markers we always include the entire list of suspenders, without specify which one canceled or redirected the request)
Attachment #9241388 - Attachment description: WIP: Bug 1730919 - Add 'ExtensionSuspend' profiler marker from ChannelWrapper::Suspend. → Bug 1730919 - Add 'ExtensionSuspend' profiler marker from ChannelWrapper::Suspend.
Attachment #9241388 - Attachment description: Bug 1730919 - Add 'ExtensionSuspend' profiler marker from ChannelWrapper::Suspend. → Bug 1730919 - Add 'Extension Suspend' profiler marker from ChannelWrapper::Suspend.
Pushed by luca.greco@alcacoop.it:
https://hg.mozilla.org/integration/autoland/rev/e272c157f7cd
Add 'Extension Suspend' profiler marker from ChannelWrapper::Suspend. r=florian,mixedpuppy
Status: ASSIGNED → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 95 Branch
You need to log in before you can comment on or make changes to this bug.