summaryrefslogtreecommitdiff
path: root/src/mongo/client/parallel.cpp
diff options
context:
space:
mode:
authorWaley Chen <waleycz@gmail.com>2016-03-07 11:30:52 -0500
committerWaley Chen <waleycz@gmail.com>2016-03-07 11:30:52 -0500
commitcfa10de6e60b4eb0fbaa39d8d5e3a3774ad47b95 (patch)
treef266f4ea79b48c01fadfeee4a83c4d3f89269580 /src/mongo/client/parallel.cpp
parenta946a9159660506e0295feaaa6ad5adc0e60f559 (diff)
downloadmongo-cfa10de6e60b4eb0fbaa39d8d5e3a3774ad47b95.tar.gz
SERVER-22767 mongos segfault when invoking .explain() on certain operations
Diffstat (limited to 'src/mongo/client/parallel.cpp')
-rw-r--r--src/mongo/client/parallel.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mongo/client/parallel.cpp b/src/mongo/client/parallel.cpp
index 37d2622538a..23981d811ac 100644
--- a/src/mongo/client/parallel.cpp
+++ b/src/mongo/client/parallel.cpp
@@ -849,8 +849,14 @@ void ParallelSortClusteredCursor::finishInit(OperationContext* txn) {
}
throw;
} else {
- warning() << "db exception when finishing on " << shardId
- << ", current connection state is " << mdata.toBSON() << causedBy(e);
+ // the InvalidBSON exception indicates that the BSON is malformed ->
+ // don't print/call "mdata.toBSON()" to avoid unexpected errors e.g. a segfault
+ if (e.getCode() == 22)
+ warning() << "bson is malformed :: db exception when finishing on " << shardId
+ << causedBy(e);
+ else
+ warning() << "db exception when finishing on " << shardId
+ << ", current connection state is " << mdata.toBSON() << causedBy(e);
mdata.errored = true;
throw;
}