[SERVER-5115] Service install with just a config file results in a service that cannot be started Created: 27/Feb/12  Updated: 06/Feb/23  Resolved: 06/Feb/23

Status: Closed
Project: Core Server
Component/s: Packaging
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Sridhar Nanjundeswaran Assignee: [DO NOT ASSIGN] Backlog - Server Development Platform Team (SDP) (Inactive)
Resolution: Won't Do Votes: 0
Labels: Windows, build-later, platforms-re-triaged, sdp-backlog-purge
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

MongoDB 2.0.2 and 2.1.0 on Windows 7 x64


Issue Links:
Depends
Related
related to SERVER-5211 Refactor CmdLine::store Closed
Assigned Teams:
Server Development Platform
Backwards Compatibility: Fully Compatible
Operating System: Windows
Participants:

 Description   

Create a simple config file

install = true
dbpath = c:\data\db
logpath = c:\data\db\mongod.log
logappend = true
port = 29000

If you run

c:\mongo\mongod.exe --config c:\data\mongod.conf

this will result in a windows service that is created but cannot be started from either the services panel or the command line using net start MongoDB.
When starting from the command line you get

The service is not responding to the control function.
More help is available by typing NET HELPMSG 2186.

When starting from the services panel you get

Windows could not start the Mongo DB service on Local Computer
Error 1053: The service did not respond to the start or control request in a timely fashion

The image path from the registry is

"c:\mongo\mongod.exe" --config  "C:\data\mongos.conf"  



 Comments   
Comment by Iryna Zhuravlova [ 16/Nov/22 ]

After a careful backlog refinement, the team decided to close this ticket because of its low priority and limited resource capacity. If you believe that this ticket requires additional attention from the team and should be re-opened, feel free to change the status to "Needs Scheduling" and ping me or @alexander.neben

Comment by Sridhar Nanjundeswaran [ 28/Feb/12 ]

Note: this is an issue for mongos service install also (as fixed in SERVER-1589)

Comment by Tad Marshall [ 28/Feb/12 ]

Documentation of the service-related options (those listed by --help as well as the "hidden" --service option that tells us to talk to the Windows Service Control Manager) should note that these options should be used on the command line to set up the service and should not be set in the config file ... once we fix this, it will be an error to specify a service-related option in the config file.

Comment by Tad Marshall [ 28/Feb/12 ]

We call CmdLine::store() after parsing some command line options but before parsing others, and after we've called this function everything set in the config file is available to us in the 'params' object, which is very convenient. A little too convenient in this case ... we need a flag like params["install"].source that returns sourceCmdLine or sourceConfigFile (or something like it) that can tell using code where the option came from. Armed with that, we can give serviceParamsCheck() (in ntservice.cpp) the ability to error out if options are set in the wrong place.

Comment by Scott Hernandez (Inactive) [ 28/Feb/12 ]

Tad, there is a filter already to catch invalid options like this (but not really) before it is parsed you can probably hook into. It might not be the most elegant solution now that I think about it.

Comment by Tad Marshall [ 27/Feb/12 ]

Interesting. The assumption we've been operating on is that things on the command line can be replaced by things in a config file, but this falls apart for one-time activities like installing the Windows service. You really don't want ANY of the service-related options to go into a config file and they should be ignored or considered errors if they are found there, but I'm not sure whether boost::program_options has support for that. Nice catch!

Comment by Sridhar Nanjundeswaran [ 27/Feb/12 ]

If the install = true setting is pulled from the config file to the command line it works

c:\mongo\mongod.exe --config c:\data\mongod.conf

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