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

mongod should fail to start on macOS when it can't listen port on all interfaces

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Works as Designed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Networking
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      OS X
    • Sprint:
      Platforms 2016-10-31

      Description

      On macOS you can have two different mongod's listening on same port: one with a specific IP addresses to bind to and second one with an empty list. Can't reproduce this behavior on Linux.

      $ uname -mprs
      Darwin 16.0.0 x86_64 i386
      $ ifconfig|grep 'inet '
      	inet 127.0.0.1 netmask 0xff000000
      	inet 10.5.17.205 netmask 0xffff0000 broadcast 10.5.255.255
      	inet 10.211.55.2 netmask 0xffffff00 broadcast 10.211.55.255
      	inet 10.37.129.2 netmask 0xffffff00 broadcast 10.37.129.255
      $ ps -p $(pgrep mongod)
        PID TTY           TIME CMD
      90084 ??         0:04.49 /usr/local/opt/mongodb/bin/mongod --config /usr/local/etc/mongod.conf
      90613 ttys006    0:03.70 /usr/local/m/versions/3.4.0-rc0/bin/mongod
      $ lsof -i :27017 -a -sTCP:LISTEN
      COMMAND   PID USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
      mongod  90084  abr    6u  IPv4 0x11850b417b6b6f43      0t0  TCP localhost:27017 (LISTEN)
      mongod  90084  abr    8u  IPv4 0x11850b4177f2b64b      0t0  TCP 10.211.55.2:27017 (LISTEN)
      mongod  90613  abr    6u  IPv4 0x11850b417dcb864b      0t0  TCP *:27017 (LISTEN)
      $ grep bindIp /usr/local/etc/mongod.conf
        bindIp: 127.0.0.1,10.211.55.2
      

      There are no warnings or errors for mongod running with default configuration (PID 90613):

      2016-10-12T08:38:33.061-0700 I NETWORK  [thread1] waiting for connections on port 27017
      

      $ mongo --port 27017
      MongoDB shell version v3.4.0-rc0
      connecting to: mongodb://127.0.0.1:27017/
      MongoDB server version: 3.2.10
      WARNING: shell and server versions do not match
      >
      bye
      $ mongo --port 27017 --host 10.37.129.2
      MongoDB shell version v3.4.0-rc0
      connecting to: mongodb://10.37.129.2:27017/
      MongoDB server version: 3.4.0-rc0
      Server has startup warnings:
      2016-10-12T08:38:32.868-0700 I CONTROL  [initandlisten]
      2016-10-12T08:38:32.868-0700 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
      2016-10-12T08:38:32.868-0700 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
      2016-10-12T08:38:32.869-0700 I CONTROL  [initandlisten]
      > 
      

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: