Child process failure sometimes by --fork, unable to understand the reason

I used the lab config file as it is and got below error, Unable to understand the reason for this behaviour.
I have observed this before as well.

bash-4.4# mongod --config “/root/workspace/mongod.conf”


about to fork child process, waiting until server is ready for connections.
forked process: 401
ERROR: child process failed, exited with error number 48
To see additional information in this output, start without the “–fork” option.


I removed the forking option from the lab config file “processManagement: fork: true”
and again ran mongod from this config file, i got no error and no o/p as below :


bash-4.4# mongod --config “/root/workspace/mongod.conf”
bash-4.4#


I checked the mongod process running in background and killed it.


bash-4.4# ps -ef | grep mongo
222 root 0:05 mongod --port 27000 --dbpath /var/mongodb/db --auth --logpath /var/mongodb/logs/mongod.log --logappend --fork
408 root 0:00 grep mongo
bash-4.4# kill 222


I then pasted the “processManagement: fork: true” in the config yaml file which i removed earlier and than ran mongod
with this config file and this time chile process created successfully.


bash-4.4# mongod --config “/root/workspace/mongod.conf”
about to fork child process, waiting until server is ready for connections.
forked process: 411
child process started successfully, parent exiting


Sidecomment
mongod --config mongod.conf should suffice.


The first time you tried, it should log something to the logfile, I believe. Is there anything there?

Hi @Niket_Agrawal,

Can you take a look at the log file and see what’s the issue or you can even share it with us ?

~ Shubham

Hi @Niket_Agrawal,

Yes, you’re right! It throws an error and doesn’t fork in the command line (with Lab IDE) when used along with logpath. Please use the below configuration in the mongod.conf file and it will work like a charm: -

storage:
dbPath: /var/mongodb/db
processManagement:
fork: true
systemLog:
destination: file
path: /var/mongodb/logs/mongod.log
net:
bindIp: localhost
port: 27000
security:
authorization: enabled

Once it is done, do as mentioned in point number 2 in the problem statement i.e. adding a user.
Although the question suggests a hint: For help on forking the mongod process, please refer to the docs on Managing Mongod Processes, it is still confusing to a new user/learner and requires more clarity on what to actually do in this test (which is a time consuming task).

FYI… @yulia_genkina , @Shubham_Ranjan

Regards,
Santhosh John.

Hi @nimpossible,

Thanks for your feedback. We will look into it.

~ Shubham