Boost logo

Boost Users :

Subject: Re: [Boost-users] serialization1.36.0 extended_type_info exit issue(s)
From: Robert Ramey (ramey_at_[hidden])
Date: 2008-10-08 19:37:11


troy d. straszheim wrote:
> Robert Ramey wrote:
>>
>> Just to recap.
>>
> (snip)
>
>> a) you don't have the lastest copy.(possible)
>
> I definitely have svn trunk.
>
>> b) the code is multi-threading and has a race condition
>> after main() returns.(seems very unlikely to me)
>
> This is all singlethreaded, debug build.
>
>> c) my implemenation is flawed(possible - but that's why you testers
>> get the big bucks!)
>
> Would that it were so.
>

> Now, this doesn't crash unless you run it under valgrind
> and have valgrind paint free'd memory with 0xAAAAAAA:
>> ==11538== Invalid read of size 4
> ==11538== at 0x410E21B:
> std::_Rb_tree<boost::serialization::extended_type_info const*,
> boost::serialization::extended_type_info const*,
> std::_Identity<boost::serialization::extended_type_info const*>,
> boost::serialization::detail::key_compare,
> std::allocator<boost::serialization::extended_type_info const*>
> >::lower_bound(boost::serialization::extended_type_info const*
> const&) (stl_tree.h:1430) ==11538== by 0x410E2AE:
> std::multiset<boost::serialization::extended_type_info const*,
> boost::serialization::detail::key_compare,
> std::allocator<boost::serialization::extended_type_info const*>
> >::lower_bound(boost::serialization::extended_type_info const*
> const&) (stl_multiset.h:436) ==11538== by 0x410D3CC:
> boost::serialization::extended_type_info::key_unregister()
> (extended_type_info.cpp:90) ==11538== by 0x410D582:
> boost::serialization::extended_type_info::~extended_type_info()

...

Here is the code that provokes the error

BOOST_SERIALIZATION_DECL(void)

extended_type_info::key_register(const char *key) {

assert(NULL != key);

m_key = key;

singleton<detail::ktmap>::get_mutable_instance().insert(this);

}

BOOST_SERIALIZATION_DECL(void)

extended_type_info::key_unregister() {

assert(NULL != m_key);

if(! singleton<detail::ktmap>::is_destroyed()){

detail::ktmap & x = singleton<detail::ktmap>::get_mutable_instance();

detail::ktmap::iterator start = x.lower_bound(this); ///////// line #
90 - problem is here

detail::ktmap::iterator end = x.upper_bound(this);

assert(start != end);

// remove entry in map which corresponds to this type

do{

if(this == *start)

x.erase(start++);

else

++start;

}while(start != end);

}

m_key = NULL;

}

So trap on this line and verify that
singleton<detail::ktmap>::is_destroyed() is not true

then trap on the destructor of singleton<detail::ktmap>::is_destroyed() to
verify that

m_is_destroyed is in fact getting set when the table is destroyed.

Robert Ramey


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net