Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDB - Assertion failure isOk() db/pdfile.h

Tags:

mongodb

I've used mongodb a few days, it has been working fine until today.

I got a error when querying a database.

Wed Nov  2 17:56:44 [initandlisten] connection accepted from 127.0.0.1:49234 #1
Wed Nov  2 17:56:45 [conn1] command admin.$cmd command: { listDatabases: 1 } ntoreturn:1 reslen:338 813ms
Wed Nov  2 17:56:46 [conn1]  admin.system.namespaces Assertion failure isOk() db/pdfile.h 300
0x10007d703 0x100087eec 0x1004165e4 0x10040774b 0x100410823 0x100437df9 0x1004b3006 0x100426693 0x100426b53 0x100429f45 0x10042d8f0 0x10043109e 0x10043353b 0x10043662a 0x1004a13ca 0x1003d5e0f 0x1003e298a 0x100603394 0x100148d8c 0x10060a554 
 0   mongod                              0x000000010007d703 _ZN5mongo12sayDbContextEPKc + 195
 1   mongod                              0x0000000100087eec _ZN5mongo8assertedEPKcS1_j + 300
 2   mongod                              0x00000001004165e4 _ZN5mongo11DataFileMgr9getExtentERKNS_7DiskLocE + 148
 3   mongod                              0x000000010040774b _ZN5mongo11DataFileMgr7findAllEPKcRKNS_7DiskLocE + 75
 4   mongod                              0x0000000100410823 _ZN5mongo13findTableScanEPKcRKNS_7BSONObjERKNS_7DiskLocE + 131
 5   mongod                              0x0000000100437df9 _ZNK5mongo9QueryPlan9newCursorERKNS_7DiskLocEi + 1081
 6   mongod                              0x00000001004b3006 _ZN5mongo11UserQueryOp5_initEv + 214
 7   mongod                              0x0000000100426693 _ZN5mongo7QueryOp4initEv + 323
 8   mongod                              0x0000000100426b53 _ZN5mongo12QueryPlanSet6Runner6initOpERNS_7QueryOpE + 35
 9   mongod                              0x0000000100429f45 _ZN5mongo12QueryPlanSet6Runner4initEv + 245
 10  mongod                              0x000000010042d8f0 _ZN5mongo12QueryPlanSet6Runner22runUntilFirstCompletesEv + 32
 11  mongod                              0x000000010043109e _ZN5mongo12QueryPlanSet5runOpERNS_7QueryOpE + 334
 12  mongod                              0x000000010043353b _ZN5mongo16MultiPlanScanner9runOpOnceERNS_7QueryOpE + 1115
 13  mongod                              0x000000010043662a _ZN5mongo16MultiPlanScanner5runOpERNS_7QueryOpE + 26
 14  mongod                              0x00000001004a13ca _ZN5mongo8runQueryERNS_7MessageERNS_12QueryMessageERNS_5CurOpES1_ + 3194
 15  mongod                              0x00000001003d5e0f _ZN5mongo13receivedQueryERNS_6ClientERNS_10DbResponseERNS_7MessageE + 623
 16  mongod                              0x00000001003e298a _ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE + 1402
 17  mongod                              0x0000000100603394 _ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE + 148
 18  mongod                              0x0000000100148d8c _ZN5mongo3pms9threadRunEPNS_13MessagingPortE + 700
 19  mongod                              0x000000010060a554 thread_proxy + 132
Wed Nov  2 17:56:46 [conn1] assertion 0 assertion db/pdfile.h:300 ns:admin.system.namespaces query:{}
Wed Nov  2 17:56:51 [conn1] end connection 127.0.0.1:49234

I restart the mongod process but no help.

I tried to repair the db but also got the error.

