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

dropDatabase() seems to be killing my connection Edit

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Cannot Reproduce
    • Affects Version/s: 2.4.6
    • Fix Version/s: None
    • Component/s: Networking, Stability
    • Labels:
      None
    • Environment:
      Mac OS X 10.8.4, Node 0.10.16, MongoDB 2.4.6
    • Operating System:
      OS X
    • Steps To Reproduce:
      Hide

      Adding this snippet to my app breaks all hell loose:

          var databases = developerObject.projects;
          for (var i = 0; i < databases.length; i++) {
              var buildingDatabase = databases[i].name;
              var db = global.MongoDBConnector.db(buildingDatabase);
              console.log('=> dropping building database: ' + db.databaseName);
              db.dropDatabase();
          }

      I'm only deleting one database and then this issue happens. If I leave the above snippet out, it all works like a charm.

      Show
      Adding this snippet to my app breaks all hell loose: var databases = developerObject.projects; for (var i = 0; i < databases.length; i++) { var buildingDatabase = databases[i].name; var db = global.MongoDBConnector.db(buildingDatabase); console.log('=> dropping building database: ' + db.databaseName); db.dropDatabase(); } I'm only deleting one database and then this issue happens. If I leave the above snippet out, it all works like a charm.

      Description

      Hello,

      I have the following setup:

      Node v0.10.16
      MongoDB 2.4.6

      I'm experiencing something really odd with MongoDB's connection and Node: once I issue a dropDatabase command from my Node app, the connection drops from 5 to 0 and MongoDB becomes pretty much useless. Here's the output I see:

          TurboMonkey:momows tito$ mongod
          mongod --help for help and startup options
          Thu Sep 26 20:21:46.796 [initandlisten] MongoDB starting : pid=2710 port=27017 dbpath=/data/db/ 64-bit host=TurboMonkey.local
          Thu Sep 26 20:21:46.796 [initandlisten] 
          Thu Sep 26 20:21:46.796 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
          Thu Sep 26 20:21:46.796 [initandlisten] db version v2.4.6
          Thu Sep 26 20:21:46.796 [initandlisten] git version: b9925db5eac369d77a3a5f5d98a145eaaacd9673
          Thu Sep 26 20:21:46.796 [initandlisten] build info: Darwin bs-osx-106-x86-64-2.10gen.cc 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7 16:32:41 PDT 2011; root:xnu-1504.15.3~1/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49
          Thu Sep 26 20:21:46.796 [initandlisten] allocator: system
          Thu Sep 26 20:21:46.796 [initandlisten] options: {}
          Thu Sep 26 20:21:46.803 [initandlisten] journal dir=/data/db/journal
          Thu Sep 26 20:21:46.803 [initandlisten] recover : no journal files present, no recovery needed
          Thu Sep 26 20:21:46.820 [websvr] admin web console waiting for connections on port 28017
          Thu Sep 26 20:21:46.820 [initandlisten] waiting for connections on port 27017
          Thu Sep 26 20:21:54.789 [initandlisten] connection accepted from 127.0.0.1:57062 #1 (1 connection now open)
          Thu Sep 26 20:21:54.793 [initandlisten] connection accepted from 127.0.0.1:57063 #2 (2 connections now open)
          Thu Sep 26 20:21:54.794 [initandlisten] connection accepted from 127.0.0.1:57064 #3 (3 connections now open)
          Thu Sep 26 20:21:54.794 [initandlisten] connection accepted from 127.0.0.1:57065 #4 (4 connections now open)
          Thu Sep 26 20:21:54.795 [initandlisten] connection accepted from 127.0.0.1:57066 #5 (5 connections now open)
          Thu Sep 26 20:22:03.368 [conn3] dropDatabase f30cdad4-ecb8-4d9a-85c5-02dd0e4f464b starting
          Thu Sep 26 20:22:03.380 [conn3] removeJournalFiles
          Thu Sep 26 20:22:03.381 [conn3] dropDatabase f30cdad4-ecb8-4d9a-85c5-02dd0e4f464b finished
          Thu Sep 26 20:22:03.381 [conn1] end connection 127.0.0.1:57062 (4 connections now open)
          Thu Sep 26 20:22:03.382 [conn2] end connection 127.0.0.1:57063 (3 connections now open)
          Thu Sep 26 20:22:03.382 [conn3] end connection 127.0.0.1:57064 (3 connections now open)
          Thu Sep 26 20:22:03.382 [conn4] end connection 127.0.0.1:57065 (1 connection now open)
          Thu Sep 26 20:22:03.382 [conn5] end connection 127.0.0.1:57066 (0 connections now open)

      From this moment on, the requests "hang" and never come back. I see this with find() and findOne(). What's strange is that even with the auto_reconnect option, MongoDB tries to reopen the connection every ~1 minute but then loses them:

          Thu Sep 26 20:28:54.681 [initandlisten] connection accepted from 127.0.0.1:57190 #24 (1 connection now open)
          Thu Sep 26 20:28:54.681 [initandlisten] connection accepted from 127.0.0.1:57191 #25 (2 connections now open)
          Thu Sep 26 20:28:54.681 [initandlisten] connection accepted from 127.0.0.1:57192 #26 (3 connections now open)
          Thu Sep 26 20:28:54.683 [conn25] end connection 127.0.0.1:57191 (2 connections now open)
          Thu Sep 26 20:28:54.684 [conn24] end connection 127.0.0.1:57190 (1 connection now open)
          Thu Sep 26 20:28:54.684 [conn26] end connection 127.0.0.1:57192 (0 connections now open)

      The connection pool is set to 5, but I only see 3 being opened (and then quickly closed) once the dropDatabase() problem has occurred. If I remove the section that performs the dropDatabase, it all works fine:

          var databases = developerObject.projects;
          for (var i = 0; i < databases.length; i++) {
              var buildingDatabase = databases[i].name;
              var db = global.MongoDBConnector.db(buildingDatabase);
              console.log('=> dropping building database: ' + db.databaseName);
              db.dropDatabase();
          }

      The other thing I find odd is that I don't see an exception being raised or any type of error. It's a complete silent failure.

      Any ideas? Thanks in advance.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            tito Tito Ciuro
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: