[SERVER-966] Mongo Server does not close stdin/stdout/stderr when using --fork Created: 05/Apr/10  Updated: 12/Jul/16  Resolved: 27/Apr/10

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 1.4.0
Fix Version/s: 1.5.1

Type: Bug Priority: Major - P3
Reporter: Jeremy Hinegardner Assignee: Mathias Stearn
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

CentOS 5.4


Attachments: File 0001-Example-change-to-daemonization-which-appears-to-wor.patch    
Issue Links:
Related
is related to SERVER-9239 Mongo Server does not close stdout wh... Closed
Participants:

 Description   

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



 Comments   
Comment by auto [ 27/Apr/10 ]

Author:

{'login': 'RedBeard0531', 'name': 'Mathias Stearn', 'email': 'mathias@10gen.com'}

Message: double forking + close stdin and stderr SERVER-966
http://github.com/mongodb/mongo/commit/c6cfe9fc00fd94b5098f4ab0b7cf7c130c03c324

Generated at Thu Feb 08 02:55:40 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.