bin: $ ./mongod --repair --dbpath  ../data/db 
Wed Nov  2 18:10:51 [initandlisten] MongoDB starting : pid=678 port=27017 dbpath=../data/db 64-bit host=KTs-MacBook-Pro.local
Wed Nov  2 18:10:51 [initandlisten] db version v2.0.0, pdfile version 4.5
Wed Nov  2 18:10:51 [initandlisten] git version: 695c67dff0ffc361b8568a13366f027caa406222
Wed Nov  2 18:10:51 [initandlisten] build info: Darwin erh2.10gen.cc 9.6.0 Darwin Kernel Version 9.6.0: Mon Nov 24 17:37:00 PST 2008; root:xnu-1228.9.59~1/RELEASE_I386 i386 BOOST_LIB_VERSION=1_40
Wed Nov  2 18:10:51 [initandlisten] options: { dbpath: "../data/db", repair: true }
Wed Nov  2 18:10:51 [initandlisten] journal dir=../data/db/journal
Wed Nov  2 18:10:51 [initandlisten] recover : no journal files present, no recovery needed
Wed Nov  2 18:10:51 [initandlisten] ****
Wed Nov  2 18:10:51 [initandlisten] ****
Wed Nov  2 18:10:51 [initandlisten] need to upgrade database admin with pdfile version 4.5, new version: 4.5
Wed Nov  2 18:10:51 [initandlisten]      starting upgrade
Wed Nov  2 18:10:51 [initandlisten]  admin repairDatabase admin
Wed Nov  2 18:10:51 [initandlisten] removeJournalFiles
Wed Nov  2 18:10:51 [initandlisten]  admin.system.namespaces Assertion failure isOk() db/pdfile.h 300
0x10007d703 0x100087eec 0x1004165e4 0x10040774b 0x100410823 0x100437df9 0x1004b3006 0x100426693 0x100426b53 0x100429f45 0x10042d8f0 0x10043109e 0x10043353b 0x10043662a 0x1004a13ca 0x1003d5e0f 0x1003e298a 0x1003e480f 0x1000ed8ec 0x1000c8b73 
 0   mongod                              0x000000010007d703 _ZN5mongo12sayDbContextEPKc + 195
 1   mongod                              0x0000000100087eec _ZN5mongo8assertedEPKcS1_j + 300
 2   mongod                              0x00000001004165e4 _ZN5mongo11DataFileMgr9getExtentERKNS_7DiskLocE + 148
 3   mongod                              0x000000010040774b _ZN5mongo11DataFileMgr7findAllEPKcRKNS_7DiskLocE + 75
 4   mongod                              0x0000000100410823 _ZN5mongo13findTableScanEPKcRKNS_7BSONObjERKNS_7DiskLocE + 131
 5   mongod                              0x0000000100437df9 _ZNK5mongo9QueryPlan9newCursorERKNS_7DiskLocEi + 1081
 6   mongod                              0x00000001004b3006 _ZN5mongo11UserQueryOp5_initEv + 214
 7   mongod                              0x0000000100426693 _ZN5mongo7QueryOp4initEv + 323
 8   mongod                              0x0000000100426b53 _ZN5mongo12QueryPlanSet6Runner6initOpERNS_7QueryOpE + 35
 9   mongod                              0x0000000100429f45 _ZN5mongo12QueryPlanSet6Runner4initEv + 245
 10  mongod                              0x000000010042d8f0 _ZN5mongo12QueryPlanSet6Runner22runUntilFirstCompletesEv + 32
 11  mongod                              0x000000010043109e _ZN5mongo12QueryPlanSet5runOpERNS_7QueryOpE + 334
 12  mongod                              0x000000010043353b _ZN5mongo16MultiPlanScanner9runOpOnceERNS_7QueryOpE + 1115
 13  mongod                              0x000000010043662a _ZN5mongo16MultiPlanScanner5runOpERNS_7QueryOpE + 26
 14  mongod                              0x00000001004a13ca _ZN5mongo8runQueryERNS_7MessageERNS_12QueryMessageERNS_5CurOpES1_ + 3194
 15  mongod                              0x00000001003d5e0f _ZN5mongo13receivedQueryERNS_6ClientERNS_10DbResponseERNS_7MessageE + 623
 16  mongod                              0x00000001003e298a _ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE + 1402
 17  mongod                              0x00000001003e480f _ZN5mongo14DBDirectClient4callERNS_7MessageES2_bPSs + 111
 18  mongod                              0x00000001000ed8ec _ZN5mongo14DBClientCursor4initEv + 76
 19  mongod                              0x00000001000c8b73 _ZN5mongo12DBClientBase5queryERKSsNS_5QueryEiiPKNS_7BSONObjEii + 739
Wed Nov  2 18:10:51 [initandlisten] assertion 0 assertion db/pdfile.h:300 ns:admin.system.namespaces query:{}
Wed Nov  2 18:10:51 [initandlisten]  admin clone failed for admin with error: query failed admin.system.namespaces
Wed Nov  2 18:10:51 [initandlisten] removeJournalFiles
Wed Nov  2 18:10:51 [initandlisten]  admin Assertion failure doDBUpgrade( dbName , errmsg , h ) db/db.cpp 298
0x10007d703 0x100087eec 0x1005f4f2f 0x1005f5c3c 0x1005f6274 0x1005f7d6f 0x1000013c4 
 0   mongod                              0x000000010007d703 _ZN5mongo12sayDbContextEPKc + 195
 1   mongod                              0x0000000100087eec _ZN5mongo8assertedEPKcS1_j + 300
 2   mongod                              0x00000001005f4f2f _ZN5mongo30repairDatabasesAndCheckVersionEv + 2063
 3   mongod                              0x00000001005f5c3c _ZN5mongo14_initAndListenEi + 1036
 4   mongod                              0x00000001005f6274 _ZN5mongo13initAndListenEi + 36
 5   mongod                              0x00000001005f7d6f main + 3647
 6   mongod                              0x00000001000013c4 start + 52
Wed Nov  2 18:10:51 [initandlisten] exception in initAndListen: 0 assertion db/db.cpp:298, terminating
Wed Nov  2 18:10:51 dbexit: 
Wed Nov  2 18:10:51 [initandlisten] shutdown: going to close listening sockets...
Wed Nov  2 18:10:51 [initandlisten] shutdown: going to flush diaglog...
Wed Nov  2 18:10:51 [initandlisten] shutdown: going to close sockets...
Wed Nov  2 18:10:51 [initandlisten] shutdown: waiting for fs preallocator...
Wed Nov  2 18:10:51 [initandlisten] shutdown: lock for final commit...
Wed Nov  2 18:10:51 [initandlisten] shutdown: final commit...
Wed Nov  2 18:10:51 [initandlisten] shutdown: closing all files...
Wed Nov  2 18:10:51 [initandlisten] closeAllFiles() finished
Wed Nov  2 18:10:51 [initandlisten] journalCleanup...
Wed Nov  2 18:10:51 [initandlisten] removeJournalFiles
Wed Nov  2 18:10:51 [initandlisten] shutdown: removing fs lock...
Wed Nov  2 18:10:51 dbexit: really exiting now

The mongodb version is v2.0.0, pdfile version is 4.5, git version is 695c67dff0ffc361b8568a13366f027caa406222.

There are 5 databases in the mongodb, but only one database to be wrong.

I also tried to recover data by mongodump, but got empty bson files.

Any ideas? Thanks

like image 349
kliu Avatar asked Nov 04 '22 11:11

kliu


1 Answers

I was able to resolve this issue by going to my data directory (which in the example above would be

/data/db

and deleting all the jicd.x and local.x files

If the lock file is not 0 bytes in size you may want to delete that one as well.

like image 70
user2197116 Avatar answered Nov 09 '22 12:11

user2197116