Opened 8 years ago
#10444 new Bugs
MPI archive failure
Reported by: | Owned by: | Matthias Troyer | |
---|---|---|---|
Milestone: | To Be Determined | Component: | mpi |
Version: | Boost 1.56.0 | Severity: | Regression |
Keywords: | Cc: |
Description
Loading a serialized archive from MPI results in crashes/asserts.
Compiler: MSVC 11.0 update 4
Platform: Windows, x64
Other notes: BOOST_MPI_HOMOGENEOUS is enabled
When I load a boost::mpi archive (that was either sent over MPI or even packed within the same process), I end up with a crash (assert in debug versions). I think I've traced the problem to packed_oarchive.hpp.
When saving, the compiler chooses the templated "save_override" function for archive::version_type. When loading, it chooses the specialized "load_override" for archive::version_type. I think this is because of missing "const" on the argument "t" for the versions of save_override specialized for archive::class_id_type & archive::version_type (since archive::version_type is actually const, the compiler can't use the non-const overload & defaults to the templated function)
The root issue is that it saves 4 bytes for archive::version_type, but loads only 1. All future operations on the archive are thus mis-aligned (bad sizes are loaded for containers, etc.). I always use the homogeneous optimization, so I'm not sure if it is limited to this case.
The same application code worked fine in 1.54.0. The new save_override/load_override functions for archive::version_type & archive::class_id_type were introduced somewhere between 1.54.0 & 1.56.0. (I did have to manually apply a fix to 1.54.0 for the zero-length loads in binary_buffer_imprimitive.hpp, but that issue has been resolved).