[serialization, ASIO] Assertion when serializing recursive boost::variant type

Hi, I have defined a recursive variant type like this: --- typedef boost::make_recursive_variant<bool, int, double, std::string, std::vector< boost::recursive_variant_ >, std::map<std::string, boost::recursive_variant_>, TGrey8Image, TRgbImage, TRgbaImage>::type TVType; --- and two containers which can store this type: --- typedef std::vector<TVType> TVector; typedef std::map<std::string, TVType> TMap; --- I wrote a set of unit-tests testing all types of plain and recursive containers and they work as expected. I also tested (de-)serialization to a binary archive and there's also no problem. Then I implemented a Message class which contains such a TVType + some other stuff. Serializing and deserializing also works in the tests. Finally I implemented a client and server with ASIO like the ASIO "serialization" example. First sending the size of the archive and then the data itself. The sending works but when I want to deserialize my message I get the following assertion: --- testSerialization: /usr/include/boost/variant/detail/visitation_impl.hpp:203: typename Visitor::result_type boost::detail::variant::visitation_impl(int, int, Visitor&, VPCV, mpl_::true_, NBF, W*, S*) [with W = mpl_::int_<20>, S = boost::detail::variant::visitation_impl_step<boost::mpl::l_iter<boost::mpl::l_end>, boost::mpl::l_iter<boost::mpl::l_end> >, Visitor = boost::detail::variant::invoke_visitor<boost::detail::variant::direct_assigner<const int> >, VPCV = void*, NBF = boost::variant<boost::detail::variant::recursive_flag<bool>, int, double, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<boost::recursive_variant_, std::allocator<boost::recursive_variant_> >, std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::recursive_variant_, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::recursive_variant_> > >, CIS::Image2d<unsigned char>, CIS::Image2d<CIS::RGB>, CIS::Image2d<CIS::RGBA>, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_>::has_fallback_type_]: Assertion `false' failed. --- I absolutely don't know what't wrong here the backtrace iss huge but the point in my code where it happens is the line when deserializing the message. When I comment out the TVType payload of the message, it works. I would really appreciate any clue. Greetings, Falco

Hi, Falco: Have you made any progress in this issue? I've encountered halt at the same point: /usr/include/boost/variant/detail/visitation_impl.hpp:203 while deleting a boost Asio Timer object. I'm using Boost v1.33.1 and Asio v0.3.6, and I'm not aware that Asio has "serialization" feature (is it new in Asio v0.3.7+?). And this halt does NOT happen on the my code unless I compiled it with "-O2"; so, too bad, I don't have a readable gdb backtrace. But from the log info in my code, it happens close to the point in some of my class destructor that contains Asio Timer object. I don't use boost "variant" class in my code, and I guess it must be asio that uses it, and i have no clue how it leads to halt at line 203. HTH & Let me know if you have any info on why it happens, --- Jeffrey On 3/23/07, Falco Hirschenberger <falco.hirschenberger@itwm.fraunhofer.de> wrote:
Hi,
I have defined a recursive variant type like this: --- typedef boost::make_recursive_variant<bool, int, double, std::string, std::vector< boost::recursive_variant_ >, std::map<std::string, boost::recursive_variant_>, TGrey8Image, TRgbImage, TRgbaImage>::type TVType; --- and two containers which can store this type: --- typedef std::vector<TVType> TVector; typedef std::map<std::string, TVType> TMap; --- I wrote a set of unit-tests testing all types of plain and recursive containers and they work as expected. I also tested (de-)serialization to a binary archive and there's also no problem. Then I implemented a Message class which contains such a TVType + some other stuff. Serializing and deserializing also works in the tests. Finally I implemented a client and server with ASIO like the ASIO "serialization" example. First sending the size of the archive and then the data itself. The sending works but when I want to deserialize my message I get the following assertion: --- testSerialization: /usr/include/boost/variant/detail/visitation_impl.hpp:203: typename Visitor::result_type boost::detail::variant::visitation_impl(int, int, Visitor&, VPCV, mpl_::true_, NBF, W*, S*) [with W = mpl_::int_<20>, S =
boost::detail::variant::visitation_impl_step<boost::mpl::l_iter<boost::mpl::l_end>, boost::mpl::l_iter<boost::mpl::l_end> >, Visitor =
boost::detail::variant::invoke_visitor<boost::detail::variant::direct_assigner<const int> >, VPCV = void*, NBF = boost::variant<boost::detail::variant::recursive_flag<bool>, int, double, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<boost::recursive_variant_, std::allocator<boost::recursive_variant_> >, std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::recursive_variant_, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::recursive_variant_> > >, CIS::Image2d<unsigned char>, CIS::Image2d<CIS::RGB>, CIS::Image2d<CIS::RGBA>, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_>::has_fallback_type_]: Assertion `false' failed. --- I absolutely don't know what't wrong here the backtrace iss huge but the point in my code where it happens is the line when deserializing the message. When I comment out the TVType payload of the message, it works.
I would really appreciate any clue.
Greetings, Falco
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Falco Hirschenberger
-
Jeffrey Chang