[ndnSIM] SIGSEGV when simply assigning one smart pointer to another?

John Baugh jpbaugh at umich.edu
Thu Apr 13 09:39:36 PDT 2017


I believe it was still crashing either way.  But I'll double check as soon
as I get home.

That was one of my "sanity checks" to see if it would still crash.  And it
did.  With no parameters, it should still create an instance of
PopularityManager and the manager object for the shared pointer regardless
right?  It still crashes.

On Thu, Apr 13, 2017 at 12:25 PM, Ashlesh Gawande (agawande) <
agawande at memphis.edu> wrote:

> I think you forgot to pass in the pm object in the make_shared:
>
> https://github.com/profjpbaugh/ndnSIM-strategy1/blob/
> d86e3ce05696cd3fa914ab5e30c433d32623d8db/extensions/PStrat.cpp#L56
>
> Ashlesh
> ------------------------------
> *From:* John Baugh <jpbaugh at umich.edu>
> *Sent:* Wednesday, April 12, 2017 11:18:48 PM
> *To:* Junxiao Shi
> *Cc:* Ashlesh Gawande (agawande); ndnsim; Spyridon (Spyros) Mastorakis
> *Subject:* Re: [ndnSIM] SIGSEGV when simply assigning one smart pointer
> to another?
>
> Greetings again ndnSIM friends,
>
> As requested:
>
> ---------------------
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *(gdb) run Starting program:
> /home/jpbaugh/ndnSIM/my-simulations/build/jpb-pop1 [Thread debugging using
> libthread_db enabled] Using host libthread_db library
> "/lib/x86_64-linux-gnu/libthread_db.so.1". Inside ctor for PStrat Inside
> ctor for PStrat Inside ctor for PStrat Inside ctor for PStrat In jpb-pop1
> main: 0x7fffffffd6a0 About to get forwarder Just got forwarder.  About to
> get strategy choice Just got strategy choice, about to get
> effectiveStrategy Just got effective strategy, about to set popularity
> manager for it. About to set Popularity Manager inside PStrat Before
> assignment line Program received signal SIGSEGV, Segmentation fault.
> std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release (this=0x2710)
>     at /usr/include/c++/5/bits/shared_ptr_base.h:147 147        if
> (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, -1) == 1) (gdb) bt
> full #0  std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release
> (this=0x2710)     at /usr/include/c++/5/bits/shared_ptr_base.h:147 No
> locals. #1
> std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count (
> this=<optimized out>, __in_chrg=<optimized out>)     at
> /usr/include/c++/5/bits/shared_ptr_base.h:659 No locals. #2
> std::__shared_ptr<PopularityManager,
> (__gnu_cxx::_Lock_policy)2>::~__shared_ptr (this=<optimized out>,
> __in_chrg=<optimized out>)     at
> /usr/include/c++/5/bits/shared_ptr_base.h:925 No locals. #3
> std::__shared_ptr<PopularityManager,
> (__gnu_cxx::_Lock_policy)2>::operator=(std::__shared_ptr<PopularityManager,
> (__gnu_cxx::_Lock_policy)2>&&) (     __r=<optimized out>, this=0x75fc50)
>     at /usr/include/c++/5/bits/shared_ptr_base.h:1000 No locals. #4
> std::shared_ptr<PopularityManager>::operator=(std::shared_ptr<PopularityManager>&&)
> (__r=<optimized out>, this=0x75fc50)     at
> /usr/include/c++/5/bits/shared_ptr.h:294 No locals. #5
> nfd::fw::PStrat::setPopularityManager (this=0x75fba0, pm=...)     at
> ../extensions/PStrat.cpp:56 No locals. ---Type <return> to continue, or q
> <return> to quit--- #6  0x0000000000407fb9 in ns3::main (argc=<optimized
> out>,     argv=<optimized out>) at ../scenarios/jpb-pop1.cpp:120
> cmd = {           m_items =
> {<std::__cxx11::_List_base<ns3::CommandLine::Item*,
> std::allocator<ns3::CommandLine::Item*> >> = {               _M_impl =
> {<std::allocator<std::_List_node<ns3::CommandLine::Item*> >> =
> {<__gnu_cxx::new_allocator<std::_List_node<ns3::CommandLine::Item*> >> =
> {<No data fields>}, <No data fields>},                 _M_node =
> {<std::__detail::_List_node_base> = {                     _M_next =
> 0x7fffffffdc60, _M_prev = 0x7fffffffdc60},                   _M_data =
> 0}}}, <No data fields>}, m_usage = "",           m_name = "jpb-pop1"}
>         nodes = {m_nodes = std::vector of length 4, capacity 4 = {{
>               m_ptr = 0x67f7f0}, {m_ptr = 0x67f730}, {m_ptr = 0x67fa30}, {
>               m_ptr = 0x67fb30}}}         p2p = {<ns3::PcapHelperForDevice>
> = {             _vptr.PcapHelperForDevice = 0x61c618 <vtable for
> ns3::PointToPointHelper+16>}, <ns3::AsciiTraceHelperForDevice> = {
>             _vptr.AsciiTraceHelperForDevice = 0x61c648 <vtable for
> ns3::PointToPointHelper+64>}, m_queueFactory = {m_tid = {m_tid = 56},
> m_parameters = {               m_list =
> {<std::__cxx11::_List_base<ns3::AttributeConstructionList::Item,
> std::allocator<ns3::AttributeConstructionList::Item> >> = {
>                   _M_impl =
> {<std::allocator<std::_List_node<ns3::AttributeConst---Type <return> to
> continue, or q <return> to quit--- ructionList::Item> >> =
> {<__gnu_cxx::new_allocator<std::_List_node<ns3::AttributeConstructionList::Item>
> >> = {<No data fields>}, <No data fields>},                     _M_node =
> {<std::__detail::_List_node_base> = {                         _M_next =
> 0x7fffffffd9d8, _M_prev = 0x7fffffffd9d8},                       _M_data =
> 0}}}, <No data fields>}}}, m_channelFactory = {             m_tid = {m_tid
> = 198}, m_parameters = {               m_list =
> {<std::__cxx11::_List_base<ns3::AttributeConstructionList::Item,
> std::allocator<ns3::AttributeConstructionList::Item> >> = {
>                   _M_impl =
> {<std::allocator<std::_List_node<ns3::AttributeConstructionList::Item> >> =
> {<__gnu_cxx::new_allocator<std::_List_node<ns3::AttributeConstructionList::Item>
> >> = {<No data fields>}, <No data fields>},                     _M_node =
> {<std::__detail::_List_node_base> = {                         _M_next =
> 0x7fffffffd9f8, _M_prev = 0x7fffffffd9f8},                       _M_data =
> 0}}}, <No data fields>}}},           m_remoteChannelFactory = {m_tid =
> {m_tid = 199}, m_parameters = {               m_list =
> {<std::__cxx11::_List_base<ns3::AttributeConstructionList::Item,
> std::allocator<ns3::AttributeConstructionList::Item> >> = {
>                   _M_impl =
> {<std::allocator<std::_List_node<ns3::AttributeConstructionList::Item> >> =
> {<__gnu_cxx::new_allocator<std::_List_node<ns3::AttributeConstructionList::Item>
> >> = {<No data fields>}, <No data fields>},                     _M_node =
> {<std::__detail::_List_node_base> = {                         _M_next =
> 0x7fffffffda18, _M_prev = 0x7fffffffda18},                       _M_data =
> 0}}}, <No data fields>}}}, m_deviceFactory = {             m_tid = {m_tid =
> 197}, m_parameters = {               m_list =
> {<std::__cxx11::_List_base<ns3::AttributeConstructionList::Item,
> std::allocator<ns3::AttributeConstructionList::Item> >> = {
>                   _M_impl =
> {<std::allocator<std::_List_node<ns3::AttributeConstructionList::Item> >> =
> {<__gnu_cxx::new_allocator<std::_List_node<ns3::AttributeConstructionList::Item>
> >> = {<No data fields>}, <No data fields>},                     _M_node =
> {<std::__detail::_List_node_base> = {                         _M_next =
> 0x7fffffffda38, _M_prev = 0x7fffffffda38},                       _M_data =
> 0}}}, <No data fields>}}}}         ndnHelper =
> {<boost::noncopyable_::noncopyable> = {<No data fields>},
> _vptr.StackHelper = 0x7ffff5bed7b0 <vtable for ns3::ndn::StackHelper+16>,
> m_isRibManagerDisabled = false,
> m_isForwarderStatusManagerDisabled = false,
> m_isStrategyChoiceManagerDisabled = false, m_ndnFactory = {m_tid = {
>               m_tid = 603}, m_parameters = {               m_list =
> {<std::__cxx11::_List_base<ns3::AttributeConstructionList::Item,
> std::allocator<ns3::AttributeConstructionList::Item> >> = {
>                   _M_impl =
> {<std::allocator<std::_List_node<ns3::AttributeConstructionList::Item> >> =
> {<__gnu_cxx::new_allocator<std::_List_node<ns3::AttributeConstructionList::Item>
> >> = {<No data fields>}, <No data fields>},                     _M_node =
> {<std::__detail::_List_node_base> = {                         _M_next =
> 0x7fffffffdcd8, _M_prev = 0x7fffffffdcd8},                       _M_data =
> 0}}}, <No data fields>}}},           m_contentStoreFactory = {m_tid =
> {m_tid = 568}, m_parameters = {               m_list =
> {<std::__cxx11::_List_base<ns3::AttributeConstructionList::Item,
> std::allocator<ns3::AttributeConstructionList::Item> >> = {
>                   _M_impl =
> {<std::allocator<std::_List_node<ns3::AttributeConstructionList::Item> >> =
> {<__gnu_cxx::new_allocator<std::_List_node<ns3::AttributeConstructionList::Item>
> >> = {<No data fields>}, <No data fields>},                     _M_node =
> {<std::__detail::_List_node_base> = {                         _M_next =
> 0x7fffffffdcf8, _M_prev = 0x7fffffffdcf8},                       _M_data =
> 0}}}, <No data fields>}}},           m_needSetDefaultRoutes = true,
> m_maxCsSize = 100, ---Type <return> to continue, or q <return> to quit---
>           nc =
> {<std::_Maybe_unary_or_binary_function<std::unique_ptr<nfd::cs::Policy,
> std::default_delete<nfd::cs::Policy> > >> = {<No data fields>},
> <std::_Function_base> = {               static _M_max_size = 16, static
> _M_max_align = 8, _M_functor = {_M_unused = {_M_object = 0x0,
> _M_const_object = 0x0, _M_function_pointer = 0x0, _M_member_pointer =
> NULL},                 _M_pod_data = '\000' <repeats 15 times>},
>               _M_manager = 0x7ffff54f5000
> <std::_Function_base::_Base_manager<ns3::ndn::StackHelper::StackHelper()::<lambda()>
> >::_M_manager(std::_Any_data &, const std::_Any_data &,
> std::_Manager_operation)>},             _M_invoker = 0x7ffff54f5040
> <std::_Function_handler<std::unique_ptr<nfd::cs::Policy,
> std::default_delete<nfd::cs::Policy> >(),
> ns3::ndn::StackHelper::StackHelper()::<lambda()> >::_M_invoke(const
> std::_Any_data &)>}, m_csPolicies = std::map with 2 elements = {
>             ["nfd::cs::lru"] =
> {<std::_Maybe_unary_or_binary_function<std::unique_ptr<nfd::cs::Policy,
> std::default_delete<nfd::cs::Policy> > >> = {<No data fields>},
> <std::_Function_base> = {                 static _M_max_size = 16, static
> _M_max_align = 8, _M_functor = {_M_unused = {_M_object =
> 0x6d20656874207361, _M_const_object = 0x6d20656874207361,
>                     _M_function_pointer = 0x6d20656874207361,
> _M_member_pointer = &virtual table offset 7863396448688173920, this
> adjustment 8151635676654827617}, _M_pod_data = "as the maximum q"},
>                 _M_manager = 0x7ffff54f5000
> <std::_Function_base::_Base_manager<ns3::ndn::StackHelper::StackHelper()::<lambda()>
> >::_M_manager(std::_Any_data &, const std::_Any_data &,
> std::_Manager_operation)>},               _M_invoker = 0x7ffff54f5040
> <std::_Function_handler<std::unique_ptr<nfd::cs::Policy,
> std::default_delete<nfd::cs::Policy> >(),
> ns3::ndn::StackHelper::StackHelper()::<lambda()> >::_M_invoke(const
> std::_Any_data &)>},             ["nfd::cs::priority_fifo"] =
> {<std::_Maybe_unary_or_binary_function<std::unique_ptr<nfd::cs::Policy,
> std::default_delete<nfd::cs::Policy> > >> = {<No data fields>},
> <std::_Function_base> = {static _M_max_size = 16, static _M_max_align = 8,
> _M_functor = {_M_unused = {_M_object = 0x0, _M_const_object = 0x0,
> _M_function_pointer = 0x0, _M_member_pointer = NULL},
> _M_pod_data =
> "\000\000\000\000\000\000\000\000\060\001\000\000\000\000\000"},
>                 _M_manager = 0x7ffff54f5020
> <std::_Function_base::_Base_manager<ns3::ndn::StackHelper::StackHelper()::<lambda()>
> >::_M_manager(std::_Any_data &, const std::_Any_data &,
> std::_Manager_operation)>},               _M_invoker = 0x7ffff54f50d0
> <std::_Function_handler<std::unique_ptr<nfd::cs::Policy,
> std::default_delete<nfd::cs::Policy> >(),
> ns3::ndn::StackHelper::StackHelper()::<lambda()> >::_M_invoke(const
> std::_Any_data &)>}},           m_netDeviceCallbacks =
> {<std::__cxx11::_List_base<std::pair<ns3::TypeId,
> ns3::Callback<std::shared_ptr<nfd::face::Face>, ns3::Ptr<ns3::Node>,
> ns3::Ptr<ns3::ndn::L3Protocol>, ns3::Ptr<ns3::NetDevice>, ns3::empty,
> ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> >,
> std::allocator<std::pair<ns3::TypeId,
> ns3::Callback<std::shared_ptr<nfd::face::Face>, ns3::Ptr<ns3::Node>,
> ns3::Ptr<ns3::ndn::L3Protocol>, ns3::Ptr<ns3::NetDevice>, ns3::empty,
> ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> > > >> = {
>               _M_impl =
> {<std::allocator<std::_List_node<std::pair<ns3::TypeId,
> ns3::Callback<std::shared_ptr<nfd::face::Face>, ns3::Ptr<ns3::Node>,
> ns3::Ptr<ns3::ndn::L3Protocol>, ns3::Ptr<ns3::NetDevice>, ns3::empty,
> ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> > > >> =
> {<__gnu_cxx::new_allocator<std::_List_node<std::pair<ns3::TypeId,
> ns3::Callback<std::shared_ptr<nfd::face::Face>, ns3::Ptr<ns3::Node>,
> ns3::Ptr<ns3::ndn::L3Protocol>, ns3::Ptr<ns3::NetDevice>, ns3::empty,
> ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> > > >> = {<No
> data fields>}, <No data fields>},                 _M_node =
> {<std::__detail::_List_node_base> = {_M_next = 0x682740, _M_prev =
> 0x682740}, _M_data = 1}}}, <No data fields>}}
> ndnGlobalRoutingHelper = {<No data fields>}         l3 = {m_ptr = 0x760140}
>         popularityManager = std::shared_ptr (count 2, weak 0) 0x7b0820
>         forwarder = std::shared_ptr (count 2, weak 0) 0x75f860
> effectiveStrategy = @0x75fba0: {<nfd::fw::Strategy> =
> {<std::enable_shared_from_this<nfd::fw::Strategy>> = {
> _M_weak_this = std::weak_ptr (empty) 0x0},
> <boost::noncopyable_::noncopyable> = {<No data fields>}, _vptr.Strategy =
> 0x7ffff5c06c48 <vtable for nfd::fw::BestRouteStrategy2+16>,
> afterAddFace = @0x75f8e8, beforeRemoveFace = @0x75f910, m_name =
> {<std::enable_shared_from_this<ndn::Name>> = {_M_weak_this = std::weak_ptr
> (empty) 0x0},               static npos = 18446744073709551615, m_nameBlock
> = {m_buffer = std::shared_ptr (empty) 0x0, m_type = 4294967295, m_begin =
> <error reading variable>}, m_forwarder = @0x75f860,
> m_measurements = {<boost::noncopyable_::noncopyable> = {<No data fields>},
> m_measurements = @0x75fa30, m_strategyChoice = @0x75fa40, m_strategy =
> 0x75fba0}},           static STRATEGY_NAME =
> {<std::enable_shared_from_this<ndn::Name>> = {_M_weak_this = std::weak_ptr
> (empty) 0x0}, static npos = 18446744073709551615, m_nameBlock = {
>               m_buffer = std::shared_ptr (empty) 0x0, m_type = 4294967295,
> m_begin = <error reading variable>}, popularityManager = std::shared_ptr
> (count 1, weak 0) 0x7b54c0}         policy =
> std::unique_ptr<PopularityPolicy> containing 0x7fffffffd6b0
> consumerHelper = {m_factory = {m_tid = {m_tid = 55264}, m_parameters = {
>               m_list =
> {<std::__cxx11::_List_base<ns3::AttributeConstructionList::Item,
> std::allocator<ns3::AttributeConstructionList::Item> >> = {
>                   _M_impl =
> {<std::allocator<std::_List_node<ns3::AttributeConstructionList::Item> >> =
> {<__gnu_cxx::new_allocator<std::_List_node<ns3::AttributeConstructionList::Item>
> >> = {<No data fields>}, <No data fields>}, _M_node =
> {<std::__detail::_List_node_base> = {                         _M_next =
> 0x7fffee7cb87d <std::__cxx11::basic_string<char, std::char_traits<char>,
> std::allocator<char> >::reserve(unsigned long)+125>, _M_prev =
> 0x7fffeea2c1c0},                       _M_data = 140737194490703}}}, <No
> data fields>}}}}         consumerHelper2 = {m_factory = {m_tid = {m_tid =
> 55704}, m_parameters = {               m_list =
> {<std::__cxx11::_List_base<ns3::AttributeConstructionList::Item,
> std::allocator<ns3::AttributeConstructionList::Item> >> = {
>                   _M_impl =
> {<std::allocator<std::_List_node<ns3::AttributeConstructionList::Item> >> =
> {<__gnu_cxx::new_allocator<std::_List_node<ns3::AttributeConstructionList::Item>
> >> = {<No data fields>}, <No data fields>}, _M_node =
> {<std::__detail::_List_node_base> = {_M_next = 0x7fffffffd998, _M_prev =
> 0x70}, _M_data = 140737194491224}}}, <No data fields>}}}}
> producerHelper = {m_factory = {m_tid = {m_tid = 55280}, m_parameters = {
>               m_list =
> {<std::__cxx11::_List_base<ns3::AttributeConstructionList::Item,
> std::allocator<ns3::AttributeConstructionList::Item> >> = {
>                   _M_impl =
> {<std::allocator<std::_List_node<ns3::AttributeConstructionList::Item> >> =
> {<__gnu_cxx::new_allocator<std::_List_node<ns3::AttributeConstructionList::Item>
> >> = {<No data fields>}, <No data fields>}, _M_node =
> {<std::__detail::_List_node_base> = {_M_next = 0x0, _M_prev =
> 0x7fff00000002}, _M_data = 20}}}, <No data fields>}}}} #7
> 0x00007fffedde4830 in __libc_start_main (main=0x408cb0 <main(int, char**)>,
> argc=1, argv=0x7fffffffde98, init=<optimized out>, fini=<optimized out>,
> rtld_fini=<optimized out>,     stack_end=0x7fffffffde88) at
> ../csu/libc-start.c:291 ---Type <return> to continue, or q <return> to
> quit---         result = <optimized out>         unwind_buf =
> {cancel_jmp_buf = {{jmp_buf = {0, -3029923319900902443, 4231824,
> 140737488346768, 0, 0, 3029923876187565013, 3029893360785714133},
> mask_was_saved = 0}}, priv = {pad = {0x0, 0x0,               0x1, 0x408cb0
> <main(int, char**)>}, data = {prev = 0x0, cleanup = 0x0, canceltype = 1}}}
>         not_first_call = <optimized out> #8  0x00000000004092b9 in _start
> () No symbol table info available.*
>
>
>
> ---------------------
>
> Thanks,
>
> John
>
> On Tue, Apr 11, 2017 at 8:43 AM, Junxiao Shi <shijunxiao at email.arizona.edu
> > wrote:
>
>> `bt full` is better than `bt` as it shows local variables. See
>> http://www.lists.cs.ucla.edu/pipermail/nfd-dev/2016-May/001748.html
>>
>> On Apr 11, 2017 05:27, "Ashlesh Gawande (agawande)" <agawande at memphis.edu>
>> wrote:
>>
>> So after gdb is done you need to put bt to get the backtrace:
>>
>>
>> *Program received signal SIGSEGV, Segmentation fault.*
>> * std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release
>> (this=0x2710)*
>> *     at /usr/include/c++/5/bits/shared_ptr_base.h:147*
>> * 147        if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count,
>> -1) == 1)*
>>
>> * (gdb) bt*
>>
>> Ashlesh
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20170413/78fa4963/attachment-0001.html>


More information about the ndnSIM mailing list