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

Fail gracefully on invalid port number

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Usability
    • Labels:
    • Fully Compatible
    • ALL

      If I pass an invalid port to mongod it prints a stack trace after the error message. It should just print the error.

      [ernie@eahimac ~]$ ./mongodb-osx-x86_64-2.4.5/bin/mongod --port 123123
      Wed Jul 17 17:10:18.557 bad --port number
      Wed Jul 17 17:10:18.557 dbexit:
      Wed Jul 17 17:10:18.557 shutdown: going to close listening sockets...
      Wed Jul 17 17:10:18.557 shutdown: going to flush diaglog...
      Wed Jul 17 17:10:18.557 shutdown: going to close sockets...
      Wed Jul 17 17:10:18.557 shutdown: waiting for fs preallocator...
      Wed Jul 17 17:10:18.557 shutdown: lock for final commit...
      Wed Jul 17 17:10:18.557 Assertion failure c src/mongo/db/client.h 235
      0x100447d8b 0x100421aec 0x100136a88 0x100136bc3 0x100136e4b 0x100136f78 0x1001e49bd 0x1000093a5 0x10000b593 0x1000010b4
      0 mongod 0x0000000100447d8b _ZN5mongo15printStackTraceERSo + 43
      1 mongod 0x0000000100421aec _ZN5mongo12verifyFailedEPKcS1_j + 284
      2 mongod 0x0000000100136a88 _ZN5mongo4Lock10ScopedLock6relockEv + 0
      3 mongod 0x0000000100136bc3 _ZN5mongo4Lock10ScopedLockC2Ec + 39
      4 mongod 0x0000000100136e4b _ZN5mongo4Lock10GlobalReadC2Ei + 29
      5 mongod 0x0000000100136f78 _ZN5mongo11readlocktryC2Ei + 50
      6 mongod 0x00000001001e49bd _ZN5mongo6dbexitENS_8ExitCodeEPKc + 861
      7 mongod 0x00000001000093a5 _ZL25processCommandLineOptionsRKSt6vectorISsSaISsEE + 17397
      8 mongod 0x000000010000b593 main + 467
      9 mongod 0x00000001000010b4 start + 52
      Wed Jul 17 17:10:18.581 shutdown failed with exception
      Wed Jul 17 17:10:18.581 dbexit: really exiting now
      [ernie@eahimac ~]$

      The 2.5 shell is nicer (the 2.2 shell doesn't seem to catch it at all)

      [ernie@eahimac ~]$ ./mongodb-osx-x86_64-2.2.5/bin/mongo --port 123123
      MongoDB shell version: 2.2.5
      connecting to: 127.0.0.1:123123/test
      Wed Jul 17 17:12:19 getaddrinfo("127.0.0.1") failed: nodename nor servname provided, or not known
      Wed Jul 17 17:12:19 Error: couldn't connect to server 127.0.0.1:123123 src/mongo/shell/mongo.js:93
      exception: connect failed
      [ernie@eahimac ~]$ ./mongodb-osx-x86_64-2.5.1/bin/mongo --port 123123
      MongoDB shell version: 2.5.1
      Wed Jul 17 17:12:29.804 Error: Invalid port number "123123" in connection string "127.0.0.1:123123/test" at src/mongo/shell/mongo.js:134
      exception: connect failed
      [ernie@eahimac ~]$

            Assignee:
            Unassigned Unassigned
            Reporter:
            ernie.hershey@mongodb.com Ernie Hershey (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: