summaryrefslogtreecommitdiff
path: root/src/mongo/executor/network_interface_asio_operation.cpp
diff options
context:
space:
mode:
authorJason Carey <jcarey@argv.me>2016-12-12 15:22:01 -0500
committerJason Carey <jcarey@argv.me>2016-12-13 16:09:47 -0500
commit5e103c4f5583e2566a45d740225dc250baacfbd7 (patch)
treebc23152b120a3ed38c453bd42cd04fff09e9e94a /src/mongo/executor/network_interface_asio_operation.cpp
parent63fa79b30347475962f1ca7ba8858c57baf33925 (diff)
SERVER-27388 Add NetworkInterfaceExceededTimeLimitr3.4.1-rc0r3.4.1
max_time_ms_sharded.js uses a fail point to trigger immediate ExceededTimeLimit returns from commands. This triggers during connection establishment via the connection hook, which returns ExceededTimeLimit to the connection pool and causes us to spin on connection creation. The fix involves providing our own internal exceeded time limit that doesn't collide with the remote value. (cherry picked from commit 5d32ae99ab086e696bc9c5610c9f93220481e596)
Diffstat (limited to 'src/mongo/executor/network_interface_asio_operation.cpp')
-rw-r--r--src/mongo/executor/network_interface_asio_operation.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/mongo/executor/network_interface_asio_operation.cpp b/src/mongo/executor/network_interface_asio_operation.cpp
index f56c3be6e16..b300080ce76 100644
--- a/src/mongo/executor/network_interface_asio_operation.cpp
+++ b/src/mongo/executor/network_interface_asio_operation.cpp
@@ -191,13 +191,20 @@ NetworkInterfaceASIO::AsyncCommand* NetworkInterfaceASIO::AsyncOp::command() {
return _command.get_ptr();
}
-void NetworkInterfaceASIO::AsyncOp::finish(const ResponseStatus& rs) {
+void NetworkInterfaceASIO::AsyncOp::finish(ResponseStatus&& rs) {
// We never hold the access lock when we call finish from NetworkInterfaceASIO.
_transitionToState(AsyncOp::State::kFinished);
LOG(2) << "Request " << _request.id << " finished with response: "
<< redact(rs.isOK() ? rs.data.toString() : rs.status.toString());
+ // Our own internally generated time outs have a different error code to allow us to retry
+ // internal timeouts. But the outside world (and our tests) still expect the one true
+ // ExceededTimeLimit, so we convert back here so they get what they expect.
+ if (!rs.isOK() && rs.status.code() == ErrorCodes::NetworkInterfaceExceededTimeLimit) {
+ rs.status = Status(ErrorCodes::ExceededTimeLimit, rs.status.reason());
+ }
+
// Calling the completion handler may invalidate state in this op, so do it last.
_onFinish(rs);
}