Boost logo

Boost Users :

Subject: [Boost-users] [Serialization] issue with "Assertion `__null != bpos' failed"
From: Francois Mauger (mauger_at_[hidden])
Date: 2017-04-24 21:22:34


Hi Robert, all,

In some of our libs, we use serialization through a base pointer:

We have a base (abstract) class "a::base" which is available from a
shared library "liba".
We have created a new class "b::foo", inherited from "a::base", hosted
in another shared lib "libb", "libb" being explicitly linked to "liba".
In "libb", class "b::foo" is exported through :

BOOST_CLASS_EXPORT_KEY2(b::foo,"b::foo") (in header foo.hpp)
BOOST_CLASS_EXPORT_IMPLEMENT(b::foo) (in some libb's foo-serial.cpp
source file)

which I think is the right way to process to register a class in a
compilation unit.

In a test program, I (de)serialize 'b::foo' instances through a
'a::base' pointer.
This mechanism has worked for years in all of our software chains.
And today it works with our current production software system (ubuntu
linux 16.04, g++ 5.4.0, GNU ld 2.26.1, Boost 1.60).
However, we now face a runtime error on *some* of our boxes. The message is:

<pre>
...test_app...:
/path/to/boost/install/include/boost/archive/detail/oserializer.hpp:436:
static void
boost::archive::detail::save_pointer_type<Archive>::polymorphic::save(Archive&,
T&) [
with T = a::base; Archive = boost::archive::xml_oarchive]: Assertion
`__null != bpos' failed.
Abort (core dumped)
</pre>

This error only occurs with XML or txt archives, but works like a charm
with Christian's EOS portable binary ars.
What is strange is that the code works on some of our systems but failed
on other ones with the
same compiler/linker/boost versions. The exception suggests some problem
with class registration
but I don't understand this (apparently) arbitrary behaviour.

If any of you have a hint to help us to find the solution, it would be
appreciated.
thanks

regards

-- 
François

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net