Closed Bug 1198544 Opened 10 years ago Closed 10 years ago

FetchDriver can call OnResponseAvailable multiple times, leading to crashes

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla43
Tracking Status
firefox43 --- fixed

People

(Reporter: khuey, Assigned: jdm)

References

Details

Attachments

(3 files)

Attached file gdb log
OnStopRequest should probably not call OnResponseAvailable. But it does need to report the error somehow, and it's not clear to me where that should go since InternalResponse::mTerminationReason appears to be completely unused.
In my opinion, OnStopRequest should abort the pipe with an error code causing the body to become invalid. Its too late to return an Error Response object.
And then call OnResponseEnd().
Assignee: nobody → josh
The test asserts without my fix and passes with it.
Attachment #8659251 - Flags: review?(nsm.nikhil)
Comment on attachment 8659251 [details] [diff] [review] Prevent FetchDriver from creating multiple responses if OnStopRequest yields a failing status code Review of attachment 8659251 [details] [diff] [review]: ----------------------------------------------------------------- Nice!
Attachment #8659251 - Flags: feedback+
Comment on attachment 8659251 [details] [diff] [review] Prevent FetchDriver from creating multiple responses if OnStopRequest yields a failing status code Review of attachment 8659251 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/fetch/FetchDriver.cpp @@ +883,5 @@ > + nsCOMPtr<nsIAsyncOutputStream> outputStream = do_QueryInterface(mPipeOutputStream); > + if (outputStream) { > + outputStream->CloseWithStatus(NS_BINDING_FAILED); > + } > + SucceedWithResponse(); Call ContinueHttpFetchAfterNetworkFetch()? Can you add a comment that we resolve with success even though we failed since a successful Response has already been delivered in OnStartRequest(). ::: dom/workers/test/serviceworkers/fetch/interrupt.sjs @@ +10,5 @@ > + response.write("Content-Type: text/plain; charset=utf-8\r\n"); > + response.write("Cache-Control: no-cache, must-revalidate\r\n"); > + response.write("\r\n"); > + > + response.write(body); Nit: for loop with N = 10 and using N in the Content-Length :)
Attachment #8659251 - Flags: review?(nsm.nikhil) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/132aa442af953fab46644e34c60c6782350b703b Bug 1198544 - Prevent FetchDriver from creating multiple responses if OnStopRequest yields a failing status code. r=nsm
Attached patch interdiffSplinter Review
This fixes the crash observed on inbound, stemming from the changes requested during the review.
Flags: needinfo?(josh)
Attachment #8660150 - Flags: review?(nsm.nikhil)
Comment on attachment 8660150 [details] [diff] [review] interdiff Review of attachment 8660150 [details] [diff] [review]: ----------------------------------------------------------------- Ah... I'd rather you revert the patch to call SucceedWithResponse() as before rather than introduce this variable. Sorry.
Attachment #8660150 - Flags: review?(nsm.nikhil)
No longer blocks: 1174872
Status: NEW → ASSIGNED
https://hg.mozilla.org/integration/mozilla-inbound/rev/5af5ff26d3858268b19ddfbd15306b6ed07a3816 Bug 1198544 - Prevent FetchDriver from creating multiple responses if OnStopRequest yields a failing status code. r=nsm
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: