[SERVER-20190] ASIO cancel() should preempt any outstanding network requests Created: 28/Aug/15  Updated: 07/Oct/15  Resolved: 17/Sep/15

Status: Closed
Project: Core Server
Component/s: Networking
Affects Version/s: None
Fix Version/s: 3.1.9

Type: Improvement Priority: Major - P3
Reporter: Eric Milkie Assignee: Adam Midvidy
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-19438 honor timeouts passed to startCommand... Closed
Backwards Compatibility: Fully Compatible
Sprint: Platform 9 (09/18/15)
Participants:

 Description   

If I have an outstanding ASIO network request waiting for a response, I should be able to asynchronously cancel the request from another thread, and such a request should abandon any current network operation and return immediately with some sort of "cancelled" error response.
This will be useful for implementing 'shutdown' and implementing timeouts, among other things.



 Comments   
Comment by Githook User [ 16/Sep/15 ]

Author:

{u'username': u'amidvidy', u'name': u'Adam Midvidy', u'email': u'amidvidy@gmail.com'}

Message: SERVER-20190 don't invariant if we fail during connection setup
Branch: master
https://github.com/mongodb/mongo/commit/6f0991f0bfc96becf28fe46fa5bb1dd57c7bb514

Comment by Githook User [ 16/Sep/15 ]

Author:

{u'username': u'amidvidy', u'name': u'Adam Midvidy', u'email': u'amidvidy@gmail.com'}

Message: SERVER-20190 add signalWorkAvailable to new exit point in startCommand
Branch: master
https://github.com/mongodb/mongo/commit/640a127f2694a145a90fc85376a6172493cb36f0

Comment by Githook User [ 15/Sep/15 ]

Author:

{u'username': u'samantharitter', u'name': u'Samantha Ritter', u'email': u'samantha.ritter@10gen.com'}

Message: SERVER-20190 cancelCommand() preempts outstanding network events in NetworkInterfaceASIO

Signed-off-by: Adam Midvidy <amidvidy@gmail.com>
Branch: master
https://github.com/mongodb/mongo/commit/266825feecbb38d7526da368b0517f72e728ef18

Comment by Andy Schwerin [ 02/Sep/15 ]

Specifically, if I have a CallbackHandle from a TaskExecutor, and I call cancel on it, the callback associated with the handle should execute promptly in the "canceled" mode. It should not need to wait for the remove host to respond or the operation to timeout. Hypothetically, this could be implemented in the TaskExecutor, but I think it would be pretty difficult to avoid double-executing the callback.

Comment by Adam Midvidy [ 28/Aug/15 ]

this is related to the work Jason has done on timeouts. Note that we need to give each socket its own strand to make this safe with multiple io_service worker threads.

Generated at Thu Feb 08 03:53:27 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.