Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-9598

mongoDB server crashes when using min() / max() with descending order sort

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.2.0
    • Component/s: Querying
    • Environment:
      Windows 7 64 bit SP1
    • Windows
    • Hide

      See description.

      Show
      See description.

      Possibly related to SERVER-9547 which demonstrates that:

      db.docs.drop()
      for (var i=0; i<10; i++) { db.docs.insert({number: i}) }
      db.docs.ensureIndex({number: 1})
      

      with a descending sort

      db.docs.find().max({number: 4}).sort({number: -1})
      

      returns 0 documents.

      On my system with a debug build of mongoDB, instead it crashes my server.

      Mon May 06 10:25:34 [conn1]  TESTCRASH.docs Assertion failure la <= 0xffffff c:\mongodb\src\mongo\db\btree.h 243
      Mon May 06 10:25:38 [conn1] mongod.exe  ...\src\mongo\util\stacktrace.cpp(161)              mongo::printStackTrace+0x5b
      Mon May 06 10:25:38 [conn1] mongod.exe  ...\src\mongo\util\log.cpp(435)                     mongo::logContext+0x72
      Mon May 06 10:25:38 [conn1] mongod.exe  ...\src\mongo\util\assert_util.cpp(109)             mongo::verifyFailed+0x190
      Mon May 06 10:25:38 [conn1] mongod.exe  ...\src\mongo\db\btree.h(243)                       mongo::DiskLoc56Bit::operator=+0x7a
      Mon May 06 10:25:38 [conn1] mongod.exe  ...\src\mongo\db\btree.cpp(751)                     mongo::BtreeBucket<mongo::BtreeData_V1>::find+0x64
      Mon May 06 10:25:38 [conn1] mongod.exe  ...\src\mongo\db\btree.cpp(1512)                    mongo::BtreeBucket<mongo::BtreeData_V1>::locate+0x74
      Mon May 06 10:25:38 [conn1] mongod.exe  ...\src\mongo\db\btree.cpp(1506)                    mongo::BtreeBucket<mongo::BtreeData_V1>::locate+0xd2
      Mon May 06 10:25:38 [conn1] mongod.exe  ...\src\mongo\db\btreecursor.cpp(173)               mongo::BtreeCursorImpl<mongo::BtreeData_V1>::_locate+0xdd
      Mon May 06 10:25:38 [conn1] mongod.exe  ...\src\mongo\db\btreecursor.cpp(289)               mongo::BtreeCursor::initWithoutIndependentFieldRanges+0x1df
      Mon May 06 10:25:38 [conn1] mongod.exe  ...\src\mongo\db\btreecursor.cpp(227)               mongo::BtreeCursor::make+0xba
      Mon May 06 10:25:38 [conn1] mongod.exe  ...\src\mongo\db\queryoptimizer.cpp(296)            mongo::QueryPlan::newCursor+0x388
      Mon May 06 10:25:38 [conn1] mongod.exe  ...\src\mongo\db\queryoptimizercursorimpl.cpp(821)  mongo::CursorGenerator::singlePlanCursor+0x189
      Mon May 06 10:25:38 [conn1] mongod.exe  ...\src\mongo\db\queryoptimizercursorimpl.cpp(845)  mongo::CursorGenerator::generate+0xbf
      Mon May 06 10:25:38 [conn1] mongod.exe  ...\src\mongo\db\queryoptimizercursorimpl.cpp(724)  mongo::NamespaceDetailsTransient::getCursor+0xbf
      Mon May 06 10:25:38 [conn1] mongod.exe  ...\src\mongo\db\ops\query.cpp(662)                 mongo::queryWithQueryOptimizer+0x1a9
      Mon May 06 10:25:38 [conn1] mongod.exe  ...\src\mongo\db\ops\query.cpp(1015)                mongo::runQuery+0x112f
      Mon May 06 10:25:38 [conn1] mongod.exe  ...\src\mongo\db\instance.cpp(244)                  mongo::receivedQuery+0x155
      Mon May 06 10:25:38 [conn1] mongod.exe  ...\src\mongo\db\instance.cpp(390)                  mongo::assembleResponse+0x37d
      Mon May 06 10:25:38 [conn1] mongod.exe  ...\src\mongo\db\db.cpp(192)                        mongo::MyMessageHandler::process+0x133
      Mon May 06 10:25:38 [conn1] mongod.exe  ...\src\mongo\util\net\message_server_port.cpp(86)  mongo::pms::threadRun+0x638
      Mon May 06 10:25:38 [conn1] *** unhandled exception 0x80000003 at 0x000007FEFDF03172, terminating
      Mon May 06 10:25:38 [conn1] *** stack trace for unhandled exception:
      Mon May 06 10:25:39 [conn1] KERNELBASE.dll                                                      DebugBreak+0x2
      Mon May 06 10:25:39 [conn1] mongod.exe      ...\src\mongo\util\debug_util.cpp(46)               mongo::mongo_breakpoint+0x22
      Mon May 06 10:25:39 [conn1] mongod.exe      ...\src\mongo\util\debug_util.h(65)                 mongo::breakpoint+0x25
      Mon May 06 10:25:39 [conn1] mongod.exe      ...\src\mongo\util\assert_util.cpp(116)             mongo::verifyFailed+0x2b0
      Mon May 06 10:25:39 [conn1] mongod.exe      ...\src\mongo\db\btree.h(243)                       mongo::DiskLoc56Bit::operator=+0x7a
      Mon May 06 10:25:39 [conn1] mongod.exe      ...\src\mongo\db\btree.cpp(751)                     mongo::BtreeBucket<mongo::BtreeData_V1>::find+0x64
      Mon May 06 10:25:39 [conn1] mongod.exe      ...\src\mongo\db\btree.cpp(1512)                    mongo::BtreeBucket<mongo::BtreeData_V1>::locate+0x74
      Mon May 06 10:25:39 [conn1] mongod.exe      ...\src\mongo\db\btree.cpp(1506)                    mongo::BtreeBucket<mongo::BtreeData_V1>::locate+0xd2
      Mon May 06 10:25:39 [conn1] mongod.exe      ...\src\mongo\db\btreecursor.cpp(173)               mongo::BtreeCursorImpl<mongo::BtreeData_V1>::_locate+0xdd
      Mon May 06 10:25:39 [conn1] mongod.exe      ...\src\mongo\db\btreecursor.cpp(289)               mongo::BtreeCursor::initWithoutIndependentFieldRanges+0x1df
      Mon May 06 10:25:39 [conn1] mongod.exe      ...\src\mongo\db\btreecursor.cpp(227)               mongo::BtreeCursor::make+0xba
      Mon May 06 10:25:39 [conn1] mongod.exe      ...\src\mongo\db\queryoptimizer.cpp(296)            mongo::QueryPlan::newCursor+0x388
      Mon May 06 10:25:39 [conn1] mongod.exe      ...\src\mongo\db\queryoptimizercursorimpl.cpp(821)  mongo::CursorGenerator::singlePlanCursor+0x189
      Mon May 06 10:25:39 [conn1] mongod.exe      ...\src\mongo\db\queryoptimizercursorimpl.cpp(845)  mongo::CursorGenerator::generate+0xbf
      Mon May 06 10:25:39 [conn1] mongod.exe      ...\src\mongo\db\queryoptimizercursorimpl.cpp(724)  mongo::NamespaceDetailsTransient::getCursor+0xbf
      Mon May 06 10:25:39 [conn1] mongod.exe      ...\src\mongo\db\ops\query.cpp(662)                 mongo::queryWithQueryOptimizer+0x1a9
      Mon May 06 10:25:39 [conn1] mongod.exe      ...\src\mongo\db\ops\query.cpp(1015)                mongo::runQuery+0x112f
      Mon May 06 10:25:39 [conn1] mongod.exe      ...\src\mongo\db\instance.cpp(244)                  mongo::receivedQuery+0x155
      Mon May 06 10:25:39 [conn1] mongod.exe      ...\src\mongo\db\instance.cpp(390)                  mongo::assembleResponse+0x37d
      Mon May 06 10:25:39 [conn1] mongod.exe      ...\src\mongo\db\db.cpp(192)                        mongo::MyMessageHandler::process+0x133
      Mon May 06 10:25:39 [conn1] writing minidump diagnostic file mongo.dmp
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            therefore George Thompson
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: