[SERVER-2160] Mongodb reports successful start even when it fails to start Created: 30/Nov/10  Updated: 19/May/14  Resolved: 01/Mar/11

Status: Closed
Project: Core Server
Component/s: Packaging
Affects Version/s: 1.6.2
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Andy Dawson Assignee: Richard Kreuter (Inactive)
Resolution: Won't Fix Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Arch linux 64bit


Operating System: Linux
Participants:

 Description   

When starting the daemon - there is no indication that the daemon fails to start except of course that you can't connect.

[11:00][andy@andy:~]$ sudo /etc/rc.d/mongodb start
:: Starting mongodb [DONE]
[11:00][andy@andy:~]$ mongo
MongoDB shell version: 1.6.2
connecting to: test
Tue Nov 30 11:00:28 Error: couldn't connect to server 127.0.0.1} (anon):1137
exception: connect failed
[11:00][andy@andy:~]$ more /var/log/mongod
Tue Nov 30 11:00:23 MongoDB starting : pid=4319 port=27017 dbpath=/var/state/mongodb 64-bit
Tue Nov 30 11:00:23 db version v1.6.2, pdfile version 4.5
Tue Nov 30 11:00:23 git version: nogitversion
Tue Nov 30 11:00:23 sys info: Linux andy 2.6.34-ARCH #1 SMP PREEMPT Mon Jul 5 22:12:11 CEST 2010 x86_64 BOOST_LIB_VERSION=1_43

                            • old lock file: /var/state/mongodb/mongod.lock. probably means unclean shutdown
                              recommend removing file and running --repair
                              see: http://dochub.mongodb.org/core/repair for more information
                              *************
                              Tue Nov 30 11:00:23 exception in initAndListen std::exception: old lock file, terminating
                              Tue Nov 30 11:00:23 dbexit:

Tue Nov 30 11:00:23 shutdown: going to close listening sockets...
Tue Nov 30 11:00:23 shutdown: going to flush oplog...
Tue Nov 30 11:00:23 shutdown: going to close sockets...
Tue Nov 30 11:00:23 shutdown: waiting for fs preallocator...
Tue Nov 30 11:00:23 shutdown: closing all files...
Tue Nov 30 11:00:23 closeAllFiles() finished

Tue Nov 30 11:00:23 dbexit: really exiting now

Obviously, if you're starting things manually you can immediately check the log to see the reason (in this case, a power cut). but it'd be a lot simpler to identify that something isn't right if the deamon script returned [FAIL] if it couldn't start.

I'm not sure if the rc.d script falls directly under the main project - therefore apologies in advance if this is the wrong bug tracker to use.



 Comments   
Comment by Richard Kreuter (Inactive) [ 01/Mar/11 ]

The Arch Linux script isn't maintained by 10gen anymore. Please have a look at http://bugs.archlinux.org if you'd like to follow up on this there.

Comment by Andy Dawson [ 13/Dec/10 ]

A simple workaround for arch linux, edit your startup script replacing

if [ $? -gt 0 ]; then

with

sleep 1;
if [ -z `pidof /usr/bin/mongod` ]; then

I.e. instead of checking the return value - check that mongo has after 1second still got a pid

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