[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 Created: 06/Jul/10  Updated: 06/Dec/22  Resolved: 26/Oct/21

Status: Closed
Project: Core Server
Component/s: Usability
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
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Justin Dearing Assignee: Backlog - Storage Execution Team
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows NT


Assigned Teams:
Storage Execution
Participants:

 Description   

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.


Generated at Thu Feb 08 02:56:49 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.