You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by Gordon Sim <go...@gmail.com> on 2009/07/15 11:51:07 UTC

valgrind error in boost test framework

Anyone else using boost 1.37 and seeing the following error? Doesn't 
seem to be in our code at all.

==16352== Invalid read of size 4
==16352==    at 0x4044C87: 
boost::unit_test::framework_impl::~framework_impl() (in 
/usr/lib/libboost_unit_test_framework.so.1.37.0)
==16352==    by 0x841E0E: exit (in /lib/libc-2.10.1.so)
==16352==    by 0x829A6D: (below main) (in /lib/libc-2.10.1.so)
==16352==  Address 0x47b7374 is 20 bytes inside a block of size 24 free'd
==16352==    at 0x400576A: operator delete(void*) (vg_replace_malloc.c:342)
==16352==    by 0x403F1E2: 
boost::unit_test::framework::deregister_test_unit(boost::unit_test::test_unit*) 
(in /usr/lib/libboost_unit_test_framework.so.1.37.0)
==16352==    by 0x405CA1E: boost::unit_test::test_unit::~test_unit() (in 
/usr/lib/libboost_unit_test_framework.so.1.37.0)
==16352==    by 0x4044C86: 
boost::unit_test::framework_impl::~framework_impl() (in 
/usr/lib/libboost_unit_test_framework.so.1.37.0)
==16352==    by 0x841E0E: exit (in /lib/libc-2.10.1.so)
==16352==    by 0x829A6D: (below main) (in /lib/libc-2.10.1.so)
{
<insert a suppression name here>
    Memcheck:Addr4
    fun:_ZN5boost9unit_test14framework_implD1Ev
    fun:exit
    fun:(below main)
}


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


Re: valgrind error in boost test framework

Posted by Andrew Stitcher <as...@redhat.com>.
On Wed, 2009-07-15 at 10:51 +0100, Gordon Sim wrote:
> Anyone else using boost 1.37 and seeing the following error? Doesn't 
> seem to be in our code at all.

I've been seeing this since I upgraded to Fedora 11.

I'm not 100% sure this isn't caused by the way we link the unit_test
code:

There is a bizarre oddity in the version I get from valgrind with
debuginfo installed which implies that
boost::unit_test::framework_impl::~framework_impl() is being called
twice from different locations which might well explain the issue.

==4272== Invalid read of size 8
>>>> Note here in framework.ipp
==4272==    at 0x4C5EDF9:
boost::unit_test::framework_impl::~framework_impl() (framework.ipp:133)
>>>>
==4272==    by 0x3AC1E367F1: exit (in /lib64/libc-2.10.1.so)
==4272==    by 0x3AC1E1EA33: (below main) (in /lib64/libc-2.10.1.so)
==4272==  Address 0x6c90030 is 40 bytes inside a block of size 48 free'd
==4272==    at 0x4A05E3F: operator delete(void*)
(vg_replace_malloc.c:342)
==4272==    by 0x4C58D0C:
boost::unit_test::framework::deregister_test_unit(boost::unit_test::test_unit*) (new_allocator.h:100)
==4272==    by 0x4C761C1: boost::unit_test::test_unit::~test_unit()
(unit_test_suite.ipp:65)
>>>> Note here in unit_test_suite_impl.hpp
==4272==    by 0x4C5EDF8:
boost::unit_test::framework_impl::~framework_impl()
(unit_test_suite_impl.hpp:110)
>>>>
==4272==    by 0x3AC1E367F1: exit (in /lib64/libc-2.10.1.so)
==4272==    by 0x3AC1E1EA33: (below main) (in /lib64/libc-2.10.1.so)

This of course isn't exactly conclusive given the presence of inlines,
but it's suggestive and deserving of a little investigation.

It does appear to be harmless, so adding a suppression would be okay,
but it'd be better to understand that it really is a(nother) boost bug
before doing it.

I also note that the cmake build autoselects the -mt versions of the
boost 1.37 libs which shouldn't affect this, but perhaps might?

The autotools version isn't capable of figuring this out I don't think.

Andrew

> 
> ==16352== Invalid read of size 4
> ==16352==    at 0x4044C87: 
> boost::unit_test::framework_impl::~framework_impl() (in 
> /usr/lib/libboost_unit_test_framework.so.1.37.0)
> ==16352==    by 0x841E0E: exit (in /lib/libc-2.10.1.so)
> ==16352==    by 0x829A6D: (below main) (in /lib/libc-2.10.1.so)
> ==16352==  Address 0x47b7374 is 20 bytes inside a block of size 24 free'd
> ==16352==    at 0x400576A: operator delete(void*) (vg_replace_malloc.c:342)
> ==16352==    by 0x403F1E2: 
> boost::unit_test::framework::deregister_test_unit(boost::unit_test::test_unit*) 
> (in /usr/lib/libboost_unit_test_framework.so.1.37.0)
> ==16352==    by 0x405CA1E: boost::unit_test::test_unit::~test_unit() (in 
> /usr/lib/libboost_unit_test_framework.so.1.37.0)
> ==16352==    by 0x4044C86: 
> boost::unit_test::framework_impl::~framework_impl() (in 
> /usr/lib/libboost_unit_test_framework.so.1.37.0)
> ==16352==    by 0x841E0E: exit (in /lib/libc-2.10.1.so)
> ==16352==    by 0x829A6D: (below main) (in /lib/libc-2.10.1.so)
> {
> <insert a suppression name here>
>     Memcheck:Addr4
>     fun:_ZN5boost9unit_test14framework_implD1Ev
>     fun:exit
>     fun:(below main)
> }
> 
> 
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:dev-subscribe@qpid.apache.org
> 


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org