
Joaquín Mª López Muñoz wrote:
Markus Schöpflin ha escrito:
Joaquín Mª López Muñoz wrote:
Hello Markus
Markus Schöpflin ha escrito:
JOAQUIN LOPEZ MU?Z wrote:
[...]
The test used to work, but has hundergone a significant change that I've got the hunch might be related to its currently failing: previously all serialization tests were performed in a single translation unit named test_serialization.cpp, while now the code has been split (for reasons irrelevant to this discussion) into two files test_serialization1.cpp and test_serialization2.cpp. Does this ring some bell? [...]
This is most probably caused by having multiple instances of some static object, which in turn is caused by a limitation of the template instantiation model used. (All automatically instantiated templates are placed in the output object and given internal linkage.)
If you can identify the static object in question, adding a manual instantiation of the enclosing template will work around this, because those will be placed in an external template repository with external linkage. That's precisely what I'd like to ask you :) Could you trap the assertion and dump the stack trace? Hopefully, that'll reveal the type of the object which is causing the problem.
[...]
I had a look at extended_type_info_typeid_1::get_instance::instance and oserializer::instantiate::instance but those look correct. Hmmm...
I think I know what's going on: the calls to tkmap::insert are generated fon the constructors of automatically generated extended_type_info_typeid<> instantiations. For the test program we're dealing with, the complete list of instantiation arguments of extended_type_info_typeid<> is:
[...]
12 types in total. Of these, only the first one, boost::multi_index::detail::index_node_base<int>, is shared between test_serialization1.cpp and test_serialization2.cpp. This sharing, according to your reasoning about automatically instantiated templates being given internal linakge treatment, is what is causing the duplicate call to tkmap::insert making the assert trigger. The stack trace you've provided corroborates this.
You said in a previous mail:
If you can identify the static object in question, adding a manual instantiation of the enclosing template will work around this, because those will be placed in an external template repository with external linkage.
The enclosing template is then, if I'm not wrong, the following:
boost::serialization::extended_type_info_typeid< boost::multi_index::detail::index_node_base<int> >
Could you add a manual instantiation of that to your local copy of the test and check? Also, I'm not entirely sure by you mean by "manual instantiation", but once you've done the test I hope you can refer me to your code.
Seems we're on the right track, but unfortunately adding the manual instantiations to the files in question didn't help. I did some further debugging; here is what I got. Maybe you can spot something that will help. (ladebug) run [2] stopped at [void boost::serialization::detail::tkmap::insert(const class boost::serialization::extended_type_info*):71 0x3ffbfdf4980] 71 std::cerr << eti->get_key() << '\n'; (ladebug) where
0 0x3ffbfdf4980 in boost::serialization::detail::tkmap::insert(eti=0x140050110) "../../../libs/serialization/src/extended_type_info.cpp":71 #1 0x3ffbfdf53ec in ((extended_type_info*)0x140050110)->boost::serialization::extended_type_info::self_register() "../../../libs/serialization/src/extended_type_info.cpp":230 #2 0x1200d48b8 in ((extended_type_info_typeid_1<constboost::multi_index::detail::index_node_base<int> *)0x140050110)->boost::serialization::detail::extended_type_info_typeid_1<constboost::multi_index::detail::index_node_base<int> ::extended_type_info_typeid_1() "../../../boost/serialization/extended_type_info_typeid.hpp":77 #3 0x1200d4fbc in boost::serialization::detail::extended_type_info_typeid_1<constboost::multi_index::detail::index_node_base<int> ::get_instance() "../../../boost/serialization/extended_type_info_typeid.hpp":96 #4 0x1200d8884 in ((pointer_oserializer<boost::multi_index::detail::index_node_base<int>,boost::archive::text_oarchive>*)0x1400500d0)->boost::archive::detail::pointer_oserializer<boost::multi_index::detail::index_node_base<int>,boost::archive::text_oarchive>::pointer_oserializer() "../../../boost/archive/detail/oserializer.hpp":220 #5 0x1200e1058 in __init_sti__test_serialization1_cpp_dadc3ca5() "../../../boost/archive/detail/oserializer.hpp":197 #6 0x120160fa8 in ../../../bin.v2/libs/multi_index/test/test_serialization.test/hp_cxx-71_006_tru64/debug/test_serialization #7 0x3ff800069b0 #8 0x3ff800100b0 #9 0x3ff80010220 #10 0x120092adc in __start(...) in ../../../bin.v2/libs/multi_index/test/test_serialization.test/hp_cxx-71_006_tru64/debug/test_serialization
(ladebug) print *eti class boost::serialization::extended_type_info { m_type_info_key = 0x3ffbfd890a8="extended_type_info_typeid"; m_self_registered = '\000'; m_key_registered = '\000'; m_is_destructing = '\000'; m_key = 0x0; } (ladebug) cont [2] stopped at [void boost::serialization::detail::tkmap::insert(const class boost::serialization::extended_type_info*):71 0x3ffbfdf4980] 71 std::cerr << eti->get_key() << '\n'; (ladebug) where
0 0x3ffbfdf4980 in boost::serialization::detail::tkmap::insert(eti=0x1400503e8) "../../../libs/serialization/src/extended_type_info.cpp":71 #1 0x3ffbfdf53ec in ((extended_type_info*)0x1400503e8)->boost::serialization::extended_type_info::self_register() "../../../libs/serialization/src/extended_type_info.cpp":230 #2 0x12010bf90 in ((extended_type_info_typeid_1<constboost::multi_index::detail::index_node_base<int> *)0x1400503e8)->boost::serialization::detail::extended_type_info_typeid_1<constboost::multi_index::detail::index_node_base<int> ::extended_type_info_typeid_1() "../../../boost/serialization/extended_type_info_typeid.hpp":77 #3 0x12010c99c in boost::serialization::detail::extended_type_info_typeid_1<constboost::multi_index::detail::index_node_base<int> ::get_instance() "../../../boost/serialization/extended_type_info_typeid.hpp":96 #4 0x120113664 in ((pointer_oserializer<boost::multi_index::detail::index_node_base<int>,boost::archive::text_oarchive>*)0x1400502a0)->boost::archive::detail::pointer_oserializer<boost::multi_index::detail::index_node_base<int>,boost::archive::text_oarchive>::pointer_oserializer() "../../../boost/archive/detail/oserializer.hpp":220 #5 0x120120b98 in __init_sti__test_serialization2_cpp_dadc3ca5() "../../../boost/archive/detail/oserializer.hpp":197 #6 0x120160fb8 in ../../../bin.v2/libs/multi_index/test/test_serialization.test/hp_cxx-71_006_tru64/debug/test_serialization #7 0x3ff800069b0 #8 0x3ff800100b0 #9 0x3ff80010220 #10 0x120092adc in __start(...) in ../../../bin.v2/libs/multi_index/test/test_serialization.test/hp_cxx-71_006_tru64/debug/test_serialization
(ladebug) print *eti class boost::serialization::extended_type_info { m_type_info_key = 0x3ffbfd890a8="extended_type_info_typeid"; m_self_registered = '\000'; m_key_registered = '\000'; m_is_destructing = '\000'; m_key = 0x0; } Markus