Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

SERVER-2451 guard dropped cursor on explain yield

  • Loading branch information...
commit 8330ff07664b1bbc1a966e5d224520872fbb245a 1 parent da3c2d6
astaple astaple authored

Showing 2 changed files with 9 additions and 5 deletions. Show diff stats Hide diff stats

  1. +1 0  db/query.cpp
  2. +8 5 jstests/explain3.js
1  db/query.cpp
@@ -863,6 +863,7 @@ namespace mongo {
863 863 }
864 864
865 865 if ( _pq.isExplain() ) {
  866 + massert( 13638, "client cursor dropped during explain query yield", _c.get() );
866 867 _eb.noteScan( _c.get(), _nscanned, _nscannedObjects, _n, scanAndOrderRequired(),
867 868 _curop.elapsedMillis(), useHints && !_pq.getHint().eoo(), _nYields ,
868 869 _nChunkSkips, _keyFieldsOnly.get() > 0 );
13 jstests/explain3.js
... ... @@ -1,8 +1,5 @@
1 1 /** SERVER-2451 Kill cursor while explain is yielding */
2 2
3   -// disable test until SERVER-2451 fixed
4   -if ( false ) {
5   -
6 3 t = db.jstests_explain3;
7 4 t.drop();
8 5
@@ -14,8 +11,14 @@ db.getLastError();
14 11
15 12 s = startParallelShell( "sleep( 20 ); db.jstests_explain3.dropIndex( {i:1} );" );
16 13
17   -printjson( t.find( {i:{$gt:-1},j:1} ).hint( {i:1} ).explain() );
  14 +try {
  15 + t.find( {i:{$gt:-1},j:1} ).hint( {i:1} ).explain()
  16 +} catch (e) {
  17 + print( "got exception" );
  18 + printjson( e );
  19 +}
18 20
19 21 s();
20 22
21   -}
  23 +// Sanity check to make sure mongod didn't seg fault.
  24 +assert.eq( 10000, t.count() );

0 comments on commit 8330ff0

Please sign in to comment.
Something went wrong with that request. Please try again.