Boost logo

Boost Users :

From: Robert Mecklenburg (rmecklenburg_at_[hidden])
Date: 2008-08-20 15:43:26


Tim St. Clair writes:
> I'm running some serialization unit-tests which pass with flying colors
> under 1.35.0 and earlier, however they seg-fault on exit when run through
> 1.36.0.
> ...
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0xb73e26c0 (LWP 4715)]
> 0xb76bb56b in std::_Rb_tree_rebalance_for_erase () from
> /usr/lib/libstdc++.so.6

I am having similar problems, only there are no shared pointers
involved. I was getting this segv also, but as I pared the example
down and it mutated into a memory corruption problem:

    *** glibc detected *** ./serio: double free or corruption (fasttop): 0x0805c5c8 ***
    ======= Backtrace: =========
    /lib/tls/i686/cmov/libc.so.6[0xb7cd5a85]
    /lib/tls/i686/cmov/libc.so.6(cfree+0x90)[0xb7cd94f0]
    /usr/lib/libstdc++.so.6(_ZdlPv+0x21)[0xb7ea1b11]
    /home/mecklen/work/boost-install/lib/libboost_serialization-gcc42-mt-1_36.so.1.36.0(_ZN5boost13serialization6detail27extended_type_info_typeid_015type_unregisterEv+0xf6)[0xb7f3c8d6]
    ./serio(_ZN5boost13serialization25extended_type_info_typeidI4DataED1Ev+0x1c)[0x805576a]
    ./serio(__gxx_personality_v0+0x35e)[0x8053f36]
    /lib/tls/i686/cmov/libc.so.6(exit+0xd4)[0xb7c98084]
    /lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe8)[0xb7c80458]
    ./serio(__gxx_personality_v0+0x69)[0x8053c41]

The problem I'm experiencing only seems to occur when the class
implementation is in a shared library. I have attached a simple
example that reproduces the bug.

My system details are:

    Intel i686 cpu
    Ubuntu Hardy Heron
    g++ (GCC) 4.2.3 (Ubuntu 4.2.3-2ubuntu7)
    libstdc++6-4.2-dev 4.2.3-2ubuntu7
    Boost 1.36.0
    ./configure --prefix=/home/mecklen/work/boost-install \
        --without-libraries=python \
        --without-icu --without-mpi

This is a real show-stopper for us. Any help would be greatly
appreciated.

Thanks,

-- 
Robert

// g++ -I/home/mecklen/work/boost-install/include/boost-1_36 serio.cpp -o serio -L/home/mecklen/work/boost-install/lib/ -lboost_serialization-gcc42-mt -lboost_unit_test_framework-gcc42-mt

#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MAIN

#include <boost/test/auto_unit_test.hpp>
#include <boost/archive/text_oarchive.hpp>
#include <sstream>

struct Data
{
    Data() : n_(10) {}
    template <class Archive> void serialize(Archive & ar, const unsigned version);
    int n_;
};

BOOST_AUTO_TEST_CASE(serioTest)
{
    Data d;
    std::ostringstream os;
    boost::archive::text_oarchive oa(os);

    oa & d; // <<<<< Remove this and no crash.
}


#include <boost/archive/text_oarchive.hpp> // serialization::text_oarchive
#include <boost/serialization/export.hpp>

struct Data
{
    Data() : n_(10) {}
    template <class Archive> void serialize(Archive & ar, const unsigned version);
    int n_;
};

BOOST_CLASS_EXPORT(Data);

template <class Archive>
void
Data::serialize(Archive & ar, const unsigned /* version */)
{
    ar & n_;
}


#! /bin/bash -x
rm -f serioblob.o libserioblob.so serio.o serio

g++ -I/home/mecklen/work/boost-install/include/boost-1_36 serioblob.cpp -c -o serioblob.o

g++ -g -ftrapv -DBOOST_1_36_0 -I/home/mecklen/work/boost-install/include/boost-1_36 -DUSE_TRAPV -rdynamic -shared serioblob.o -L/home/mecklen/work/boost-install/lib/ -lboost_serialization-gcc42-mt -o libserioblob.so

g++ -I/home/mecklen/work/boost-install/include/boost-1_36 serio.cpp -c -o serio.o

g++ -g -ftrapv -DBOOST_1_36_0 -I/home/mecklen/work/boost-install/include/boost-1_36 -DUSE_TRAPV -rdynamic serio.o libserioblob.so /home/mecklen/work/boost-install/lib/libboost_unit_test_framework-gcc42-mt.so -L/home/mecklen/work/boost-install/lib/ -lboost_serialization-gcc42-mt -o serio

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/mecklen/work/boost-install/lib:.
./serio --catch_system_errors=no


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