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

mongod could exit whenit cannot bind listen port

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.5.3
    • Affects Version/s: 1.4.0, 1.4.2, 1.5.1
    • Component/s: Usability
    • None
    • Environment:
      at least OS X 64 bit, linux 32 bit - probably all
    • Minor Change

      At the moment, if you start mongod and it cannot acquire a lock on the data dir (given by the --dbpath option) then it will exit. On the other hand, if you specify a port with --port and it cannot bind to that port the process hangs indefinitely. Consistency between these two seems like it would be desirable.

      in particular, I would like it if the server exited upon failure to acquire a port, since starting up a mongod process for a particular batch of unit tests is desirable - in the case that you fail to acquire your desired port, you wish to know this fact before your tests start overwriting data that you may wish to keep around, and you wish to know that this has happened by the fact that the server process has exited, rather than having to parse its STDOUT.

      a trivial demonstration of this problem: run
      $ mongod --dbpath ~/data1 --port 28017 &
      $ mongod --dbpath ~/data2 --port 28017 &
      $ mongod --dbpath ~/data1 --port 28018 &
      $ jobs

      the two processes with the conflicting port will still be running, but not the conflicting db path.

      tested this behaviour with 1.4.0 (OSX 64 bit), 1.5.1 and today's nightly (linux 32 bit)

            Assignee:
            mathias@mongodb.com Mathias Stearn
            Reporter:
            howthebodyworks dan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: