
I'm developing a client/server application using asio for communication and boost::serialization as the means to stream the objects between the two applications. This is on Windows XP with Microsoft Visual Studio 7.1. Everything works fine until this sequence of events happens: 1) The server shuts down gracefully and serializes some classes to a file. 2) The server restarts and reads in the file, loading the settings and replacing the default settings 3) The client makes a request for an object from the server 4) The server dies with the following error: --------------------------- Microsoft Visual C++ Debug Library --------------------------- Debug Error! Program: c:\Dev\NwEngineD.exe This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. (Press Retry to debug the application) --------------------------- Abort Retry Ignore --------------------------- Now, if I skip loading of the previously saved file, none of this ever happens. Everything works just fine. The following is the call stack when the error occurs:
msvcr71d.dll!_NMSG_WRITE(int rterrnum=10) Line 195 C msvcr71d.dll!abort() Line 44 + 0x7 C msvcr71d.dll!_assert(const char * expr=0x003696dc, const char * filename=0x00369668, unsigned int lineno=71) Line 306 C boost_serialization-vc71-mt-gd-1_33_1.dll!0033bc2c() boost_serialization-vc71-mt-gd-1_33_1.dll!0033bb70()
NwEngineD.exe!boost::serialization::detail::extended_type_info_typeid_1<nw:: Node const >::extended_type_info_typeid_1<nw::Node const >() Line 78 C++ NwEngineD.exe!boost::serialization::detail::extended_type_info_typeid_1<nw:: Node const >::get_instance() Line 96 + 0x2a C++ NwEngineD.exe!boost::archive::detail::oserializer<boost::archive::text_oarch ive,nw::Node>::oserializer<boost::archive::text_oarchive,nw::Node>() Line 108 + 0x14 C++ NwEngineD.exe!boost::archive::detail::oserializer<boost::archive::text_oarch ive,nw::Node>::instantiate() Line 135 + 0x2a C++ NwEngineD.exe!boost::archive::detail::save_non_pointer_type<boost::archive:: text_oarchive,nw::Node>::save_standard::invoke(boost::archive::text_oarchive & ar={...}, const nw::Node & t={...}) Line 264 + 0x5 C++ NwEngineD.exe!boost::archive::detail::save_non_pointer_type<boost::archive:: text_oarchive,nw::Node>::invoke(boost::archive::text_oarchive & ar={...}, const nw::Node & t={...}) Line 322 + 0xd C++ NwEngineD.exe!boost::archive::save<boost::archive::text_oarchive,nw::Node>(b oost::archive::text_oarchive & ar={...}, const nw::Node & t={...}) Line 536 + 0xd C++ NwEngineD.exe!boost::archive::basic_text_oarchive<boost::archive::text_oarch ive>::save_override<nw::Node const >() Line 78 + 0x15 C++ NwEngineD.exe!boost::archive::detail::interface_oarchive<boost::archive::tex t_oarchive>::operator<<<nw::Node const >() Line 79 C++ NwEngineD.exe!boost::serialization::nvp<nw::Node const
::save<boost::archive::text_oarchive>() Line 78 C++
NwEngineD.exe!boost::serialization::access::member_save<boost::archive::text _oarchive,boost::serialization::nvp<nw::Node const > const >() Line 94 C++ NwEngineD.exe!boost::serialization::detail::member_saver<boost::archive::tex t_oarchive,boost::serialization::nvp<nw::Node const >
::invoke(boost::archive::text_oarchive & ar={...}, const boost::serialization::nvp<nw::Node const > & t={...}, const unsigned int file_version=0) Line 43 + 0x11 C++
NwEngineD.exe!boost::serialization::split_member<boost::archive::text_oarchi ve,boost::serialization::nvp<nw::Node const >
(boost::archive::text_oarchive & ar={...}, boost::serialization::nvp<nw::Node const > & t={...}, const unsigned int file_version=0) Line 69 + 0x11 C++ NwEngineD.exe!boost::serialization::nvp<nw::Node const ::serialize<boost::archive::text_oarchive>() Line 87 + 0x1f C++
NwEngineD.exe!boost::serialization::access::serialize<boost::archive::text_o archive,boost::serialization::nvp<nw::Node const > >() Line 110 C++ NwEngineD.exe!boost::serialization::serialize<boost::archive::text_oarchive, boost::serialization::nvp<nw::Node const > >(boost::archive::text_oarchive & ar={...}, boost::serialization::nvp<nw::Node const > & t={...}, const unsigned int file_version=0) Line 81 + 0x11 C++ NwEngineD.exe!boost::serialization::serialize_adl<boost::archive::text_oarch ive,boost::serialization::nvp<nw::Node const >
(boost::archive::text_oarchive & ar={...}, boost::serialization::nvp<nw::Node const > & t={...}, const unsigned int file_version=0) Line 140 + 0x18 C++
NwEngineD.exe!boost::archive::detail::save_non_pointer_type<boost::archive:: text_oarchive,boost::serialization::nvp<nw::Node const >
::save_only::invoke(boost::archive::text_oarchive & ar={...}, const boost::serialization::nvp<nw::Node const > & t={...}) Line 257 + 0xf C++
NwEngineD.exe!boost::archive::detail::save_non_pointer_type<boost::archive:: text_oarchive,boost::serialization::nvp<nw::Node const >
::invoke(boost::archive::text_oarchive & ar={...}, const boost::serialization::nvp<nw::Node const > & t={...}) Line 322 + 0xd C++
NwEngineD.exe!boost::archive::save<boost::archive::text_oarchive,boost::seri alization::nvp<nw::Node const > >(boost::archive::text_oarchive & ar={...}, const boost::serialization::nvp<nw::Node const > & t={...}) Line 536 + 0xd C++ NwEngineD.exe!boost::archive::basic_text_oarchive<boost::archive::text_oarch ive>::save_override<boost::serialization::nvp<nw::Node const > const >() Line 78 + 0x15 C++ NwEngineD.exe!boost::archive::detail::interface_oarchive<boost::archive::tex t_oarchive>::operator<<<boost::serialization::nvp<nw::Node const > const >() Line 79 C++ NwEngineD.exe!boost::serialization::stl::save_collection<boost::archive::tex t_oarchive,std::list<nw::Node,std::allocator<nw::Node> >
(boost::archive::text_oarchive & ar={...}, const std::list<nw::Node,std::allocator<nw::Node> > & s={...}) Line 44 C++
NwEngineD.exe!boost::serialization::save<boost::archive::text_oarchive,nw::N ode,std::allocator<nw::Node> >(boost::archive::text_oarchive & ar={...}, const std::list<nw::Node,std::allocator<nw::Node> > & t={...}, const unsigned int __formal=0) Line 47 + 0xd C++ NwEngineD.exe!boost::serialization::free_saver<boost::archive::text_oarchive ,std::list<nw::Node,std::allocator<nw::Node> >
::invoke(boost::archive::text_oarchive & ar={...}, const std::list<nw::Node,std::allocator<nw::Node> > & t={...}, const unsigned int file_version=0) Line 45 + 0x18 C++
NwEngineD.exe!boost::serialization::split_free<boost::archive::text_oarchive ,std::list<nw::Node,std::allocator<nw::Node> >
(boost::archive::text_oarchive & ar={...}, std::list<nw::Node,std::allocator<nw::Node> > & t={...}, const unsigned int file_version=0) Line 74 + 0x11 C++
NwEngineD.exe!boost::serialization::serialize<boost::archive::text_oarchive, nw::Node,std::allocator<nw::Node> >(boost::archive::text_oarchive & ar={...}, std::list<nw::Node,std::allocator<nw::Node> > & t={...}, const unsigned int file_version=0) Line 75 + 0x11 C++ NwEngineD.exe!boost::serialization::serialize_adl<boost::archive::text_oarch ive,std::list<nw::Node,std::allocator<nw::Node> >
(boost::archive::text_oarchive & ar={...}, std::list<nw::Node,std::allocator<nw::Node> > & t={...}, const unsigned int file_version=0) Line 140 + 0x18 C++
NwEngineD.exe!boost::archive::detail::oserializer<boost::archive::text_oarch ive,std::list<nw::Node,std::allocator<nw::Node> >
::save_object_data(boost::archive::detail::basic_oarchive & ar={...}, const void * x=0x0012f644) Line 152 + 0x2b C++ boost_serialization-vc71-mt-gd-1_33_1.dll!0032a2ab() msvcr71d.dll!_onexit_lk(int (void)* func=0x00000008) Line 119 + 0xd C msvcr71d.dll!_unlockexit() Line 541 + 0x7 C msvcr71d.dll!_onexit(int (void)* func=0x0012edbc) Line 99 + 0x5 C msvcr71d.dll!_onexit(int (void)* func=0x0012edbc) Line 96 + 0x1b C NwEngineD.exe!_onexit(int (void)* func=0x0032aa2e) Line 81 + 0x13 C 0012ecec()
NwEngineD.exe!boost::archive::detail::save_non_pointer_type<boost::archive:: text_oarchive,std::list<nw::Node,std::allocator<nw::Node> >
::save_standard::invoke(boost::archive::text_oarchive & ar={...}, const std::list<nw::Node,std::allocator<nw::Node> > & t={...}) Line 264 + 0x15 C++
NwEngineD.exe!boost::archive::detail::save_non_pointer_type<boost::archive:: text_oarchive,std::list<nw::Node,std::allocator<nw::Node> >
::invoke(boost::archive::text_oarchive & ar={...}, const std::list<nw::Node,std::allocator<nw::Node> > & t={...}) Line 322 + 0xd C++
NwEngineD.exe!boost::archive::save<boost::archive::text_oarchive,std::list<n w::Node,std::allocator<nw::Node> > >(boost::archive::text_oarchive & ar={...}, const std::list<nw::Node,std::allocator<nw::Node> > & t={...}) Line 536 + 0xd C++ NwEngineD.exe!boost::archive::basic_text_oarchive<boost::archive::text_oarch ive>::save_override<std::list<nw::Node,std::allocator<nw::Node> > const >() Line 78 + 0x15 C++ NwEngineD.exe!boost::archive::detail::interface_oarchive<boost::archive::tex t_oarchive>::operator<<<std::list<nw::Node,std::allocator<nw::Node> > const
() Line 79 C++
NwEngineD.exe!boost::archive::detail::interface_oarchive<boost::archive::tex t_oarchive>::operator&<std::list<nw::Node,std::allocator<nw::Node> > >() Line 90 C++ NwEngineD.exe!nw::TransactionResponse::serialize<boost::archive::text_oarchi ve>() Line 237 C++ NwEngineD.exe!boost::serialization::access::serialize<boost::archive::text_o archive,nw::TransactionResponse>() Line 110 C++ NwEngineD.exe!boost::serialization::serialize<boost::archive::text_oarchive, nw::TransactionResponse>(boost::archive::text_oarchive & ar={...}, nw::TransactionResponse & t={...}, const unsigned int file_version=0) Line 81 + 0x11 C++ NwEngineD.exe!boost::serialization::serialize_adl<boost::archive::text_oarch ive,nw::TransactionResponse>(boost::archive::text_oarchive & ar={...}, nw::TransactionResponse & t={...}, const unsigned int file_version=0) Line 140 + 0x18 C++ NwEngineD.exe!boost::archive::detail::oserializer<boost::archive::text_oarch ive,nw::TransactionResponse>::save_object_data(boost::archive::detail::basic _oarchive & ar={...}, const void * x=0x0012f5d8) Line 152 + 0x2b C++ boost_serialization-vc71-mt-gd-1_33_1.dll!0032a2ab() msvcr71d.dll!_unlock(int locknum=4) Line 347 C msvcr71d.dll!operator delete(void * pUserData=0x0012ee34) Line 57 + 0x7 C++ msvcr71d.dll!operator delete(void * pUserData=0x0012ee34) Line 54 + 0x1f C++ 0012ee34() msvcp71d.dll!std::basic_string<char,std::char_traits<char>,std::allocator<ch ar> >::_Tidy(bool _Built=true, unsigned int _Newsize=1242584) Line 1521 C++ boost_serialization-vc71-mt-gd-1_33_1.dll!0032aa2e() NwEngineD.exe!boost::archive::detail::save_non_pointer_type<boost::archive:: text_oarchive,nw::TransactionResponse>::save_standard::invoke(boost::archive ::text_oarchive & ar={...}, const nw::TransactionResponse & t={...}) Line 264 + 0x15 C++ NwEngineD.exe!boost::archive::detail::save_non_pointer_type<boost::archive:: text_oarchive,nw::TransactionResponse>::invoke(boost::archive::text_oarchive & ar={...}, const nw::TransactionResponse & t={...}) Line 322 + 0xd C++ NwEngineD.exe!boost::archive::save<boost::archive::text_oarchive,nw::Transac tionResponse>(boost::archive::text_oarchive & ar={...}, const nw::TransactionResponse & t={...}) Line 536 + 0xd C++ NwEngineD.exe!boost::archive::basic_text_oarchive<boost::archive::text_oarch ive>::save_override<nw::TransactionResponse const >() Line 78 + 0x15 C++ NwEngineD.exe!boost::archive::detail::interface_oarchive<boost::archive::tex t_oarchive>::operator<<<nw::TransactionResponse const >() Line 79 C++ NwEngineD.exe!nw::Connection::asyncWrite<nw::TransactionResponse,boost::_bi: :bind_t<void,boost::_mfi::mf2<void,NwServerSession,asio::error const &,unsigned int>,boost::_bi::list3<boost::_bi::value<boost::shared_ptr<NwServerSession>
,boost::arg<1>,boost::arg<2> > > >() Line 99 C++ <** snip **>
The last line of serialization code in the call stack (before the DLLs), is this: extended_type_info_typeid_1() : detail::extended_type_info_typeid_0() { self_register(); // add type to type table } Seems like the self_register() is failing for some reason. Now, as I've said, if I don't try to read in the saved file, none of this occurs. As a matter of fact, if I just run this simple code upon server startup, the whole error above occurs: typedef unsigned int Handle; void Manager::load(const std::string &filename) { std::ifstream inFile; inFile.open(filename.c_str(), std::ios::binary); boost::archive::text_iarchive archiveFile(inFile); Handle handle = 0; ManagerNode node; archiveFile >> handle; if (handle != Handle(-1)) { // comment out the line below and everything works fine // NOTE: the line below works fine (does not blow up) // it only causes serialization to fail later. // Also notice that I don't actually do anything with node, // it just goes out of scope at procedure end archiveFile >> node; } } My apologies for not being able to provide a complete working program that mimics the error. I developed a whole test program to replicate the error, and of course, it works just fine. It does almost everything the server program does, except it doesn't use asio. My hope is the code above, call stack and error message is enough to pinpoint where the problem may be. If it isn't, please give me a general idea of how to proceed. Thanks for any help, Scott