segfault happens when I serialize nested class in apache module

Hi all, Serializing simple class "A" in Apache module done without error but when I tried to serialize my complex object like "X" which has a member, type of "A", I got segfault in Apache module. ( this doesn't happen to a executable console application ) ------------------------- here is my code : --------------------- class A { private: friend class boost::serialization::access; // to enable boost "access" class to call private "serialize" method of class "A" template<class ArchT> void serialize(ArchT &ar, unsigned int version) { // method for both serializing and deserializing ar & memA; // (de)serialize member "memA" } std::string memA; // sample member public: A(){} A(std::string pmemA) : memA(pmemA) { } std::string GetMemA() { return memA; } }; class X { private: friend class boost::serialization::access; template<class ArchT> void serialize(ArchT &ar, unsigned int version) { ar & memX; ar & a; } std::string memX; A a; public: X(std::string pmemX, A pa) : memX(pmemX), a(pa) { } X(){} }; ------------------- string st=GetRandomFileName(); ofstream out(st.c_str()); boost::archive::text_oarchive out_r(out); A a("Amem"); X x("Xmem", a); out_r << x; // not works out_r << a; // works! ------------------- here is stack trace from gdb for apache ---------------- Program received signal SIGSEGV, Segmentation fault. 0xb39b846e in ?? () (gdb) backtrace #0 0xb39b846e in ?? () #1 0xb722379e in boost::serialization::typeid_system::extended_type_info_typeid_0::is_less_than(boost::serialization::extended_type_info const&) const () from /tmp/libIRSProWebApacheModule.so #2 0xb7223c61 in std::_Rb_tree<boost::serialization::typeid_system::extended_type_info_typeid_0 const*, boost::serialization::typeid_system::extended_type_info_typeid_0 const*, std::_Identity<boost::serialization::typeid_system::extended_type_info_typeid_0 const*>, boost::serialization::typeid_system::type_compare, std::allocator<boost::serialization::typeid_system::extended_type_info_typeid_0 const*>
::_M_insert_equal(boost::serialization::typeid_system::extended_type_info_typeid_0 const* const&) () from /tmp/libIRSProWebApacheModule.so #3 0xb7223b37 in boost::serialization::typeid_system::extended_type_info_typeid_0::type_register(std::type_info const&) () from /tmp/libIRSProWebApacheModule.so #4 0xb72066d2 in boost::serialization::extended_type_info_typeid<A>::extended_type_info_typeid (this=0xb735a638) at /usr/include/boost/serialization/extended_type_info_typeid.hpp:89 #5 0xb720650d in boost::serialization::detail::singleton_wrapper<boost::serialization::extended_type_info_typeid<A> ::singleton_wrapper (this=0xb735a638) at /usr/include/boost/serialization/singleton.hpp:106 #6 0xb7206572 in boost::serialization::singleton<boost::serialization::extended_type_info_typeid<A> ::get_instance () at /usr/include/boost/serialization/singleton.hpp:128 #7 0xb72064e3 in boost::serialization::singleton<boost::serialization::extended_type_info_typeid<A> ::get_const_instance () at /usr/include/boost/serialization/singleton.hpp:141 #8 0xb720637b in boost::archive::detail::oserializer<boost::archive::text_oarchive, A>::oserializer (this=0xb735a62c) at /usr/include/boost/archive/detail/oserializer.hpp:112 #9 0xb7206253 in boost::serialization::detail::singleton_wrapper<boost::archive::detail::oserializer<boost::archive::text_oarchive, A> >::singleton_wrapper (this=0xb735a62c) at /usr/include/boost/serialization/singleton.hpp:106 #10 0xb72062b8 in boost::serialization::singleton<boost::archive::detail::oserializer<boost::archive::text_oarchive, A> >::get_instance () at /usr/include/boost/serialization/singleton.hpp:128 #11 0xb71fb0ec in __static_initialization_and_destruction_1 (__initialize_p=1, __priority=65535) at /usr/include/boost/serialization/singleton.hpp:149 #12 0xb71fb161 in _GLOBAL__sub_I_IRSProWeb_InputFilter.cc(void) () at ../IRSProWeb_InputFilter.cc:242 #13 0xb7fee7fb in ?? () from /lib/ld-linux.so.2 #14 0xb7fee8e4 in ?? () from /lib/ld-linux.so.2 #15 0xb7ff2819 in ?? () from /lib/ld-linux.so.2 #16 0xb7fee61f in ?? () from /lib/ld-linux.so.2 #17 0xb7ff20c4 in ?? () from /lib/ld-linux.so.2 #18 0xb7d31be9 in ?? () from /lib/i386-linux-gnu/libdl.so.2 #19 0xb7fee61f in ?? () from /lib/ld-linux.so.2 #20 0xb7d3233a in ?? () from /lib/i386-linux-gnu/libdl.so.2 #21 0xb7d31c97 in dlopen () from /lib/i386-linux-gnu/libdl.so.2 #22 0xb7f3d100 in apr_dso_load (res_handle=0xbfffef08, path=0x8140b78 "/tmp/libIRSProWebApacheModule.so", pool=0x8140ab0) at dso/unix/dso.c:139 #23 0xb77587c7 in load_cpp_module (pool=0x8140ab0, server=0x8100ea8, server_rec=0x816dbc0, next=0x8140b50) at apache_handler.cpp:140 #24 0xb7757680 in load_handler (pool=0x8140ab0, server=0x8100ea8, server_rec=0x816dbc0, next=0x8140b50) at mod_cplusplus.c:83 #25 0xb77576d2 in load_handlers (pool=0x8140ab0, server=0x8100ea8, server_rec=0x816dbc0) at mod_cplusplus.c:89 #26 0xb7757737 in cpp_spawn_handlers (p=0x8140ab0, s=0x8100ea8) at mod_cplusplus.c:100 #27 0x0808b748 in ap_run_child_init (pchild=0x8140ab0, s=0x8100ea8) at config.c:166 #28 0x080af138 in child_main (child_num_arg=0) at event.c:2028 #29 0x080af464 in make_child (s=0x8100ea8, slot=0) at event.c:2169 #30 0x080af5ae in startup_children (number_to_start=3) at event.c:2233 #31 0x080afeba in event_run (_pconf=0x80dc0a8, plog=0x813caa0, s=0x8100ea8) at event.c:2561 #32 0x0806fa6d in ap_run_mpm (pconf=0x80dc0a8, plog=0x813caa0, s=0x8100ea8) at mpm_common.c:98 #33 0x08068fc4 in main (argc=2, argv=0xbffff3b4) at main.c:777
participants (1)
-
Hassan Monfared