Closed fmauger closed 5 years ago
Testing Boost 1.69, the problem vanishes. I wander if this issue is related to https://github.com/boostorg/serialization/pull/131.
Also note that PR #37 does not fix the serialization issue because the multiarchive mode gets broken for XML archive with the seekg technique.
So the best thing to do is to make a try with various archs and compilers to make sure Boost 1.69 is ok. For now, I chose to break Bayeux at configure step when Boost 1.68 is detected.
I can also reproduce the bug with Boost 1.65.1 and gcc 7.3 on ubuntu 18.04. Does it mean that it was here from a while but not revealed so far? Pretty sure this is a problem with invalid order while invoking the destructors of some possibly nested static singletons. This breaks the rule of the order of destruction of static objects from a single binary unit. I observe this rather arbitrarily with Bayeux test programs with a single executable linked to libBayeux.so. However I cannot prove that we have only one unit. Maybe there is subtle effects with the executable code and the shared lib. Note that changing gcc 7.3 to gcc 6.5 does not change the issue but when Bayeux is build with Boost 1.69, the problem disapears.
It seems the cause has been identified in https://github.com/boostorg/serialization/issues/104 and fixed in https://github.com/boostorg/serialization/pull/131.
After many tests with several versions of Boost: 1.63,1.65.1 (default on Ubuntu 18.04), 1.68 and finally 1.69, I understand that Boost versions >1.64 and < 1.69 (with Linux+GCC) have a broken singleton implementation with respect to order of calling static objects' destructors from shared libs using Boost/Ser with GCC under Linux. I used GCC 6.5 and 7.3 and reproduced the same crash at program termination as expected and described by experts.
Passing "-Bsymbolic -Bsymbolic-functions" to the linker should fix the Boost/Serialization crash but I did not test it.
So I consider that we should not use Boost 1.65 to 1.68 for Bayeux and bump directly to 1.69 which seems to solve the problem as mentioned in the discussions in https://github.com/boostorg/serialization/issues/104 and https://github.com/boostorg/serialization/pull/131.
Of course, the scope of this issue has no effect on the consistency of the data serialized through the Bayeux I/O tools.
While exploring #36, one face a serious problem with some of Bayeux test programs which involve Boost based serialization (Ubuntu 18.04, GCC 7.3). The (de)serialization itself processes correctly after a few fixes due to some change in the management of XML archives. However, when the programs end, a segfault occurs at post-main scope. This is the list of failed tests:
Investigating the crash, we have the following stack trace:
Other tests give similar output. This looks a problem with the order of destruction of static objects provided by the library.