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

pidfile appears to be overwritten even when lock can not be obtained

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 6.1.0-rc0
    • Affects Version/s: 2.2.0, 2.4.3, 2.6.4
    • Component/s: Admin
    • Labels:
      None
    • Fully Compatible
    • ALL
    • Execution Team 2022-06-13

      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).

            Assignee:
            gregory.noma@mongodb.com Gregory Noma
            Reporter:
            bennoleslie Benno Leslie
            Votes:
            2 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: