Closed
Bug 1153484
Opened 10 years ago
Closed 10 years ago
Assertion failure: !mMessage, at ErrorResult.h:54, due to bad error handling in mozilla::dom::(anonymous namespace)::FillResponseHeaders::VisitHeader (FetchDriver.cpp)
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla40
Tracking | Status | |
---|---|---|
firefox38 | --- | unaffected |
firefox39 | --- | fixed |
firefox40 | --- | fixed |
People
(Reporter: dbaron, Assigned: bkelly)
References
()
Details
(Keywords: assertion, crash, memory-leak)
Attachments
(2 files, 2 obsolete files)
7.93 KB,
text/plain
|
Details | |
1.50 KB,
patch
|
nsm
:
review+
lizzard
:
approval-mozilla-aurora+
|
Details | Diff | Splinter Review |
Steps to reproduce:
1. in a debug build, go to https://github.com/new
2. create a repository
3. wait for the resulting page to load
Actual results: crash due to fatal assertion about half the time:
Assertion failure: !mMessage, at ../../../dist/include/mozilla/ErrorResult.h:54
This is due to failing to properly deal with the ErrorResult in:
mozilla::dom::(anonymous namespace)::FillResponseHeaders::VisitHeader (in FetchDriver.cpp), which is currently:
627 NS_IMETHOD
628 VisitHeader(const nsACString & aHeader, const nsACString & aValue) override
629 {
630 ErrorResult result;
631 mResponse->Headers()->Append(aHeader, aValue, result);
632 return result.ErrorCode();
633 }
Reporter | ||
Comment 1•10 years ago
|
||
Assignee | ||
Updated•10 years ago
|
Blocks: ServiceWorkers-v1
Comment 2•10 years ago
|
||
Uh, yeah. That "return foo.ErrorCode()" is only OK if you're exactly duplicating behavior that could be accomplished with xpconnect. If you're throwing exceptions that have more than an nsresult to them, you're not allowed to do that.
In an opt build, this is leaking, of course, instead of asserting.
Keywords: mlk
Reporter | ||
Comment 3•10 years ago
|
||
I just hit this again, filing a new issue on github at https://github.com/TheoChevalier/FoxShop/issues/new , typing some text in the issue title and body, and then switching to the "Preview" tab.
It's pretty annoying to be unable to use github in a debug build without fear of crashing...
Reporter | ||
Updated•10 years ago
|
Blocks: dom-fetch-api
Assignee | ||
Comment 4•10 years ago
|
||
I think we can clear the message here, but unfortunately it seems the nsIHttpHeaderVisitor does not have a way to propagate the message itself.
Comment 5•10 years ago
|
||
You just shouldn't have XPCOM methods calling webidl ones that can do interesting things with the exception. Probably best to refactor the code to have an XPCOM version of Append and a WebIDL one or something so the issue doesn't arise.
But yes, a stopgap is to ClearMessage and return an nsresult that might mean something to the XPCOM consumer.
Assignee | ||
Comment 6•10 years ago
|
||
Actually, I think there is a bigger problem here. The nsIHttpHeaderVisitor.idl indicates the returned error is just used to stop enumeration. This method probably needs to ignore invalid headers by eating the error or flag the error somewhere else. Right now its ignore the invalid header and all following headers which is probably wrong.
Assignee | ||
Comment 7•10 years ago
|
||
Comment 8•10 years ago
|
||
Are you guaranteed that result is an error-with-message here?
I think what we should do is add a Catch() or ClearError() or SuppresException() or something method on ErrorResult which will properly handle dealing with the exception no matter what sort of exception we have (e.g. ClearMessage in the IsErrorWithMessage() case, unroot in the IsJSException() case, etc). That will make it much clearer what's actually going on.
Assignee | ||
Comment 9•10 years ago
|
||
Updated patch that clarifies we should expect channel->VisitResponseHeaders() to never return an error.
https://treeherder.mozilla.org/#/jobs?repo=try&revision=7ad10ccd5de4
Attachment #8596580 -
Attachment is obsolete: true
Attachment #8596580 -
Flags: review?(nsm.nikhil)
Assignee | ||
Comment 10•10 years ago
|
||
Comment on attachment 8596609 [details] [diff] [review]
Fetch should ignore invalid headers, but still process later headers. r=nsm
We're addressing comment 8 in a follow-up. See bug 1157754.
Attachment #8596609 -
Flags: review?(nsm.nikhil)
Assignee | ||
Comment 11•10 years ago
|
||
Comment on attachment 8596609 [details] [diff] [review]
Fetch should ignore invalid headers, but still process later headers. r=nsm
Try shows some unexpected errors. Seems we might be trying to get the headers from the channel before its ready.
Attachment #8596609 -
Flags: review?(nsm.nikhil)
Assignee | ||
Comment 12•10 years ago
|
||
Go back to the origin patch. VisitResponseHeaders can still fail if the channel is canceled or failed to get an mResponseHead for other reasons.
https://treeherder.mozilla.org/#/jobs?repo=try&revision=4a92fc20d853
Attachment #8596609 -
Attachment is obsolete: true
Assignee | ||
Updated•10 years ago
|
Attachment #8596701 -
Flags: review?(nsm.nikhil)
Attachment #8596701 -
Flags: review?(nsm.nikhil) → review+
Assignee | ||
Updated•10 years ago
|
status-firefox38:
--- → unaffected
status-firefox39:
--- → affected
Assignee | ||
Updated•10 years ago
|
Keywords: checkin-needed
Comment 13•10 years ago
|
||
Keywords: checkin-needed
Comment 14•10 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
Assignee | ||
Comment 15•10 years ago
|
||
Comment on attachment 8596701 [details] [diff] [review]
Fetch should ignore invalid headers, but still process later headers. r=nsm
Approval Request Comment
[Feature/regressing bug #]: Fetch API
[User impact if declined]: Possible unexpected results on sites using fetch() such as github due to losing expected HTTP headers.
[Describe test coverage new/current, TreeHerder]: Existing fetch() tests, although I don't think we explicitly test this particular branch of the code.
[Risks and why]: Minimal. This is fixing error handling that was already in place.
[String/UUID change made/needed]: None.
Attachment #8596701 -
Flags: approval-mozilla-aurora?
Comment 16•10 years ago
|
||
Comment on attachment 8596701 [details] [diff] [review]
Fetch should ignore invalid headers, but still process later headers. r=nsm
Approved for uplift to 39; sounds like a low-risk fix to error handling.
Attachment #8596701 -
Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Comment 17•10 years ago
|
||
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•