summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandolph Tan <randolph@10gen.com>2014-08-27 15:00:43 -0400
committerRandolph Tan <randolph@10gen.com>2014-09-08 14:09:24 -0400
commitd5a8cfd7bddcc0c4bc63bc637dc744bcbf0bfb8a (patch)
tree4f9dff5c54dcdb51e00063e233aba3acacc3b49c
parentc344f31ae584773c043abe3c718b4f7a151e4e28 (diff)
downloadmongo-d5a8cfd7bddcc0c4bc63bc637dc744bcbf0bfb8a.tar.gz
SERVER-15056 Sharded connection cleanup on setup error can crash mongos
(cherry picked from commit 18dba6ed5bbe0d0177a81cbe660dcd93fcf18109)
-rw-r--r--src/mongo/client/parallel.cpp4
-rw-r--r--src/mongo/client/parallel.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/mongo/client/parallel.cpp b/src/mongo/client/parallel.cpp
index 7dcc7573df0..cbd7684d688 100644
--- a/src/mongo/client/parallel.cpp
+++ b/src/mongo/client/parallel.cpp
@@ -542,9 +542,7 @@ namespace mongo {
if( ! retryNext && pcState ){
if( errored && pcState->conn ){
- // Don't return this conn to the pool if it's bad
- pcState->conn->kill();
- pcState->conn.reset();
+ // Connection will cleanup for itself. Do nothing.
}
else if( initialized ){
diff --git a/src/mongo/client/parallel.h b/src/mongo/client/parallel.h
index bae89c36cc6..7ae43c9ce53 100644
--- a/src/mongo/client/parallel.h
+++ b/src/mongo/client/parallel.h
@@ -268,6 +268,8 @@ namespace mongo {
ParallelConnectionState() :
count( 0 ), done( false ) { }
+ // Please do not reorder. cursor destructor can use conn.
+ // On a related note, never attempt to cleanup these pointers manually.
ShardConnectionPtr conn;
DBClientCursorPtr cursor;