当我在linux上运行pstack {pid}时,有时,我会显示?对于一些记录。这是什么原因?如果只是进行优化,我怎么知道真正相关的代码呢?
#0 0x00000037d620b3dc in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x00000000008c83db in boost::condition_variable::wait(boost::unique_lock<boost::mutex>&) ()
#2 0x0000000000d95f7b in mongo::SimpleRWLock::lock_shared() ()
#3 0x00000000008bce47 in mongo::Lock::DBRead::lockOther(mongo::StringData const&) ()
#4 0x00000000008bfc86 in mongo::Lock::DBRead::lockDB(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
#5 0x00000000008c1eb0 in mongo::Lock::DBRead::DBRead(mongo::StringData const&) ()
#6 0x000000000081fa35 in mongo::Client::ReadContext::ReadContext(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
**#7 0x0000000000b852bb in ?? ()**
#8 0x00000000008ab646 in mongo::CmdServerStatus::run(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mongo::BSONObj&, int, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, mongo::BSONObjBuilder&, bool) ()
答案 0 :(得分:0)
即使我不知道为什么只有1条记录显示“??”,但我找到了解决方案,知道“??”在这种情况下代表。
我在生产中得到了之前的堆栈。我在DEV env中运行流量(在DEV中,我用-ggdb选项编译并使用--nostrip安装),我得到了以下堆栈:
Thread 2 (Thread 0x7fb112c27700 (LWP 29881)):
#0 0x0000003af460b43c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x00000000008661cb in boost::condition_variable::wait(boost::unique_lock<boost::mutex>&) ()
#2 0x0000000000d093e3 in mongo::SimpleRWLock::lock_shared() ()
#3 0x00000000008e0cfb in mongo::Lock::DBRead::lockOther(mongo::StringData const&) ()
#4 0x00000000008e2701 in mongo::Lock::DBRead::lockDB(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
#5 0x00000000008e3557 in mongo::Lock::DBRead::DBRead(mongo::StringData const&) ()
#6 0x0000000000859d00 in mongo::Client::ReadContext::ReadContext(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>
, std::allocator<char> > const&) ()
#7 0x0000000000b5a6c0 in mongo::(anonymous namespace)::RecordStats::generateSection(mongo::BSONElement const&) const ()
#8 0x00000000008c4934 in mongo::CmdServerStatus::run(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mongo::BSONObj&, int, std::basic_string<char, std::char_tr
aits<char>, std::allocator<char> >&, mongo::BSONObjBuilder&, bool) ()
#9 0x00000000008ef0d4 in mongo::_execCommand(mongo::Command*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mongo::BSONObj&, int, std::basic_string<char, std
::char_traits<char>, std::allocator<char> >&, mongo::BSONObjBuilder&, bool) ()