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

Mongo keeps standard output open when --fork used

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • None
    • None
    • None
    • None
    • Solaris
    • ALL

    Description

      [from jfeibusc@ebay.com; john feibusch]

      When you start Mongo with the --fork option, it keeps a connection to the terminal. That means that if you have started Mongo from an ssh session, then ssh will not close normally.

      It would be nice if you could make it so that ssh will close normally after starting Mongo in the background.

      On Solaris, I had to do a double-fork to accomplish this - fork, close standard input,output, and error, then fork again. The middle process would then exit. I'm not sure if this is necessary on Linux.

      Here's a session log:

      [root@qa-nosql01 ~]# /opt/mongodb/bin/mongod --version
      db version v1.6.2, pdfile version 4.5
      Thu Dec 30 15:53:04 git version: aef371ecf5d2a824f16ccdc3b745f3702165602f

      [root@qa-nosql07 ~]# /opt/mongodb/bin/mongod --dbpath /data/db/config --replSet johnf --fork --logpath /data/db/log/mongo.log
      all output going to: /data/db/log/mongo.log
      forked process: 27523

      [root@qa-nosql07 ~]# ls -l /proc/27523/fd
      total 0
      l-wx------ 1 root root 64 Dec 30 15:30 0 -> /dev/null
      lrwx------ 1 root root 64 Dec 30 15:30 1 -> /dev/pts/0
      lrwx------ 1 root root 64 Dec 30 15:30 10 -> /data/db/config/local.3
      lr-x------ 1 root root 64 Dec 30 15:30 2 -> /dev/null
      lr-x------ 1 root root 64 Dec 30 15:30 3 -> /dev/urandom
      l-wx------ 1 root root 64 Dec 30 15:30 4 -> /data/db/log/mongo.log
      lrwx------ 1 root root 64 Dec 30 15:30 5 -> /data/db/config/mongod.lock
      lrwx------ 1 root root 64 Dec 30 15:30 6 -> /data/db/config/local.ns
      lrwx------ 1 root root 64 Dec 30 15:30 7 -> /data/db/config/local.0
      lrwx------ 1 root root 64 Dec 30 15:30 8 -> /data/db/config/local.1
      lrwx------ 1 root root 64 Dec 30 15:30 9 -> /data/db/config/local.2

      [root@qa-nosql07 ~]# tty
      /dev/pts/0

      Attachments

        Activity

          People

            Unassigned Unassigned
            roger Roger Bodamer (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: