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

When installing MongoDB as a Windows service, the --config argument is not quoted correctly if there are spaces in the path name

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 2.0.3
    • Component/s: None
    • Environment:
      Windows 7 Pro, SP1
    • Windows

      When installing MongoDB as a Windows Service, if the mongod.conf file is located in a path with spaces the service will not start correctly. Inspecting the ImagePath in the registry reveals that the --config path is not quoted correctly.

      Steps to repro
      1) Install MongoDB as a service using the following command
      > mongod.exe --config "c:\Program Files\mongo\mongod.conf" --install
      The service will install successfully.

      2) Attempt the start the MongoDB service using net start
      > net start "Mongo DB"
      You'll receive "The service is not responding to the control function". Errors in System log from the Service Control Manager include "A timeout was reached (30000 milliseconds) while waiting for the Mongo DB service to connect" and "The Mongo DB service failed to start due to the following error: The service did not respond to the start or control request in a timely fashion."

      Inspecting the ImagePath key in the registry at HKLM/System/CurrentControlSet/services/MongoDB/ImagePath reveals the following value:
      "c:\mongo\bin\mongod.exe" --config c:\program files\mongo\mongod.conf --service

      Note that the --config value is NOT quoted even though it was quoted on the command line when the service was installed.

      The work around for this issue to simply to install the config file in a path without spaces, such as "c:\mongo\mongod.conf".

            Assignee:
            tad Tad Marshall
            Reporter:
            jeremyjarrell Jeremy Jarrell
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: