The pidfile appears to be written even in the case where the database can't be started due to lockfile being locked.
E.g:
$ mongod --quiet --dbpath=./backend/scripts/../dev/db --logappend --logpath=db.log --pidfilepath=db.pid --fork
forked process: 94444
$ cat db.pid
94444
$ mongod --quiet --dbpath=./backend/scripts/../dev/db --logappend --logpath=db.log --pidfilepath=db.pid --fork
forked process: 94445
$ cat db.pid
94445
$ ps aux | grep mongo
benno 94444 0.3 0.1 2709580 12572 ?? S 6:09pm 0:00.71 mongod....
I think it would be better if in the case where the lockfile can't be obtained the PID file isn't updated. (i.e: the PID file should be protected by the lockfile).
- is duplicated by
-
SERVER-14338 mongod/s should refuse to overwrite pidfiles belonging to a running process
- Closed
- is related to
-
SERVER-67401 Remove unused parameter in initialize_server_global_state::writePidFile
- Closed