[SERVER-12048] Calling "service mongod start" with mongod running prevents "service mongod stop" from working Created: 11/Dec/13 Updated: 07/Apr/23 Resolved: 25/Aug/16 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Packaging |
| Affects Version/s: | 2.5.5 |
| Fix Version/s: | 3.0.13, 3.2.10, 3.3.12 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Ernie Hershey | Assignee: | Brian Samek |
| Resolution: | Done | Votes: | 2 |
| Labels: | code-only | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Tested in centos 6 |
||
| Issue Links: |
|
||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||
| Operating System: | Linux | ||||||||||||||||
| Backport Completed: | |||||||||||||||||
| Steps To Reproduce: |
|
||||||||||||||||
| Sprint: | Build 17 (07/15/16), Build 18 (08/05/16), Build 2016-08-26 | ||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
Running the init script to start the server while it's already running prevents stopping the server with the init script from working. I could not reproduce this with server 2.4.8 |
| Comments |
| Comment by Githook User [ 29/Aug/16 ] |
|
Author: {u'username': u'bsamek', u'name': u'Brian Samek', u'email': u'brian.samek@mongodb.com'}Message: |
| Comment by Githook User [ 29/Aug/16 ] |
|
Author: {u'username': u'bsamek', u'name': u'Brian Samek', u'email': u'brian.samek@mongodb.com'}Message: |
| Comment by Githook User [ 25/Aug/16 ] |
|
Author: {u'username': u'bsamek', u'name': u'Brian Samek', u'email': u'brian.samek@mongodb.com'}Message: |
| Comment by jonathanv [ 10/Oct/15 ] |
|
FWIW, I am experiencing the same thing on ubuntu 12, however this happens on the first run of `service mongod start`. it looks like process id that ran `service mongod start` is written to /var/run , but the actual process id of the mongod seems to be 2 numbers higher. this wasn't on a fresh install. i upgraded from 2.x. but it looks like all my init/config scripts were correctly cleared out and replaced. |
| Comment by Ryan Nitz [ 11/Feb/14 ] |
|
I can reproduce this with 2.4.9. To fix, check for the lock file first on start (in the init script). If the lock file is present then error out to the user saying that it is already running. If the server is not running, but there is a lock file, they will have to manually remove the file before restarting. When you start the server (again) mongod stomps on the pid file which causes the problem shutting down the server. If you are stuck with this, and do not want to restart your server, add the pid of the mongod process to whatever you configured the pid file to be (pidfilepath). Another potential problem is that the script uses killproc. If you are running multiple mongod processes on the same box, this could kill the wrong process. As a hack, I did something like the following in chef to avoid collision (and changed the mongod-test init script to use the binary of /usr/bin/dbtest/mongod):
http://www.met.reading.ac.uk/it/cgi-bin/man.cgi?section=8&topic=killproc |