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

Mongo Server does not close stdin/stdout/stderr when using --fork

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.5.1
    • Affects Version/s: 1.4.0
    • Component/s: None
    • None
    • Environment:
      CentOS 5.4

      The mongod server does not daemonize correctly. When using --fork it only fork's once and sets the session id. It really needs to fork an additional time and also close stdin/stdout/stderr.

      This is causing an issue for us when we do our backups of mongodb. Our process is:

      1) ssh root@hostname "/etc/init.d/mongod stop"
      2) rsync the db directory
      3) ssh root@hostname "/etc/iint.d/mongod start"

      This can also be replicated without using an init script by running a command like:

      ssh root@hostname "/usr/bin/mongod --fork --logpath /var/log/mongo/mongod.log --dbpath /data/mongo/db"

      This will should return, but it does not. It hangs. I have verified that this can be fixed by having mongod close stdin/stdout/stderr if you use --fork.

      For reference http://www.svbug.com/documentation/comp.unix.programmer-FAQ/faq_2.html#SEC16

            Assignee:
            mathias@mongodb.com Mathias Stearn
            Reporter:
            jjh Jeremy Hinegardner
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: