Running db.fsyncUnlock () after db.fsyncLock () on mongo tool stuck process

I have connected to a mongodb instance using

mongo admin -u <user> -p <pass> --port <port>

      

And then run the following commands.

rs0:SECONDARY> db.fsyncLock()
{
  "info" : "now locked against writes, use db.fsyncUnlock() to unlock",
  "seeAlso" : "http://dochub.mongodb.org/core/fsynccommand",
  "ok" : 1
}
rs0:SECONDARY> db.fsyncUnlock()

      

The unlock command persists for a long time. If I press CTRL-C I get the following traceback withAssertion failure isABSONObj() src/mongo/bson/bson-inl.h 1831

2015-05-13T10:08:55.455+0000 Assertion failure isABSONObj() src/mongo/bson/bson-inl.h 183
2015-05-13T10:08:55.458+0000 0x868a51 0x816b59 0x7f9cce 0x7e06be 0x61b2e0 0x7fbcb07fec60 0x7fbcb159eab9 0x8266f2 0x826729 0x826775 0x81edfc 0x81fcc6 0x8202b1 0x66d8e5 0x699f9a 0x66359a 0x680574 0x7c4743 0x7a71f9 0x7197bb52579 
mongo(_ZN5mongo15printStackTraceERSo+0x21) [0x868a51]
mongo(_ZN5mongo10logContextEPKc+0x159) [0x816b59]
mongo(_ZN5mongo12verifyFailedEPKcS1_j+0x17e) [0x7f9cce]
mongo(_ZNK5mongo11shell_utils18ConnectionRegistry30killOperationsOnAllConnectionsEb+0x45e) [0x7e06be]
mongo(_Z10quitNicelyi+0x40) [0x61b2e0] /lib64/libc.so.6(+0x33c60) [0x7fbcb07fec60]
/lib64/libpthread.so.0(recv+0x79) [0x7fbcb159eab9]
mongo(_ZN5mongo6Socket5_recvEPci+0x22) [0x8266f2]
mongo(_ZN5mongo6Socket11unsafe_recvEPci+0x9) [0x826729]
mongo(_ZN5mongo6Socket4recvEPci+0x35) [0x826775]
mongo(_ZN5mongo13MessagingPort4recvERNS_7MessageE+0x9c) [0x81edfc]
mongo(_ZN5mongo13MessagingPort4recvERKNS_7MessageERS1_+0x36) [0x81fcc6]
mongo(_ZN5mongo13MessagingPort4callERNS_7MessageES2_+0x31) [0x8202b1]
mongo(_ZN5mongo18DBClientConnection4callERNS_7MessageES2_bPSs+0x55) [0x66d8e5]
mongo(_ZN5mongo14DBClientCursor4initEv+0xba) [0x699f9a]
mongo(_ZN5mongo12DBClientBase5queryERKSsNS_5QueryEiiPKNS_7BSONObjEii+0xea) [0x66359a]
mongo(_ZN5mongo18DBClientConnection5queryERKSsNS_5QueryEiiPKNS_7BSONObjEii+0xa4) [0x680574]
mongo(_ZN5mongo9mongoFindEPNS_7V8ScopeERKN2v89ArgumentsE+0x3d3) [0x7c4743]
mongo(_ZN5mongo7V8Scope10v8CallbackERKN2v89ArgumentsE+0x89) [0x7a71f9][0x7197bb52579]

      

When I login again and run the following function to check if the lock is being held:

serverIsLocked = function () {
                 var co = db.currentOp();
                 if (co && co.fsyncLock) {
                     return true;
                 }
                 return false;
             }

      

I get:

rs0:SECONDARY> serverIsLocked()
true
rs0:SECONDARY> db.fsyncUnlock()

      

and db.fsyncUnlock () got stuck again. Not sure what's going on and how to unlock the DB. The documentation for fsync

has the following:

WARNING When calling fsync with a blocking, make sure the connection remains open to allow subsequent calls to db.fsyncUnlock ().

Closing the connection can make it difficult to release the lock.

At first I tried to block and unblock using --eval

. Could this be a problem? How can you unblock db now?

mongo admin --eval "printjson(db.fsyncLock())"
mongo admin --eval "printjson(db.fsyncUnlock())"

      

This is all part of the mongodump script I am writing.

UPDATE: I am following this post while creating the script: http://www.codeproject.com/Tips/547759/Automating-backup-for-MongoDB-using-CRON-and-S-CMD

UPDATE2: It looks like post version 2.2 mongodump

shouldn't be used with wit db.fsyncLock()

. I will remove this from my script and add a flag --oplog

to mongodump

. However, I still need to figure out how to unlock my DB.

+3


source to share





All Articles