Closed
Bug 983187
Opened 11 years ago
Closed 6 years ago
Test that downloads fail when an RST packet is received
Categories
(Core :: Networking, defect, P1)
Core
Networking
Tracking
()
RESOLVED
FIXED
mozilla66
Tracking | Status | |
---|---|---|
firefox66 | --- | fixed |
People
(Reporter: Paolo, Assigned: Paolo)
References
Details
(Whiteboard: [necko-would-take])
Attachments
(1 file, 1 obsolete file)
(deleted),
text/x-phabricator-request
|
Details |
Currently, downloads fail when an RST packet is received. This patch adds the capability to verify this in our test infrastructure, adding the ability for httpd.js to set the SO_LINGER socket option to send an RST packet when closing the connection.
Attachment #8390567 -
Flags: review?(honzab.moz)
Comment 1•11 years ago
|
||
Comment on attachment 8390567 [details] [diff] [review]
The patch
Review of attachment 8390567 [details] [diff] [review]:
-----------------------------------------------------------------
sorry for delay
r-
::: netwerk/base/public/nsISocketTransport.idl
@@ +100,5 @@
> /**
> + * Sets the SO_LINGER option with the specified values for the l_onoff and
> + * l_linger parameters.
> + */
> + void setLinger(in boolean aOnOff, in short aLinger);
update the uuid!
make the comment more explanatory, express this is set before PR_Close via PR_SockOpt_Linger on the socket.
::: netwerk/base/src/nsSocketTransport2.cpp
@@ +1600,5 @@
> {
> + PRSocketOptionData socket_linger;
> + socket_linger.option = PR_SockOpt_Linger;
> + socket_linger.value.linger.polarity = mLingerOnOff;
> + socket_linger.value.linger.linger = mLingerTimeout;
err... you must convert to PRIntervalTime units.
@@ +1601,5 @@
> + PRSocketOptionData socket_linger;
> + socket_linger.option = PR_SockOpt_Linger;
> + socket_linger.value.linger.polarity = mLingerOnOff;
> + socket_linger.value.linger.linger = mLingerTimeout;
> + PR_SetSocketOption(mFD, &socket_linger);
set the option only when there is a need. i.e. when mLingerOnOff is true (I have performance concerns).
@@ +1621,5 @@
> // FIX - Should use RUN_ON_THREAD once it's generally available
> // RUN_ON_THREAD(gSocketThread,WrapRunnableNM(&PR_Close, mFD);
> + gSocketTransportService->Dispatch(
> + new ThunkPRClose(fd, lingerOnOff, lingerTimeout),
> + NS_DISPATCH_NORMAL);
when you are here, can you please take the |new ThunkPRClose| out to a nsRefPtr<> ?
@@ +1643,5 @@
> + PRSocketOptionData socket_linger;
> + socket_linger.option = PR_SockOpt_Linger;
> + socket_linger.value.linger.polarity = mLingerOnOff;
> + socket_linger.value.linger.linger = mLingerTimeout;
> + PR_SetSocketOption(mFD, &socket_linger);
same perf concern here, can you do it only when mLingerOnOff is true?
::: netwerk/base/src/nsSocketTransport2.h
@@ +342,5 @@
> // socket timeouts are not protected by any lock.
> uint16_t mTimeouts[2];
>
> + // linger options to use when closing
> + bool mLingerOnOff;
this should be called |mLingerPolarity| or just |mLinger|. Same for the IDL argument.
::: netwerk/test/httpserver/httpd.js
@@ +3918,5 @@
>
> + // Ensure that we truncate the connection using an RST packet. This ensures
> + // that the client testing code is aware that an error occurred, otherwise
> + // it may consider the response as valid.
> + this._connection.transport.setLinger(true, 0);
hmm.. can this influence other tests? maybe this should be an (optional) arg to abort().
::: toolkit/components/jsdownloads/test/unit/head.js
@@ +816,5 @@
> + promiseExecuteSoon().then(() => {
> + aResponse.abort();
> + aResponse.finish();
> + do_print("Aborting response with network reset.");
> + }).then(null, Cu.reportError);
how can yo be sure the response is aborted before it's sent out? IMO would be better to process the response asynchronously and abort after you have sent some payload.
Attachment #8390567 -
Flags: review?(honzab.moz) → review-
Assignee | ||
Updated•10 years ago
|
Updated•9 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 2•9 years ago
|
||
Hm, looks like this was marked fixed but I haven't addressed the review comments and landed the patch yet. It's low priority but likely much faster to fix today than it was at the time, with all the build system and version control improvements.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Updated•9 years ago
|
Whiteboard: [necko-would-take]
Comment 3•7 years ago
|
||
Bulk change to priority: https://bugzilla.mozilla.org/show_bug.cgi?id=1399258
Priority: -- → P5
Assignee | ||
Updated•6 years ago
|
Attachment #8390567 -
Flags: review-
Assignee | ||
Updated•6 years ago
|
Attachment #8390567 -
Attachment is obsolete: true
Assignee | ||
Updated•6 years ago
|
Status: REOPENED → ASSIGNED
Priority: P5 → P1
Assignee | ||
Comment 4•6 years ago
|
||
This adds a way to simulate failed network connections, allowing the addition of test coverage that would otherwise not be available. This is used in the Downloads tests to ensure that failures at the network level are handled correctly.
Assignee | ||
Comment 5•6 years ago
|
||
Assignee | ||
Comment 6•6 years ago
|
||
Pushed by paolo.mozmail@amadzone.org:
https://hg.mozilla.org/integration/mozilla-inbound/rev/30d829df41ed
Test that downloads fail when an RST packet is received. r=mayhemer
Comment 8•6 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 9 years ago → 6 years ago
status-firefox66:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla66
You need to log in
before you can comment on or make changes to this bug.
Description
•