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)

defect

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)

Attached patch The patch (obsolete) (deleted) — Splinter Review
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)
Blocks: 983197
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-
No longer blocks: 983197
Depends on: 983197
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
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 → ---
Whiteboard: [necko-would-take]
Priority: -- → P5
Attachment #8390567 - Flags: review-
Attachment #8390567 - Attachment is obsolete: true
Status: REOPENED → ASSIGNED
Priority: P5 → P1
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.
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
Status: ASSIGNED → RESOLVED
Closed: 9 years ago6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla66
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: