Bug #1980
Updated by Junxiao Shi about 10 years ago
ndn-cxx library uses some inline functions and does not guarantee ABI compatibility. Whenever ndn-cxx is upgraded, pre-compiled header in NFD object files must be cleaned cleared and re-compiled. However, NFD `wscript` fails to detect a change in ndn-cxx, causing memory access errors or other crashes such as the one in original bug report. To solve this bug, apply either of the following: * ensure waf PCH can detect a change of in ndn-cxx version * include `./waf clean` in the build instructions disable PCH by default --- Original bug report: ``` davide@ndnbox:~/NFD$ git describe NFD-0.2.0-8-ge93d6a3 davide@ndnbox:~/NFD$ ./build/bin/nfd --config build/nfd.conf.sample 1410440407.607446 INFO: [StrategyChoice] Set default strategy /localhost/nfd/strategy/best-route/%FD%02 1410440407.607831 INFO: [StrategyChoiceEntry] Set strategy /localhost/nfd/strategy/best-route/%FD%02 for / prefix 1410440407.608331 INFO: [InternalFace] registering callback for /localhost/nfd/fib 1410440407.608532 INFO: [InternalFace] registering callback for /localhost/nfd/faces 1410440407.608786 INFO: [InternalFace] registering callback for /localhost/nfd/strategy-choice 1410440407.609208 INFO: [InternalFace] registering callback for /localhost/nfd/status 1410440407.609545 INFO: [FaceTable] Added face id=1 remote=internal:// local=internal:// Segmentation fault (core dumped) (gdb) bt #0 0x000000000052ef21 in atomic_exchange_and_add (dv=-1, pw=0x359) at /usr/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp:50 #1 release (this=0x351) at /usr/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp:144 #2 ~shared_count (this=<optimized out>, __in_chrg=<optimized out>) at /usr/include/boost/smart_ptr/detail/shared_count.hpp:371 #3 ~shared_ptr (this=<optimized out>, __in_chrg=<optimized out>) at /usr/include/boost/smart_ptr/shared_ptr.hpp:328 #4 operator= (r=..., this=0x87b310) at /usr/include/boost/smart_ptr/shared_ptr.hpp:507 #5 operator= (this=0x87b310) at ../src/security/../encoding/block.hpp:46 #6 operator= (this=0x87b300) at ../src/security/../name.hpp:39 #7 ndn::IdentityCertificate::setPublicKeyName (this=this@entry=0x87ae50) at ../src/security/identity-certificate.cpp:64 #8 0x0000000000570f7e in wireDecode (wire=..., this=0x87ae50) at ../src/security/identity-certificate.hpp:115 #9 ndn::SecPublicInfoSqlite3::getCertificate (this=<optimized out>, certificateName=...) at ../src/security/sec-public-info-sqlite3.cpp:534 #10 0x0000000000533c91 in ndn::SecPublicInfo::refreshDefaultCertificate (this=0x854c00) at ../src/security/sec-public-info.hpp:536 #11 0x000000000053276b in ndn::KeyChain::setDefaultCertificateInternal (this=this@entry=0x7fffffffdd40) at ../src/security/key-chain.cpp:454 #12 0x00000000004bf143 in ndn::KeyChain::sign<ndn::Data> (this=0x7fffffffdd40, packet=...) at /usr/local/include/ndn-cxx/security/key-chain.hpp:739 #13 0x00000000004c06bb in nfd::NotificationStream<nfd::AppFace>::postNotification<ndn::nfd::FaceEventNotification> ( this=this@entry=0x874828, notification=...) at /home/davide/NFD/core/notification-stream.hpp:66 #14 0x00000000004b4c08 in nfd::FaceManager::onAddFace (this=0x8746c0, face=...) at ../daemon/mgmt/face-manager.cpp:1039 #15 0x00000000004bc623 in operator() (a1=..., p=<optimized out>, this=<optimized out>) at /usr/include/boost/bind/mem_fn_template.hpp:165 #16 operator()<boost::_mfi::mf1<void, nfd::FaceManager, boost::shared_ptr<nfd::Face> >, boost::_bi::list1<const boost::shared_ptr<nfd::Face>&> > (a=<synthetic pointer>, f=..., this=<optimized out>) at /usr/include/boost/bind/bind.hpp:313 #17 operator()<boost::shared_ptr<nfd::Face> > (a1=..., this=<optimized out>) at /usr/include/boost/bind/bind_template.hpp:47 #18 boost::detail::function::void_function_obj_invoker1<boost::_bi::bind_t<void, boost::_mfi::mf1<void, nfd::FaceManager, boost::shared_ptr<nfd::Face> >, boost::_bi::list2<boost::_bi::value<nfd::FaceManager*>, boost::arg<1> > >, void, boost::shared_ptr<nfd::Face> const&>::invoke (function_obj_ptr=..., a0=...) at /usr/include/boost/function/function_template.hpp:153 #19 0x000000000049b1c2 in operator() (a0=..., this=0x86c810) at /usr/include/boost/function/function_template.hpp:767 #20 operator() (a1=..., this=0x86cbd0) at /home/davide/NFD/core/event-emitter.hpp:239 #21 nfd::FaceTable::addImpl (this=this@entry=0x86cbc8, face=..., faceId=faceId@entry=1) at ../daemon/fw/face-table.cpp:82 #22 0x000000000049b6cf in nfd::FaceTable::addReserved (this=0x86cbc8, face=..., faceId=faceId@entry=1) at ../daemon/fw/face-table.cpp:64 #23 0x0000000000451414 in nfd::Nfd::initializeManagement (this=this@entry=0x7fffffffdcc0) at ../daemon/main.cpp:160 #24 0x0000000000451cd6 in nfd::Nfd::initialize (this=this@entry=0x7fffffffdcc0) at ../daemon/main.cpp:80 #25 0x0000000000445948 in main (argc=3, argv=0x7fffffffde68) at ../daemon/main.cpp:360 ```