Blank content area when reloading multipart/x-mixed-replace page with developer tools pane open
Categories
(DevTools :: Netmonitor, defect, P1)
Tracking
(firefox-esr68 unaffected, firefox72 unaffected, firefox73+ disabled, firefox74+ wontfix, firefox75 fixed, firefox76 fixed)
Tracking | Status | |
---|---|---|
firefox-esr68 | --- | unaffected |
firefox72 | --- | unaffected |
firefox73 | + | disabled |
firefox74 | + | wontfix |
firefox75 | --- | fixed |
firefox76 | --- | fixed |
People
(Reporter: dleborgne, Assigned: mattwoodrow)
References
(Blocks 1 open bug, Regression, )
Details
(Keywords: regression)
Attachments
(2 files)
204.25 KB,
image/png
|
Details | |
47 bytes,
text/x-phabricator-request
|
jcristau
:
approval-mozilla-beta+
|
Details | Review |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:73.0) Gecko/20100101 Firefox/73.0
Steps to reproduce:
- Start Firefox 73.0b8
- Open https://xenon.coheris.com/ff73/
- Press F12
- Press F5 in the Firefox window
Actual results:
- Page is blank
Expected results:
- Page should be displayed as in step 2
Reporter | ||
Comment 1•4 years ago
|
||
This is a regression from Firefox 72, which works as expected.
The problem came to our attention with our internal Bugzilla 5.0 server, which uses the "multipart/x-mixed-replace" content-type for displaying bug lists. On our server, the Firefox page load indicator never stops when displaying a bug list, and trying to use development tools revealed this bug.
Comment 2•4 years ago
|
||
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0
20200123095433
- Any developer tools tab will do.
- Only happens when reloading. If you open a new tab, then the developer tools, then go to the link, it loads fine.
- View Source on the blank page opens a new tab that's stuck loading forever.
(In reply to David Le Borgne from comment #1)
This is a regression from Firefox 72, which works as expected.
It would be very useful if you could find the exact regression range.
https://mozilla.github.io/mozregression/quickstart.html
Taking an educated guess here, it looks like this might've been regressed by bug 1600211.
Reporter | ||
Comment 3•4 years ago
|
||
regression-window |
(In reply to Gingerbread Man from comment #2)
Taking an educated guess here, it looks like this might've been regressed by bug 1600211.
You are right ! Using mozregression, I got these information :
Using url: https://hg.mozilla.org/integration/autoland/json-pushes?changeset=1e479194244ab14e9ebad664865c8e6bc2cdf1c7&full=1
Found commit message:
Bug 1600211 - Forward AllPartsStopped to HttpChannelChild to ensure that we notify the listeners correctly. r=mayhemer
Differential Revision: https://phabricator.services.mozilla.com/D55223
Updated•4 years ago
|
Reporter | ||
Comment 4•4 years ago
|
||
Using Firefox 73.0b10 or 73.0b11, everything is back to normal. I'm unable to reproduce the error described in comment 0 or the endless page load indicator on Bugzilla 5.0 lists
Comment 5•4 years ago
|
||
Comment 6•4 years ago
|
||
We disabled DocumentChannel in 73.0b9 (bug 1610888), so it makes sense that this bug isn't occurring on Fx73 anymore given the regression range.
Assignee | ||
Comment 7•4 years ago
|
||
The view-source issue appears to be somewhat separate to this bug (though regressed from the same change).
I've filed bug 1612992 for that.
Assignee | ||
Comment 8•4 years ago
|
||
This is failing because we're hitting a JS error in the devtools network response observer, which then cancels the request.
The failure is here: https://searchfox.org/mozilla-central/rev/2e355fa82aaa87e8424a9927c8136be184eeb6c7/devtools/shared/platform/cache-entry.js#95
We're trying to access request.URI, but the JS object 'request' only has bindings for nsIRequest, not nsIChannel (where the 'URI' field is).
I believe this worked previously, because onStartRequest is usually called with the same object instance as the underlying channel we used when creating the NetworkResponseListener.
The code that creates the NetworkResponseListener makes sure we have bindings for nsIChannel (as a subset of nsIHttpChannel) here - https://searchfox.org/mozilla-central/rev/2e355fa82aaa87e8424a9927c8136be184eeb6c7/devtools/server/actors/network-monitor/network-observer.js#571
In this case, the request passed to onStartRequest is a wrapper for the current part of the multipart response, and thus is a separate object (which does implement nsIChannel, as well as nsIMultiPartChannel, but we haven't bound those).
Adding a 'request.QueryInterface(nsIChannel)' line into the onStartRequest listener is sufficient to fix this issue, but it's hard to reason about what other interfaces we're expecting to be available.
Updated•4 years ago
|
Comment 9•4 years ago
|
||
@Matt: is the following change the one you have in mind?
diff --git a/devtools/server/actors/network-monitor/network-response-listener.js b/devtools/server/actors/network-monitor/network-response-listener.js
--- a/devtools/server/actors/network-monitor/network-response-listener.js
+++ b/devtools/server/actors/network-monitor/network-response-listener.js
@@ -210,16 +210,18 @@ NetworkResponseListener.prototype = {
/**
* See documentation at
* https://developer.mozilla.org/En/NsIRequestObserver
*
* @param nsIRequest request
* @param nsISupports context
*/
onStartRequest: function(request) {
+ request = request.QueryInterface(Ci.nsIChannel);
+
// Converter will call this again, we should just ignore that.
if (this.request) {
return;
}
this.request = request;
this._getSecurityInfo();
this._findOpenResponse();
It seems to fix the issue on my machine.
Honza
Assignee | ||
Comment 10•4 years ago
|
||
Yeah, that's what works for me, I just wasn't sure if we were implicitly relying on 'request' having any other interfaces available.
I see this.request.fromCache which isn't nsIChannel, but I'm not sure where that comes from.
Updated•4 years ago
|
Comment 12•4 years ago
|
||
(In reply to Matt Woodrow (:mattwoodrow) from comment #8)
Adding a 'request.QueryInterface(nsIChannel)' line into the onStartRequest listener is sufficient to fix this issue, but it's hard to reason about what other interfaces we're expecting to be available.
Thanks a lot for tracking that down!
(In reply to Matt Woodrow (:mattwoodrow) from comment #10)
Yeah, that's what works for me, I just wasn't sure if we were implicitly relying on 'request' having any other interfaces available.
I see this.request.fromCache which isn't nsIChannel, but I'm not sure where that comes from.
Well... I think this code is just wrong. fromCache
isn't exposed by any WebIDL. So it is, and probably always have been undefined. And so, it comes from nowhere!
Otherwise, from what I can see, we only use contentType
and contentCharset
. So nsIChannel looks enough.
We also pass it to nsIStreamListener.onDataAvailable, which expects a nsIRequest, but I imagine it is automagically queried by xpconnect, and nsIChannel inherits from nsIRequest anyway, right?
Comment 13•4 years ago
|
||
(In reply to Jan Honza Odvarko [:Honza] (always need-info? me) from comment #9)
It seems to fix the issue on my machine.
It doesn't work for me. I no longer have the request.URI
is undefined, but it still prevents the page from loading correctly.
Comment 14•4 years ago
|
||
Hi Honza, could you assign someone to keep digging into this issue?
Comment 15•4 years ago
|
||
@Hubert: it would be great to do some analysis here. Could you please look at this?
Honza
Updated•4 years ago
|
Comment 16•4 years ago
|
||
(In reply to Jan Honza Odvarko [:Honza] (always need-info? me) from comment #9)
@Matt: is the following change the one you have in mind?
diff --git a/devtools/server/actors/network-monitor/network-response-listener.js b/devtools/server/actors/network-monitor/network-response-listener.js --- a/devtools/server/actors/network-monitor/network-response-listener.js +++ b/devtools/server/actors/network-monitor/network-response-listener.js @@ -210,16 +210,18 @@ NetworkResponseListener.prototype = { /** * See documentation at * https://developer.mozilla.org/En/NsIRequestObserver * * @param nsIRequest request * @param nsISupports context */ onStartRequest: function(request) { + request = request.QueryInterface(Ci.nsIChannel); + // Converter will call this again, we should just ignore that. if (this.request) { return; } this.request = request; this._getSecurityInfo(); this._findOpenResponse();
It seems to fix the issue on my machine.
Honza
Should we just test if this fix helps ?
Updated•4 years ago
|
Assignee | ||
Comment 18•4 years ago
|
||
(In reply to Jens Stutte [:jstutte] from comment #16)
Should we just test if this fix helps ?
It's a super simple fix, and we know that it fixes the issue as reported.
I'll wait for :bomsy to finish looking into it, to see if there other related issues, but I think it's worth getting the simple thing in and uplifted to beta ASAP.
Comment 19•4 years ago
|
||
FYI, I would prefer an uplift to the beta branch before Monday morning (CET) so as to have this bug part of the Monday merge.
Comment 20•4 years ago
|
||
(In reply to Matt Woodrow (:mattwoodrow) from comment #18)
(In reply to Jens Stutte [:jstutte] from comment #16)
Should we just test if this fix helps ?
It's a super simple fix, and we know that it fixes the issue as reported.
Matt, I was testing again and the patch doesn't work for me. It just hides the error in the Browser console but, doesn't solve the original issue.
Can you please verify on your machine?
More comments:
- I was doing more testing and the only thing that helps me to avoid the problem is disabling
NetworkResponseListener
entirely
Commenting out this line:
https://searchfox.org/mozilla-central/rev/a3266997560904b484fd89d6a6bcdeace4a13652/devtools/server/actors/network-monitor/network-observer.js#767
Obviously this isn't a solution since this is disabling the way how DevTools are intercepting and collecting HTTP response bodies.
But, it points to a possible culprit.
- I was looking more into the
NetworkResponseListener
and found this place.
https://searchfox.org/mozilla-central/rev/a3266997560904b484fd89d6a6bcdeace4a13652/devtools/server/actors/network-monitor/network-response-listener.js#56-60
I tried to disable the related setup but, it doesn't help. But the comment seems to be related to this bug so, something more might be needed
It points to this Bug 1309523 - [non-e10s] Wrong info in "Transferred" column
- I'd like to point out the previously found regressions:
Bug 1600211 - Handle multipart/x-mixed-replace responses in the parent process
Phab: https://phabricator.services.mozilla.com/D55223
These changes seems to be very related to this bug (and NetworkResponseListener
) and I think more analysis & testing of this patch would be great help.
Mayhemer, can you please help here?
Honza
Comment 21•4 years ago
•
|
||
To add to Honza's, i narrowed it down so far to
https://searchfox.org/mozilla-central/rev/a3266997560904b484fd89d6a6bcdeace4a13652/devtools/server/actors/network-monitor/network-observer.js#933
I've been getting this exception thrown, when pause on exception is turned on
Exception {
name: "NS_ERROR_FAILURE",
message: "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsITraceableChannel.setNewListener]",
result: 2147500037,
filename: "resource://devtools/server/actors/network-monitor/network-observer.js",
lineNumber: 933,
columnNumber: 0,
data: null,
stack: "
_setupResponseListener@resource://devtools/server/actors/network-monitor/network-observer.js:933:38\n
_createNetworkEvent@resource://devtools/server/actors/network-monitor/network-observer.js:767:12\n
_onRequestHeader@resource://devtools/server/actors/network-monitor/network-observer.js:793:10\n
NetworkObserver.prototype.observeActivity<@resource://devtools/server/actors/network-monitor/network-observer.js:580:12\n
exports.makeInfallible/<@resource://devtools/shared/ThreadSafeDevToolsUtils.js:111:22\n",
location: XPCWrappedNative_NoHelper }
![]() |
||
Comment 22•4 years ago
•
|
||
So we are apparently breaking at:
https://searchfox.org/mozilla-central/rev/a3266997560904b484fd89d6a6bcdeace4a13652/netwerk/protocol/http/HttpBaseChannel.cpp#2968
disabled here:
https://searchfox.org/mozilla-central/rev/a3266997560904b484fd89d6a6bcdeace4a13652/netwerk/protocol/http/HttpChannelChild.cpp#548
hmm... this means to revert to the previous listener and revert also the flag after we have notified OnStop here:
https://searchfox.org/mozilla-central/rev/a3266997560904b484fd89d6a6bcdeace4a13652/netwerk/protocol/http/HttpChannelChild.cpp#1223
I'll try that and report back.
Disregard the above...
Thanks for narrowing this down!
![]() |
||
Comment 23•4 years ago
|
||
Only change in the channel's listener after possible SetNewListener call is DoApplyContentConversions which we either don't do at all for multipart top level document-channel driven loads, or actually should be reverted as well, we would do conversion twice.
Matt? I don't remember how decoding with docchannel and multipart works.
![]() |
||
Comment 24•4 years ago
|
||
Set new listener is called on the parent process, not the child process. I am not hitting the exception in comment 21.
Comment 25•4 years ago
|
||
Hubert, please see the comment #24, can you help to to reproduce the exception?
Comment 26•4 years ago
•
|
||
Sorry for the long STR, it was part of my debugging process to figure out what was wrong
STR
- Update code with fix from comment #9.
- Start firefox (nightly for me)
- Open devtools
- Open Browser toolbox
- Open https://xenon.coheris.com/ff73/
- In browser tool box go to the debugger
- Click pause on exceptions
- Refresh firefox (it should be blank)
- it should pause on the exception here
https://searchfox.org/mozilla-central/rev/a69f60390921e21e1d62d40ce388c44a71db00c6/devtools/server/actors/network-monitor/network-response-listener.js#84 - Set a breakpoint on line 84 , turn off pause on exceptions and click resume
- Refresh firefox again (You should see the content fine)
- it should pause on the breakpoint at line 84
- Hit resume until it no longer hits that line (it's twice for me)
- Check the browser toolbox console, you should see the Exception (it should look like the attached file)
Let me know if this does not work.
Comment 29•4 years ago
|
||
I am assigning this to :mayhemer since this looks most likely as the platform bug.
- The STRs we found are in comment #26
- The possible regression is Bug 1600211 - Handle multipart/x-mixed-replace responses in the parent process
- Some more analysis in comment #20
:mayhemer please let me know if this makes sense.
Honza
Assignee | ||
Comment 30•4 years ago
|
||
I spent some time digging into this a bit further.
It looks like the devtools network-observer code is installing a stream-listener-tee listener so that it can observe the network traffic.
nsStreamListenerTee doesn't understand multipart, so it clears mSink on the first OnStopRequest, and then hits an error (cancelling the channel) when the next part start.
We can fix that fairly easily by querying for nsIMultiPartChannel, and only clearing mSink after the last part.
Assignee | ||
Comment 31•4 years ago
|
||
As of bug 1600211, multipart responses are now handled in the parent, and we get a separate OnStartRequest/OnStopRequest for each part, with the correct content types set.
Previously devtools would have only seen a single OnStart/StopRequest, with the multipart content type, and the contents containing all the special markers and contents of all parts.
NetworkResponseListener doesn't handle this correctly, as it disconnects the output stream in onStopRequest. That means that we only add an entry for the first part, and ignore the other.
I think ideally we'd detect the presence of multiple parts (by QI'ing for nsIMultiPartChannel), and keep the stream open until we get onAfterLastPart. We'd want to make the code understand this and have multiple entries in the UI.
Assignee | ||
Comment 32•4 years ago
|
||
Comment 33•4 years ago
|
||
Thanks Matt for working on this!
Your comment #31 makes good sense to me.
I filed a bug 1622209 to cover the follow up work on the Network panel
(so, we can close this one as soon as the platform is fixed)
Honza
![]() |
||
Updated•4 years ago
|
Comment 34•4 years ago
|
||
Pushed by mwoodrow@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/77436c074c25 Add multipart support to nsStreamListenerTee. r=mayhemer
Comment 35•4 years ago
|
||
bugherder |
Comment 36•4 years ago
|
||
The patch landed in nightly and beta is affected.
:mattwoodrow, is this bug important enough to require an uplift?
If not please set status_beta
to wontfix
.
For more information, please visit auto_nag documentation.
Comment 37•4 years ago
|
||
+1 on Uplift if the patch is safe.
(I tested on Nightly and it works for me)
Honza
Assignee | ||
Comment 38•4 years ago
|
||
Comment on attachment 9133079 [details]
Bug 1611081 - Add multipart support to nsStreamListenerTee. r?mayhemer
Beta/Release Uplift Approval Request
- User impact if declined: Failure to load page that uses multipart content type (rare), when devtools is open.
- Is this code covered by automated tests?: No
- Has the fix been verified in Nightly?: Yes
- Needs manual test from QE?: No
- If yes, steps to reproduce:
- List of other uplifts needed: None
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): Very simple change to add support for understanding multipart to another component, similar to ones we've done before.
- String changes made/needed:
Comment 39•4 years ago
|
||
Comment on attachment 9133079 [details]
Bug 1611081 - Add multipart support to nsStreamListenerTee. r?mayhemer
approved for 75.0b10
Comment 40•4 years ago
|
||
bugherder uplift |
Reporter | ||
Comment 41•4 years ago
|
||
The problem described in comment 0 is now fixed, as I was able to verify in Firefox 75.0 beta 11, but there are still two problems with multipart/x-mixed-replace pages, like bug lists in Bugzilla :
- the page load indicator never stops (while page seems fully loaded) : bug 1627087
- when developer tools are in use, reloading the page tools displays a truncated page : bug 1627089
Comment 42•4 years ago
|
||
Yes, I am also facing problems. There are some analysis in bug 1622490
Honza
Description
•