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

Remove --service from the command line arguments in windows. Let the program auto-detect if it is running in the SCM or not

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Do
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 1.4.1, 1.4.2, 1.4.3, 1.4.4, 1.5.0, 1.5.1, 1.5.2, 1.5.3, 1.5.4
    • Component/s: Usability
    • Labels:
    • Environment:
      Windows NT
    • Storage Execution

      Currently Mongo has a switch --service that is supposed tgo be passed to it when it is run as an NT service. This is unnecessary and against best practice on windows.

      Currently --service causes StartServiceCtrlDispatcher() to be called in windows. However, as per the MSDN documentation for StartServiceCtrlDispatcher() if it is invoked from a console (cmd.exe) it returns ERROR_FAILED_SERVICE_CONTROLLER_CONNECT. As per http://msdn.microsoft.com/en-us/library/ms686324(VS.85).aspx:

      This error is returned if the program is being run as a console application rather than as a service. If the program will be run as a console application for debugging purposes, structure it such that service-specific code is not called when this error is returned.

      Therefore, StartServiceCtrlDispatcher() should always be called in main() in db.cpp, properly #ifdef'ed --service should be deprecated, doing nothing but emitting a message to log(). Also, this ticket should be linked to SERVER-733 because logging should be fixed as well.

            backlog-server-execution [DO NOT USE] Backlog - Storage Execution Team
            zippy1981 Justin Dearing
            0 Vote for this issue
            3 Start watching this issue