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

Invariant failure in DatabaseType::setName when running sharded mapReduce with invalid output db

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.1.6
    • Component/s: Sharding
    • ALL
    • Hide
      // Start a sharded cluster and enable sharding on the 'test' DB
      
      // Note: Use sync: true to run with legacy config servers
      var opts = {shards: 1, mongos: 1, sync: false};
      var st = new ShardingTest(opts);
      st.s0.getDB('admin').runCommand({enablesharding: 'test'});
      
      var coll = st.s0.getDB('test').foo;
      
      // Note: the invalid input {db: ''} is required to trigger the invariant failure
      coll.mapReduce(Function.prototype, Function.prototype, {out: {db: ''}});
      
      Show
      // Start a sharded cluster and enable sharding on the 'test' DB // Note: Use sync: true to run with legacy config servers var opts = {shards: 1, mongos: 1, sync: false}; var st = new ShardingTest(opts); st.s0.getDB('admin').runCommand({enablesharding: 'test'}); var coll = st.s0.getDB('test').foo; // Note: the invalid input {db: ''} is required to trigger the invariant failure coll.mapReduce(Function.prototype, Function.prototype, {out: {db: ''}});
    • Sharding A (10/09/15), Sharding B (10/30/15)

      This bug triggers a verify() failure when using legacy config servers and an invariant failure when using CSRS.

      In 3.0.5, the repro script only results in a mapReduce command failure ('exception: invalid database name').

      CSRS:

      Invariant failure !name.empty() src/mongo/s/catalog/type_database.cpp 114
      
      #0  0x00007ff9838d520b in raise (sig=5) at ../nptl/sysdeps/unix/sysv/linux/pt-raise.c:37
      #1  0x00000000016276c7 in mongo::breakpoint () at src/mongo/util/debugger.cpp:63
      #2  0x000000000160fa41 in mongo::invariantFailed (expr=0x1c5cfc0 "!name.empty()", file=0x1c5cf60 "src/mongo/s/catalog/type_database.cpp", line=114) at src/mongo/util/assert_util.cpp:152
      #3  0x000000000147593a in mongo::DatabaseType::setName (this=0x7ff97f784930, name=...) at src/mongo/s/catalog/type_database.cpp:114
      #4  0x00000000013e9142 in mongo::CatalogManager::createDatabase (this=0x601a000412b0, dbName=...) at src/mongo/s/catalog/catalog_manager.cpp:553
      #5  0x0000000001568082 in mongo::Grid::implicitCreateDb (this=0x264f880 <mongo::grid>, dbName=...) at src/mongo/s/grid.cpp:67
      #6  0x000000000150f7dc in mongo::(anonymous namespace)::MRCmd::run (this=0x264c780 <mongo::(anonymous namespace)::clusterMapReduceCmd>, txn=0x60200002bf40, dbname=..., cmdObj=..., options=0, errmsg=..., result=...)
          at src/mongo/s/commands/cluster_map_reduce_cmd.cpp:225
      #7  0x0000000001590515 in mongo::Command::execCommandClientBasic (txn=0x60200002bf40, c=0x264c780 <mongo::(anonymous namespace)::clusterMapReduceCmd>, client=..., queryOptions=0, ns=0x60420006d714 "test.$cmd", cmdObj=..., result=...)
          at src/mongo/s/s_only.cpp:128
      #8  0x0000000001590c10 in mongo::Command::runAgainstRegistered (ns=0x60420006d714 "test.$cmd", jsobj=..., anObjBuilder=..., queryOptions=0) at src/mongo/s/s_only.cpp:169
      #9  0x00000000015a37be in mongo::Strategy::clientCommandOp (r=...) at src/mongo/s/strategy.cpp:370
      #10 0x000000000158f15b in mongo::Request::process (this=0x7ff97f786a90, attempt=0) at src/mongo/s/request.cpp:111
      #11 0x0000000000e0a536 in mongo::ShardedMessageHandler::process (this=0x7fffafe3d2f0, m=..., p=0x600e00003c10) at src/mongo/s/server.cpp:135
      #12 0x0000000001644c54 in mongo::PortMessageServer::handleIncomingMsg (arg=0x600e00003c10) at src/mongo/util/net/message_server_port.cpp:229
      #13 0x00007ff984727b98 in ?? () from /usr/lib/x86_64-linux-gnu/libasan.so.0
      #14 0x00007ff9838cd182 in start_thread (arg=0x7ff97f787700) at pthread_create.c:312
      #15 0x00007ff9835fa47d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
      

      Legacy config servers:

      Assertion failure _name != "" src/mongo/s/catalog/legacy/distlock.cpp 335
      
      #0  0x00007f5fd5daa20b in raise (sig=5) at ../nptl/sysdeps/unix/sysv/linux/pt-raise.c:37
      #1  0x00000000016276c7 in mongo::breakpoint () at src/mongo/util/debugger.cpp:63
      #2  0x000000000160f8d8 in mongo::verifyFailed (expr=0x1c3d460 "_name != \"\"", file=0x1c3c700 "src/mongo/s/catalog/legacy/distlock.cpp", line=335) at src/mongo/util/assert_util.cpp:140
      #3  0x000000000142c18e in mongo::DistributedLock::lock_try (this=0x60100003ab20, why=..., other=0x7f5fd2599560, timeout=30) at src/mongo/s/catalog/legacy/distlock.cpp:335
      #4  0x00000000014398a1 in mongo::LegacyDistLockManager::lock (this=0x60220001f600, name=..., whyMessage=..., waitFor=..., lockTryInterval=...) at src/mongo/s/catalog/legacy/legacy_dist_lock_manager.cpp:103
      #5  0x00000000013e8f53 in mongo::CatalogManager::createDatabase (this=0x60220001f720, dbName=...) at src/mongo/s/catalog/catalog_manager.cpp:531
      #6  0x0000000001568082 in mongo::Grid::implicitCreateDb (this=0x264f880 <mongo::grid>, dbName=...) at src/mongo/s/grid.cpp:67
      #7  0x000000000150f7dc in mongo::(anonymous namespace)::MRCmd::run (this=0x264c780 <mongo::(anonymous namespace)::clusterMapReduceCmd>, txn=0x602000053d40, dbname=..., cmdObj=..., options=0, errmsg=..., result=...)
          at src/mongo/s/commands/cluster_map_reduce_cmd.cpp:225
      #8  0x0000000001590515 in mongo::Command::execCommandClientBasic (txn=0x602000053d40, c=0x264c780 <mongo::(anonymous namespace)::clusterMapReduceCmd>, client=..., queryOptions=0, ns=0x6042000e1994 "test.$cmd", cmdObj=..., result=...)
          at src/mongo/s/s_only.cpp:128
      #9  0x0000000001590c10 in mongo::Command::runAgainstRegistered (ns=0x6042000e1994 "test.$cmd", jsobj=..., anObjBuilder=..., queryOptions=0) at src/mongo/s/s_only.cpp:169
      #10 0x00000000015a37be in mongo::Strategy::clientCommandOp (r=...) at src/mongo/s/strategy.cpp:370
      #11 0x000000000158f15b in mongo::Request::process (this=0x7f5fd259ba90, attempt=0) at src/mongo/s/request.cpp:111
      #12 0x0000000000e0a536 in mongo::ShardedMessageHandler::process (this=0x7fff2e84aea0, m=..., p=0x600e00021ea0) at src/mongo/s/server.cpp:135
      #13 0x0000000001644c54 in mongo::PortMessageServer::handleIncomingMsg (arg=0x600e00021ea0) at src/mongo/util/net/message_server_port.cpp:229
      #14 0x00007f5fd6bfcb98 in ?? () from /usr/lib/x86_64-linux-gnu/libasan.so.0
      #15 0x00007f5fd5da2182 in start_thread (arg=0x7f5fd259c700) at pthread_create.c:312
      #16 0x00007f5fd5acf47d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
      

      Version: a067d03eca22d67a1ca036ea61544cd51df1490b

            Assignee:
            misha.tyulenev@mongodb.com Misha Tyulenev (Inactive)
            Reporter:
            kamran.khan Kamran K.
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: