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

mongod isn't ready for connections when it finishes a fork

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 3.4.0-rc0
    • Affects Version/s: None
    • Component/s: Networking
    • None
    • Fully Compatible
    • Platforms 2016-08-26, Platforms 2016-09-19, Platforms 2016-10-10

      Not sure which component this is but I have a script which starts mongod and then runs a status command against it:

      Mon Nov 24 02:25:04 CST 2014  Starting mmapv1-ycsb test
      about to fork child process, waiting until server is ready for connections.
      forked process: 26239
      child process started successfully, parent exiting
      2014-11-24T02:26:50.744-0600 W NETWORK  Failed to connect to 127.0.0.1:27077, reason: errno:111 Connection refused
      2014-11-24T02:26:50.746-0600 I QUERY    Error: couldn't connect to server 127.0.0.1:27077 (127.0.0.1), connection attempt failed
          at connect (src/mongo/shell/mongo.js:181:14)
          at (connect):1:21 at src/mongo/shell/mongo.js:181
      exception: connect failed
      

      Corresponding lines from the log:

      2014-11-24T02:26:50.667-0600 I CONTROL  [initandlisten] MongoDB starting : pid=26239 port=27077 dbpath=/disk1/db/mmapv1-ycsb 64-bit host=asya.mongodb.com
      2014-11-24T02:26:50.668-0600 I CONTROL  [initandlisten] db version v2.8.0-rc2-pre-
      2014-11-24T02:26:50.668-0600 I CONTROL  [initandlisten] git version: e4329ae5e7bfb56ef9b63a8388285b70b7ec9634
      2014-11-24T02:26:50.668-0600 I CONTROL  [initandlisten] build info: Linux build11.nj1.10gen.cc 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
      2014-11-24T02:26:50.668-0600 I CONTROL  [initandlisten] allocator: tcmalloc
      2014-11-24T02:26:50.668-0600 I CONTROL  [initandlisten] options: { net: { port: 27077 }, processManagement: { fork: true }, storage: { dbPath: "/disk1/db/mmapv1-ycsb", engine: "mmapv1", journal: { enabled: false }
      }, systemLog: { destination: "file", path: "/home/asya/logs/mmapv1-ycsb.log" } }
      2014-11-24T02:26:50.706-0600 I INDEX    [initandlisten] allocating new ns file /disk1/db/mmapv1-ycsb/local.ns, filling with zeroes...
      2014-11-24T02:26:50.732-0600 I STORAGE  [FileAllocator] allocating new datafile /disk1/db/mmapv1-ycsb/local.0, filling with zeroes...
      2014-11-24T02:26:50.732-0600 I STORAGE  [FileAllocator] creating directory /disk1/db/mmapv1-ycsb/_tmp
      2014-11-24T02:26:50.745-0600 I STORAGE  [FileAllocator] done allocating datafile /disk1/db/mmapv1-ycsb/local.0, size: 64MB,  took 0 secs
      2014-11-24T02:26:50.748-0600 I NETWORK  [initandlisten] waiting for connections on port 27077
      2014-11-24T02:26:51.159-0600 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:53032 #1 (1 connection now open)
      

      You can see that it is waiting for connections as of T02:26:50.748 but it passed control back before T02:26:50.744 as by then the shell already tried to connect again to run command.

            Assignee:
            samantha.ritter@mongodb.com Samantha Ritter (Inactive)
            Reporter:
            asya.kamsky@mongodb.com Asya Kamsky
            Votes:
            3 Vote for this issue
            Watchers:
            17 Start watching this issue

              Created:
              Updated:
              Resolved: