Opened 17 years ago
Closed 17 years ago
#478 closed Bugs (Invalid)
Serialization 1.33 assertion failure when deserializing STL
Reported by: | tzlaine | Owned by: | Robert Ramey |
---|---|---|---|
Milestone: | Component: | serialization | |
Version: | None | Severity: | |
Keywords: | Cc: |
Description
I am seeing an assertion failure in reset_object_address. The assertion output is: /tmp/boost_cvs/libs/serialization/src/basic_iarchive.cpp:266: void boost::archive::detail::basic_iarchive_impl::reset_object_address(const void*, const void*): Assertion `object_id_vector[i].address >= ol d_address' failed. These are the values in the failed assertion: i == 1 object_id_vector[i].address == 0x43ef0920 old_address == 0xbfffe240 For good measure, new_address == 0x43ee7830 and this == 0x43eeffc0 at the point of failure. I don't know if that indicates that old_address is garbage, or if it is supposed to be that far away from the other addresses. This is the same assertion failure reported in bug #1262084, but I am not using polymorphic archives. I verified that the test code submitted for that bug fails for me as well, but when I converted it to non-polymorphic archives, it works fine. Therefor I have no idea if these bugs are related. The code producing the failure worked fine under version 1.32. Unfortunately, the code that produces this failure is pretty involved. All my attempts to produce a minimal set of code that provokes the failure have failed. The object producing the failure is being serialized through a pointer-to-base. The inheritance of the object's class is Wnd -> Control -> TextControl. The object within the TextControl that is actually producing the failure is m_line_data, which is a std::vector. I have two fairly minimal serialize methods that I have created for the object being loaded when the failure occurs -- one of which works and on of which does not. Method A works: template <class Archive> void GG::TextControl::serialize(Archive& ar, const unsigned int version) { ar & BOOST_SERIALIZATION_NVP(m_line_data); } Method B fails: template <class Archive> void GG::TextControl::serialize(Archive& ar, const unsigned int version) { ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Control) & BOOST_SERIALIZATION_NVP(m_line_data); } The XML file produced using A: <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="3"> <new_plan_text_control class_id="0" tracking_level="1" version="0" object_id="_0"> <m_line_data class_id="1" tracking_level="0" version="0"> <count>1</count> <item class_id="2" tracking_level="0" version="0"> <char_data class_id="3" tracking_level="0" version="0"> <count>0</count> </char_data> <justification>8</justification> </item> </m_line_data> </new_plan_text_control> </boost_serialization> The XML file produced using B: <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="3"> <new_plan_text_control class_id="0" tracking_level="1" version="0" object_id="_0"> <Control class_id="1" tracking_level="1" version="0" object_id="_1"> <Wnd class_id="2" tracking_level="1" version="0" object_id="_2"> <m_text></m_text> <m_done>0</m_done> <m_parent class_id="-1"></m_parent> <m_children class_id="3" tracking_level="0" version="0"> <count>0</count> </m_children> <m_zorder>0</m_zorder> <m_visible>1</m_visible> <m_clip_children>0</m_clip_children> <m_upperleft class_id="4" tracking_level="0" version="0"> <x>0</x> <y>0</y> </m_upperleft> <m_lowerright> <x>150</x> <y>25</y> </m_lowerright> <m_min_size> <x>0</x> <y>0</y> </m_min_size> <m_max_size> <x>1073741824</x> <y>1073741824</y> </m_max_size> <m_filters class_id="5" tracking_level="0" version="0"> <count>0</count> </m_filters> <m_filtering class_id="6" tracking_level="0" version="0"> <count>0</count> </m_filtering> <m_layout class_id="-1"></m_layout> <m_containing_layout class_id="-1"></m_containing_layout> <m_flags>0</m_flags> </Wnd> <m_color class_id="8" tracking_level="0" version="0"> <r>0</r> <g>0</g> <b>0</b> <a>0</a> </m_color> <m_disabled>0</m_disabled> </Control> <m_line_data class_id="9" tracking_level="0" version="0"> <count>1</count> <item class_id="10" tracking_level="0" version="0"> <char_data class_id="11" tracking_level="0" version="0"> <count>0</count> </char_data> <justification>8</justification> </item> </m_line_data> </new_plan_text_control> </boost_serialization> Below is the stack at the point of failure. I Hope this helps. #0 0xffffe410 in ?? () #1 0xbfffe050 in ?? () #2 0x00000006 in ?? () #3 0x4062bf79 in abort () from /lib/tls/libc.so.6 #4 0x40623fe3 in __assert_fail () from /lib/tls/libc.so.6 #5 0x404be06f in boost::archive::detail::basic_iarchive_impl::reset_object_address (this=0x43eeffc0, new_address=0x43ee7830, old_address=0xbfffe240) at /tmp/boost_cvs/libs/serialization/src/basic_iarchive.cpp:266 #6 0x404bd7b1 in boost::archive::detail::basic_iarchive::reset_object_address (this=0xbfffebc0, new_address=0x43ee7830, old_address=0xbfffe240) at /tmp/boost_cvs/libs/serialization/src/basic_iarchive.cpp:529 up 5#7 0x0809c679 in boost::serialization::stl::archive_input_seq<boost::archive::xml_iarchive, std::vector<GG::Font::LineData, std::allocator<GG::Font::LineData> > >::operator() (this=0xbfffe27e, ar=@0xbfffebc0, s=@0x43ef099c) at collections_load_imp.hpp:91 #8 0x0809c495 in rebuild_collection<boost::archive::xml_iarchive, std::vector<GG::Font::LineData, std::allocator<GG::Font::LineData> >, boost::serialization::stl::archive_input_seq<boost::archive::xml_iarchive, std::ve ctor<GG::Font::LineData, std::allocator<GG::Font::LineData> > >, boost::serialization::stl::reserve_imp<std::vector<GG::Font::LineData, std::allocator<GG::Font::LineData> > > > (ar=@0xbfffebc0, s=@0x43ef099c) at collections_load_imp.hpp:208 #9 0x0809c41c in load_collection<boost::archive::xml_iarchive, std::vector<GG::Font::LineData, std::allocator<GG::Font::LineData> >, boost::serialization::stl::archive_input_seq<boost::archive::xml_iarchive, std::vecto r<GG::Font::LineData, std::allocator<GG::Font::LineData> > >, boost::serialization::stl::reserve_imp<std::vector<GG::Font::LineData, std::allocator<GG::Font::LineData> > > > (ar=@0xbfffebc0, s=@0x43ef099c) at collections_load_imp.hpp:230 #10 0x0809c402 in load<boost::archive::xml_iarchive, GG::Font::LineData, std::allocator<GG::Font::LineData> > (ar=@0xbfffebc0, t=@0x43ef099c) at vector.hpp:58 #11 0x0809c3e9 in boost::serialization::free_loader<boost::archive::xml_iarchive, std::vector<GG::Font::LineData, std::allocator<GG::Font::LineData> > >::invoke (ar=@0xbfffebc0, t=@0x43ef099c, file_version=0) at split_free.hpp:58 #12 0x0809c3ad in split_free<boost::archive::xml_iarchive, std::vector<GG::Font::LineData, std::allocator<GG::Font::LineData> > > (ar=@0xbfffebc0, t=@0x43ef099c, file_version=0) at split_free.hpp:74 #13 0x0809c391 in serialize<boost::archive::xml_iarchive, GG::Font::LineData, std::allocator<GG::Font::LineData> > (ar=@0xbfffebc0, t=@0x43ef099c, file_version=0) at vector.hpp:76 #14 0x0809b937 in serialize_adl<boost::archive::xml_iarchive, std::vector<GG::Font::LineData, std::allocator<GG::Font::LineData> > > (ar=@0xbfffebc0, t=@0x43ef099c, file_version=0) at serialization.hpp:140 #15 0x0809b3b0 in boost::archive::detail::iserializer<boost::archive::xml_iarchive, std::vector<GG::Font::LineData, std::allocator<GG::Font::LineData> > >::load_object_data (this=0x814c7e8, ar=@0xbfffebc0, x=0x43ef099c, file_version=0) at iserializer.hpp:158 #16 0x404be3c6 in boost::archive::detail::basic_iarchive_impl::load_object (this=0x43eeffc0, ar=@0xbfffebc0, t=0x43ef099c, bis=@0x814c7e8) at /tmp/boost_cvs/libs/serialization/src/basic_iarchive.cpp:378 #17 0x404bd7e1 in boost::archive::detail::basic_iarchive::load_object (this=0xbfffebc0, t=0x43ef099c, bis=@0x814c7e8) at /tmp/boost_cvs/libs/serialization/src/basic_iarchive.cpp:537 #18 0x08095170 in boost::archive::detail::load_non_pointer_type<boost::archive::xml_iarchive, std::vector<GG::Font::LineData, std::allocator<GG::Font::LineData> > >::load_standard::invoke (ar=@0xbfffebc0, t=@0x43ef099c) at iserializer.hpp:362 #19 0x08095144 in boost::archive::detail::load_non_pointer_type<boost::archive::xml_iarchive, std::vector<GG::Font::LineData, std::allocator<GG::Font::LineData> > >::invoke (ar=@0xbfffebc0, t=@0x43ef099c) at iserializer.hpp:412 #20 0x08094c6a in load<boost::archive::xml_iarchive, std::vector<GG::Font::LineData, std::allocator<GG::Font::LineData> > > (ar=@0xbfffebc0, t=@0x43ef099c) at iserializer.hpp:559 #21 0x08094c28 in boost::archive::basic_xml_iarchive<boost::archive::xml_iarchive>::load_override<std::vector<GG::Font::LineData, std::allocator<GG::Font::LineData> > > (this=0xbfffebc0, t=@0xbfffe540) at basic_xml_iarchive.hpp:80 #22 0x08094bdc in boost::archive::xml_iarchive_impl<boost::archive::xml_iarchive>::load_override<boost::serialization::nvp<std::vector<GG::Font::LineData, std::allocator<GG::Font::LineData> > > const> ( this=0xbfffebc0, t=@0xbfffe540) at xml_iarchive.hpp:74 #23 0x08094bb3 in operator>><const boost::serialization::nvp<std::vector<GG::Font::LineData, std::allocator<GG::Font::LineData> > > > (this=0xbfffebc0, t=@0xbfffe540) at interface_iarchive.hpp:84 #24 0x08093aab in operator&<const boost::serialization::nvp<std::vector<GG::Font::LineData, std::allocator<GG::Font::LineData> > > > (this=0xbfffebc0, t=@0xbfffe540) at interface_iarchive.hpp:91 #25 0x080947de in GG::TextControl::serialize<boost::archive::xml_iarchive> (this=0x43ef0920, ar=@0xbfffebc0, version=0) at GGTextControl.h:223 #26 0x08094775 in serialize<boost::archive::xml_iarchive, GG::TextControl> (ar=@0xbfffebc0, t=@0x43ef0920, file_version=0) at access.hpp:109 #27 0x08094759 in serialize<boost::archive::xml_iarchive, GG::TextControl> (ar=@0xbfffebc0, t=@0x43ef0920, file_version=0) at serialization.hpp:81 #28 0x0808e7cd in serialize_adl<boost::archive::xml_iarchive, GG::TextControl> (ar=@0xbfffebc0, t=@0x43ef0920, file_version=0) at serialization.hpp:140 #29 0x0809b672 in boost::archive::detail::iserializer<boost::archive::xml_iarchive, GG::TextControl>::load_object_data (this=0x814cad0, ar=@0xbfffebc0, x=0x43ef0920, file_version=0) at iserializer.hpp:158 #30 0x404be323 in boost::archive::detail::basic_iarchive_impl::load_object (this=0x43eeffc0, ar=@0xbfffebc0, t=0x43ef0920, bis=@0x814cad0) at /tmp/boost_cvs/libs/serialization/src/basic_iarchive.cpp:363 #31 0x404bd7e1 in boost::archive::detail::basic_iarchive::load_object (this=0xbfffebc0, t=0x43ef0920, bis=@0x814cad0) at /tmp/boost_cvs/libs/serialization/src/basic_iarchive.cpp:537 #32 0x0809b2c4 in boost::archive::detail::load_non_pointer_type<boost::archive::xml_iarchive, GG::TextControl>::load_standard::invoke (ar=@0xbfffebc0, t=@0x43ef0920) at iserializer.hpp:362 #33 0x0809b298 in boost::archive::detail::load_non_pointer_type<boost::archive::xml_iarchive, GG::TextControl>::invoke (ar=@0xbfffebc0, t=@0x43ef0920) at iserializer.hpp:412 #34 0x0809af74 in load<boost::archive::xml_iarchive, GG::TextControl> (ar=@0xbfffebc0, t=@0x43ef0920) at iserializer.hpp:559 #35 0x0809af28 in boost::archive::basic_xml_iarchive<boost::archive::xml_iarchive>::load_override<GG::TextControl> (this=0xbfffebc0, t=@0xbfffe760) at basic_xml_iarchive.hpp:80 #36 0x0809aedc in boost::archive::xml_iarchive_impl<boost::archive::xml_iarchive>::load_override<boost::serialization::nvp<GG::TextControl> const> (this=0xbfffebc0, t=@0xbfffe760) at xml_iarchive.hpp:74 #37 0x08098aaf in operator>><const boost::serialization::nvp<GG::TextControl> > (this=0xbfffebc0, t=@0xbfffe760) at interface_iarchive.hpp:84 #38 0x080984c7 in boost::archive::detail::pointer_iserializer<GG::TextControl, boost::archive::xml_iarchive>::load_object_ptr (this=0x814c8c0, ar=@0xbfffebc0, x=@0x43ed4518, file_version=0) at iserializer.hpp:308 #39 0x404be9b6 in boost::archive::detail::basic_iarchive_impl::load_pointer (this=0x43eeffc0, ar=@0xbfffebc0, t=@0xbfffed44, bpis_ptr=0x814c8c0, finder=0x8081928 <boost::archive::detail::archive_pointer_iserializer<boost::archive::xml_iarchive>::find(boost::serialization::extended_type_info const&)>) at /tmp/boost_cvs/libs/serialization/src/basic_iarchive.cpp:482 #40 0x404bd817 in boost::archive::detail::basic_iarchive::load_pointer (this=0xbfffebc0, t=@0xbfffed44, bpis_ptr=0x814c8c0, finder=0x8081928 <boost::archive::detail::archive_pointer_iserializer<boost::archive::xml_iarchive>::find(boost::serialization::extended_type_info const&)>) at /tmp/boost_cvs/libs/serialization/src/basic_iarchive.cpp:549 #41 0x0808b34b in boost::archive::detail::load_pointer_type<boost::archive::xml_iarchive, GG::TextControl*>::invoke (ar=@0xbfffebc0, t=@0xbfffed44) at iserializer.hpp:473 #42 0x08089d8e in load<boost::archive::xml_iarchive, GG::TextControl*> (ar=@0xbfffebc0, t=@0xbfffed44) at iserializer.hpp:559 #43 0x08089d4c in boost::archive::basic_xml_iarchive<boost::archive::xml_iarchive>::load_override<GG::TextControl*> (this=0xbfffebc0, t=@0xbfffed90) at basic_xml_iarchive.hpp:80 #44 0x08089d00 in boost::archive::xml_iarchive_impl<boost::archive::xml_iarchive>::load_override<boost::serialization::nvp<GG::TextControl*> const> (this=0xbfffebc0, t=@0xbfffed90) at xml_iarchive.hpp:74 #45 0x08089cd7 in operator>><const boost::serialization::nvp<GG::TextControl*> > (this=0xbfffebc0, t=@0xbfffed90) at interface_iarchive.hpp:84 #46 0x08087555 in operator&<const boost::serialization::nvp<GG::TextControl*> > (this=0xbfffebc0, t=@0xbfffed90) at interface_iarchive.hpp:91 #47 0x08085cb8 in SerializationTestGGApp::Initialize (this=0xbfffef50) at serialization.cpp:458 #48 0x400312cc in SDLGGApp::Run (this=0xbfffef50) at src/SDL/SDLGGApp.cpp:291 #49 0x402259ce in GG::App::operator() (this=0xbfffef50) at src/GGApp.cpp:257 #50 0x40030988 in SDLGGApp::operator() (this=0xbfffef50) at src/SDL/SDLGGApp.cpp:62 #51 0x08085fe8 in main (argc=1, argv=0xbfffeff4) at serialization.cpp:497
Note:
See TracTickets
for help on using tickets.