summaryrefslogtreecommitdiff
path: root/src/mongo/executor/connection_pool.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/connection_pool.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/connection_pool.cpp')
-rw-r--r--src/mongo/executor/connection_pool.cpp50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/mongo/executor/connection_pool.cpp b/src/mongo/executor/connection_pool.cpp
index 92fa55aeaf3..188772d8aee 100644
--- a/src/mongo/executor/connection_pool.cpp
+++ b/src/mongo/executor/connection_pool.cpp
@@ -360,7 +360,7 @@ void ConnectionPool::SpecificPool::returnConnection(ConnectionInterface* connPtr
// If we've exceeded the time limit, start a new connect, rather than
// failing all operations. We do this because the various callers have
// their own time limit which is unrelated to our internal one.
- if (status.code() == ErrorCodes::ExceededTimeLimit) {
+ if (status.code() == ErrorCodes::NetworkInterfaceExceededTimeLimit) {
spawnConnections(lk);
return;
}
@@ -542,29 +542,29 @@ void ConnectionPool::SpecificPool::spawnConnections(stdx::unique_lock<stdx::mute
// Run the setup callback
lk.unlock();
- connPtr->setup(_parent->_options.refreshTimeout,
- [this](ConnectionInterface* connPtr, Status status) {
- connPtr->indicateUsed();
-
- stdx::unique_lock<stdx::mutex> lk(_parent->_mutex);
-
- auto conn = takeFromProcessingPool(connPtr);
-
- if (conn->getGeneration() != _generation) {
- // If the host and port was dropped, let the
- // connection lapse
- } else if (status.isOK()) {
- addToReady(lk, std::move(conn));
- } else if (status.code() == ErrorCodes::ExceededTimeLimit) {
- // If we've exceeded the time limit, restart the connect, rather than
- // failing all operations. We do this because the various callers
- // have their own time limit which is unrelated to our internal one.
- spawnConnections(lk);
- } else {
- // If the setup failed, cascade the failure edge
- processFailure(status, std::move(lk));
- }
- });
+ connPtr->setup(
+ _parent->_options.refreshTimeout, [this](ConnectionInterface* connPtr, Status status) {
+ connPtr->indicateUsed();
+
+ stdx::unique_lock<stdx::mutex> lk(_parent->_mutex);
+
+ auto conn = takeFromProcessingPool(connPtr);
+
+ if (conn->getGeneration() != _generation) {
+ // If the host and port was dropped, let the
+ // connection lapse
+ } else if (status.isOK()) {
+ addToReady(lk, std::move(conn));
+ } else if (status.code() == ErrorCodes::NetworkInterfaceExceededTimeLimit) {
+ // If we've exceeded the time limit, restart the connect, rather than
+ // failing all operations. We do this because the various callers
+ // have their own time limit which is unrelated to our internal one.
+ spawnConnections(lk);
+ } else {
+ // If the setup failed, cascade the failure edge
+ processFailure(status, std::move(lk));
+ }
+ });
// Note that this assumes that the refreshTimeout is sound for the
// setupTimeout
@@ -663,7 +663,7 @@ void ConnectionPool::SpecificPool::updateStateInLock() {
_requests.pop();
lk.unlock();
- cb(Status(ErrorCodes::ExceededTimeLimit,
+ cb(Status(ErrorCodes::NetworkInterfaceExceededTimeLimit,
"Couldn't get a connection within the time limit"));
lk.lock();
} else {