안녕하세요. 주디아줌마입니다.
mongod에 아래와 같이 dumplog가 남았다면? 어느 위치에서 오류가 나는지 학인 할 필요가 있다. (참고, mongodb visual studio 2010 ). 스택 정보가 보인다. 정확한 소스 위치를 알고 싶어할 것이다.
아래와 같이 남기는 방식이 objdump un-mangle names of C++ template 이거던데, 정확히는 모름 ㅠㅠ
/usr/bin/mongod(_ZN5mongo12sayDbContextEPKc+0x96) [0x57a8a6]
/usr/bin/mongod(_ZN5mongo8assertedEPKcS1_j+0xfb) [0x5853eb]
/usr/bin/mongod(_ZNK5mongo5KeyV18dataSizeEv+0x12c) [0x75150c]
/usr/bin/mongod(_ZN5mongo12BucketBasicsINS_12BtreeData_V1EE16_packReadyForModERKNS_8OrderingERi+0xdd) [0x78fdad]
/usr/bin/mongod(_ZNK5mongo12BucketBasicsINS_12BtreeData_V1EE11basicInsertENS_7DiskLocERiS3_RKNS_5KeyV1ERKNS_8OrderingE+0x1f6) [0x790286]
/usr/bin/mongod(_ZNK5mongo11BtreeBucketINS_12BtreeData_V1EE10insertHereENS_7DiskLocEiS3_RKNS_5KeyV1ERKNS_8OrderingES3_S3_RNS_12IndexDetailsE+0x68) [0x792968]
/usr/bin/mongod(_ZNK5mongo11BtreeBucketINS_12BtreeData_V1EE7_insertENS_7DiskLocES3_RKNS_5KeyV1ERKNS_8OrderingEbS3_S3_RNS_12IndexDetailsE+0x2e5) [0x793f35]
/usr/bin/mongod(_ZNK5mongo11BtreeBucketINS_12BtreeData_V1EE9bt_insertENS_7DiskLocES3_RKNS_7BSONObjERKNS_8OrderingEbRNS_12IndexDetailsEb+0x10b) [0x79425b]
/usr/bin/mongod(_ZNK5mongo18IndexInterfaceImplINS_12BtreeData_V1EE9bt_insertENS_7DiskLocES3_RKNS_7BSONObjERKNS_8OrderingEbRNS_12IndexDetailsEb+0xcd) [0x90d03d]
/usr/bin/mongod() [0x8aedc6]
/usr/bin/mongod(_ZN5mongo11DataFileMgr6insertEPKcPKvibbPb+0x7f1) [0x8b4781]
/usr/bin/mongod(_ZN5mongo11DataFileMgr16insertWithObjModEPKcRNS_7BSONObjEb+0x4b) [0x8b5b3b]
/usr/bin/mongod(_ZN5mongo14checkAndInsertEPKcRNS_7BSONObjE+0xa8) [0x887f88]
/usr/bin/mongod(_ZN5mongo14receivedInsertERNS_7MessageERNS_5CurOpE+0x439) [0x88c649]
/usr/bin/mongod(_ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE+0x11c5) [0x88e945]
/usr/bin/mongod(_ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE+0x78) [0xaa0bc8]
/usr/bin/mongod(_ZN5mongo3pms9threadRunEPNS_13MessagingPortE+0x287) [0x6389f7]
CentOS의 c++filt를 설치하고 위의 덤프쪽 괄호 안의 문자열들을 copy하여 c++filt를 통하여 위치 정보를 확인해 보자. 괄호안의 문자열들로 텍스트 정보를 정리하고 붙여 넣어서 실행한다.
c++filt 참고
http://devanix.tistory.com/192
http://jh4hj.tistory.com/337
c++ 컴파일러는 단 하나의 이름을 갖는 심볼이 되도록 name mangling이라는 과정을 수행한다.
[~~]$ c++filt
_ZN5mongo12sayDbContextEPKc+0x96
mongo::sayDbContext(char const*)+0x96
_ZN5mongo8assertedEPKcS1_j+0xfb
mongo::asserted(char const*, char const*, unsigned int)+0xfb
_ZNK5mongo5KeyV18dataSizeEv+0x12c
mongo::KeyV1::dataSize() const+0x12c
_ZN5mongo12BucketBasicsINS_12BtreeData_V1EE16_packReadyForModERKNS_8OrderingERi+0xdd
mongo::BucketBasics::_packReadyForMod(mongo::Ordering const&, int&)+0xdd
_ZNK5mongo12BucketBasicsINS_12BtreeData_V1EE11basicInsertENS_7DiskLocERiS3_RKNS_5KeyV1ERKNS_8OrderingE+0x1f6
mongo::BucketBasics::basicInsert(mongo::DiskLoc, int&, mongo::DiskLoc, mongo::KeyV1 const&, mongo::Ordering const&) const+0x1f6
_ZNK5mongo11BtreeBucketINS_12BtreeData_V1EE10insertHereENS_7DiskLocEiS3_RKNS_5KeyV1ERKNS_8OrderingES3_S3_RNS_12IndexDetailsE+0x68
mongo::BtreeBucket::insertHere(mongo::DiskLoc, int, mongo::DiskLoc, mongo::KeyV1 const&, mongo::Ordering const&, mongo::DiskLoc, mongo::DiskLoc, mongo::IndexDetails&) const+0x68
_ZNK5mongo11BtreeBucketINS_12BtreeData_V1EE7_insertENS_7DiskLocES3_RKNS_5KeyV1ERKNS_8OrderingEbS3_S3_RNS_12IndexDetailsE+0x2e5
mongo::BtreeBucket::_insert(mongo::DiskLoc, mongo::DiskLoc, mongo::KeyV1 const&, mongo::Ordering const&, bool, mongo::DiskLoc, mongo::DiskLoc, mongo::IndexDetails&) const+0x2e5
_ZNK5mongo11BtreeBucketINS_12BtreeData_V1EE9bt_insertENS_7DiskLocES3_RKNS_7BSONObjERKNS_8OrderingEbRNS_12IndexDetailsEb+0x10b
mongo::BtreeBucket::bt_insert(mongo::DiskLoc, mongo::DiskLoc, mongo::BSONObj const&, mongo::Ordering const&, bool, mongo::IndexDetails&, bool) const+0x10b
_ZNK5mongo18IndexInterfaceImplINS_12BtreeData_V1EE9bt_insertENS_7DiskLocES3_RKNS_7BSONObjERKNS_8OrderingEbRNS_12IndexDetailsEb+0xcd
mongo::IndexInterfaceImpl::bt_insert(mongo::DiskLoc, mongo::DiskLoc, mongo::BSONObj const&, mongo::Ordering const&, bool, mongo::IndexDetails&, bool) const+0xcd
_ZN5mongo11DataFileMgr6insertEPKcPKvibbPb+0x7f1
mongo::DataFileMgr::insert(char const*, void const*, int, bool, bool, bool*)+0x7f1
_ZN5mongo11DataFileMgr16insertWithObjModEPKcRNS_7BSONObjEb+0x4b
mongo::DataFileMgr::insertWithObjMod(char const*, mongo::BSONObj&, bool)+0x4b
_ZN5mongo14checkAndInsertEPKcRNS_7BSONObjE+0xa8
mongo::checkAndInsert(char const*, mongo::BSONObj&)+0xa8
_ZN5mongo14receivedInsertERNS_7MessageERNS_5CurOpE+0x439
mongo::receivedInsert(mongo::Message&, mongo::CurOp&)+0x439
_ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE+0x11c5
_ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE+0x78
mongo::assembleResponse(mongo::Message&, mongo::DbResponse&, mongo::HostAndPort const&)+0x11c5
mongo::MyMessageHandler::process(mongo::Message&, mongo::AbstractMessagingPort*, mongo::LastError*)+0x78
_ZN5mongo3pms9threadRunEPNS_13MessagingPortE+0x287
mongo::pms::threadRun(mongo::MessagingPort*)+0x287
25line Key1 datasize를 가져오면서 문제가 있어보이네요. key 문제이니~ 해결방법은 Reindex하는게 최선책일 듯합니다.
/** version when write intent already declared */
template< class V >
void BucketBasics::_packReadyForMod( const Ordering &order, int &refPos ) {
assertWritable();
if ( this->flags & Packed )
return;
int tdz = totalDataSize();
char temp[V::BucketSize];
int ofs = tdz;
this->topSize = 0;
int i = 0;
for ( int j = 0; j < this->n; j++ ) {
if( mayDropKey( j, refPos ) ) {
continue; // key is unused and has no children - drop it
}
if( i != j ) {
if ( refPos == j ) {
refPos = i; // i < j so j will never be refPos again
}
k( i ) = k( j );
}
short ofsold = k(i).keyDataOfs();
int sz = keyNode(i).key.dataSize();
ofs -= sz;
this->topSize += sz;
memcpy(temp+ofs, dataAt(ofsold), sz);
k(i).setKeyDataOfsSavingUse( ofs );
++i;
}
if ( refPos == this->n ) {
refPos = i;
}
this->n = i;
int dataUsed = tdz - ofs;
memcpy(this->data + ofs, temp + ofs, dataUsed);
// assertWritable();
// TEMP TEST getDur().declareWriteIntent(this, sizeof(*this));
this->emptySize = tdz - dataUsed - this->n * sizeof(_KeyNode);
{
int foo = this->emptySize;
verify( foo >= 0 );
}
setPacked();
assertValid( order );
}