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

invalid ensureIndex crashes mongod server

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.1.3
    • Affects Version/s: None
    • Component/s: None
    • None
    • Environment:
      linux-x86_64-1.0.1, but it's one we compiled ourself with boost 1_38 libs, and not the distro

      The mongod server crashes when the c++ client sends a bad ensureIndex(). Here's the code (http://pastebin.com/d744f024)

      void statstore_mongo::init(vector<string>& options) {
      dbconn_.reset(new DBClientConnection());
      try

      { string host = options.size() > 1 ? options[1] : "localhost"; dbconn_->connect(host); BSONObjBuilder b; b.append("stat_id", 1); b.append("word", 1); BSONObj obj = b.obj(); dbconn_->ensureIndex("retweet", obj); // This crashes the server on the second ensureIndex(). dbconn_->ensureIndex("hashtags", obj); dbconn_->ensureIndex("location", obj); dbconn_->ensureIndex("keywords", obj); }

      catch (const UserException& e)

      { string what("Unable to open mongo database connection: "); what.append(e.what()); throw runtime_error(what); }

      }

      And here's a partial log:

      Mon Oct 26 21:27:54 git version: 73ed0277ffabb283f315b1da18a90c9c889b4924
      Mon Oct 26 21:27:54 sys info: Linux dev3.node01.nowpublic.com 2.6.18-92.1.18.el5.028stab060.2 #1 SMP Tue Jan 13 11:38:36 MSK 2009 x86_64
      Mon Oct 26 21:27:54 waiting for connections on port 27017
      Mon Oct 26 21:28:24 connection accepted from 67.220.204.51:42115 #1
      Mon Oct 26 21:28:24 building new index on

      { stat_id: 1, word: 1 }

      for retweet...
      Mon Oct 26 21:28:24 Buildindex retweet idxNo:1 { ns: "retweet", key:

      { stat_id: 1, word: 1 }

      , name: "stat_id_1_word_1" }
      Mon Oct 26 21:28:24 done for 9 records 0secs
      Mon Oct 26 21:28:24 end connection 67.220.204.51:42115
      Mon Oct 26 21:30:57 connection accepted from 67.220.204.51:21982 #2
      Mon Oct 26 21:30:57 allocating new datafile /usr/local/mongodb/bin/../data/hashtags.ns, filling with zeroes...
      Mon Oct 26 21:30:57 done allocating datafile /usr/local/mongodb/bin/../data/hashtags.ns, size: 16MB, took 0.048 secs
      Mon Oct 26 21:30:57 allocating new datafile /usr/local/mongodb/bin/../data/hashtags.0, filling with zeroes...
      Mon Oct 26 21:30:57 done allocating datafile /usr/local/mongodb/bin/../data/hashtags.0, size: 64MB, took 0.197 secs
      Mon Oct 26 21:30:57 Got signal: 11 (Segmentation fault).
      Mon Oct 26 21:30:57 Backtrace:
      0x58f539 0x2b6785d0f1b0 0x5540d6 0x54f438 0x550ec3 0x539cb0 0x53e226 0x590c36 0x5a7727 0x2b67853292f7 0x2b6785db0e3d
      ./mongod(_ZN5mongo10abruptQuitEi+0x399) [0x58f539]
      /lib64/libc.so.6 [0x2b6785d0f1b0]
      ./mongod [0x5540d6]
      ./mongod [0x54f438]
      ./mongod [0x550ec3]
      ./mongod [0x539cb0]
      ./mongod [0x53e226]
      ./mongod(_ZN5mongo10connThreadEv+0x1f6) [0x590c36]
      ./mongod [0x5a7727]
      /lib64/libpthread.so.0 [0x2b67853292f7]
      /lib64/libc.so.6(clone+0x6d) [0x2b6785db0e3d]
      Mon Oct 26 21:30:57 dbexit:
      Mon Oct 26 21:30:57 shutdown: going to flush oplog...
      Mon Oct 26 21:30:57 shutdown: going to close sockets...
      Mon Oct 26 21:30:57 shutdown: waiting for fs...
      Mon Oct 26 21:30:57 shutdown: closing all files...
      Mon Oct 26 21:30:57 closeAllFiles() finished
      Mon Oct 26 21:30:57 shutdown: removing fs lock...
      Mon Oct 26 21:30:57 dbexit: really exiting now
      ERROR: Client::shutdown not called!

            Assignee:
            eliot Eliot Horowitz (Inactive)
            Reporter:
            douggreen Doug Green
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: