cyclus/core — Issue #56: Seg Fault on Logging Debug Level 5 (Memory)
Author: gidden
Created: 2012-03-07 19:47:19+00:00
State: open
Labels: Bug, Investigate

@rwcarlsen Robert, I've assigned this issue to you because it deals with memory logging. If you think that's not appropriate, please let me know.

A seg fault has been introduced with the Table class. It *only* occurs when using the flag -v LEV_DEBUG5.

The Table class uses a boost::intrusive_ptr. I have implemented this as it is implemented in other classes, e.g. the Message class.

It is not clear to me why the seg fault occurs; however, it appears to be occurring when there is logging of type "memory".

If this is due to an issue with one of my new classes, I would like to learn why. If it is not, then a bug has been found and can be mended.

The valgrind output is as follows:

==19376== Invalid read of size 8
==19376== at 0x56D6558: std::string::assign(std::string const&) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16)
==19376== by 0x4C9165: Logger::ToString(LogLevel) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x4C88A6: Logger::Get(LogLevel, std::string) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x493C4F: intrusive_ptr_release(Table const*) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x4922FE: boost::intrusive_ptr

::~intrusive_ptr() (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x5E0E820: __run_exit_handlers (exit.c:78)
==19376== by 0x5E0E8A4: exit (exit.c:100)
==19376== by 0x5DF4313: (below main) (libc-start.c:258)
==19376== Address 0x65a90d8 is 88 bytes inside a block of size 128 free'd
==19376== at 0x4C27FF2: operator delete(void*) (vg_replace_malloc.c:387)
==19376== by 0x494FF1: __gnu_cxx::new_allocator::deallocate(std::string*, unsigned long) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x493407: std::_Vector_base >::_M_deallocate(std::string*, unsigned long) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x492FC6: std::_Vector_base >::~_Vector_base() (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x491CAF: std::vector >::~vector() (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x5E0E820: __run_exit_handlers (exit.c:78)
==19376== by 0x5E0E8A4: exit (exit.c:100)
==19376== by 0x5DF4313: (below main) (libc-start.c:258)
==19376==
==19376== Invalid read of size 4
==19376== at 0x56D656B: std::string::assign(std::string const&) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16)
==19376== by 0x4C9165: Logger::ToString(LogLevel) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x4C88A6: Logger::Get(LogLevel, std::string) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x493C4F: intrusive_ptr_release(Table const*) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x4922FE: boost::intrusive_ptr

::~intrusive_ptr() (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x5E0E820: __run_exit_handlers (exit.c:78)
==19376== by 0x5E0E8A4: exit (exit.c:100)
==19376== by 0x5DF4313: (below main) (libc-start.c:258)
==19376== Address 0x65a95d0 is 16 bytes inside a block of size 31 free'd
==19376== at 0x4C27FF2: operator delete(void*) (vg_replace_malloc.c:387)
==19376== by 0x56D51E2: std::basic_string, std::allocator >::~basic_string() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16)
==19376== by 0x49867A: void std::_Destroy(std::string*) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x496E59: void std::_Destroy_aux::__destroy(std::string*, std::string*) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x494E1E: void std::_Destroy(std::string*, std::string*) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x493028: void std::_Destroy(std::string*, std::string*, std::allocator&) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x491CA3: std::vector >::~vector() (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x5E0E820: __run_exit_handlers (exit.c:78)
==19376== by 0x5E0E8A4: exit (exit.c:100)
==19376== by 0x5DF4313: (below main) (libc-start.c:258)
==19376==
==19376== Invalid read of size 8
==19376== at 0x56D5DB9: std::string::_Rep::_M_clone(std::allocator const&, unsigned long) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16)
==19376== by 0x56D65A3: std::string::assign(std::string const&) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16)
==19376== by 0x4C9165: Logger::ToString(LogLevel) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x4C88A6: Logger::Get(LogLevel, std::string) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x493C4F: intrusive_ptr_release(Table const*) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x4922FE: boost::intrusive_ptr

::~intrusive_ptr() (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x5E0E820: __run_exit_handlers (exit.c:78)
==19376== by 0x5E0E8A4: exit (exit.c:100)
==19376== by 0x5DF4313: (below main) (libc-start.c:258)
==19376== Address 0x65a95c0 is 0 bytes inside a block of size 31 free'd
==19376== at 0x4C27FF2: operator delete(void*) (vg_replace_malloc.c:387)
==19376== by 0x56D51E2: std::basic_string, std::allocator >::~basic_string() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16)
==19376== by 0x49867A: void std::_Destroy(std::string*) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x496E59: void std::_Destroy_aux::__destroy(std::string*, std::string*) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x494E1E: void std::_Destroy(std::string*, std::string*) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x493028: void std::_Destroy(std::string*, std::string*, std::allocator&) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x491CA3: std::vector >::~vector() (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x5E0E820: __run_exit_handlers (exit.c:78)
==19376== by 0x5E0E8A4: exit (exit.c:100)
==19376== by 0x5DF4313: (below main) (libc-start.c:258)
==19376==
==19376== Invalid read of size 8
==19376== at 0x56D5DBF: std::string::_Rep::_M_clone(std::allocator const&, unsigned long) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16)
==19376== by 0x56D65A3: std::string::assign(std::string const&) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16)
==19376== by 0x4C9165: Logger::ToString(LogLevel) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x4C88A6: Logger::Get(LogLevel, std::string) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x493C4F: intrusive_ptr_release(Table const*) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x4922FE: boost::intrusive_ptr

::~intrusive_ptr() (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x5E0E820: __run_exit_handlers (exit.c:78)
==19376== by 0x5E0E8A4: exit (exit.c:100)
==19376== by 0x5DF4313: (below main) (libc-start.c:258)
==19376== Address 0x65a95c8 is 8 bytes inside a block of size 31 free'd
==19376== at 0x4C27FF2: operator delete(void*) (vg_replace_malloc.c:387)
==19376== by 0x56D51E2: std::basic_string, std::allocator >::~basic_string() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16)
==19376== by 0x49867A: void std::_Destroy(std::string*) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x496E59: void std::_Destroy_aux::__destroy(std::string*, std::string*) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x494E1E: void std::_Destroy(std::string*, std::string*) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x493028: void std::_Destroy(std::string*, std::string*, std::allocator&) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x491CA3: std::vector >::~vector() (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x5E0E820: __run_exit_handlers (exit.c:78)
==19376== by 0x5E0E8A4: exit (exit.c:100)
==19376== by 0x5DF4313: (below main) (libc-start.c:258)
==19376==
==19376== Invalid read of size 8
==19376== at 0x56D5DCB: std::string::_Rep::_M_clone(std::allocator const&, unsigned long) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16)
==19376== by 0x56D65A3: std::string::assign(std::string const&) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16)
==19376== by 0x4C9165: Logger::ToString(LogLevel) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x4C88A6: Logger::Get(LogLevel, std::string) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x493C4F: intrusive_ptr_release(Table const*) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x4922FE: boost::intrusive_ptr

::~intrusive_ptr() (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x5E0E820: __run_exit_handlers (exit.c:78)
==19376== by 0x5E0E8A4: exit (exit.c:100)
==19376== by 0x5DF4313: (below main) (libc-start.c:258)
==19376== Address 0x65a95c0 is 0 bytes inside a block of size 31 free'd
==19376== at 0x4C27FF2: operator delete(void*) (vg_replace_malloc.c:387)
==19376== by 0x56D51E2: std::basic_string, std::allocator >::~basic_string() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16)
==19376== by 0x49867A: void std::_Destroy(std::string*) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x496E59: void std::_Destroy_aux::__destroy(std::string*, std::string*) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x494E1E: void std::_Destroy(std::string*, std::string*) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x493028: void std::_Destroy(std::string*, std::string*, std::allocator&) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x491CA3: std::vector >::~vector() (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x5E0E820: __run_exit_handlers (exit.c:78)
==19376== by 0x5E0E8A4: exit (exit.c:100)
==19376== by 0x5DF4313: (below main) (libc-start.c:258)
==19376==
==19376== Invalid read of size 1
==19376== at 0x4C2A2F8: memcpy (mc_replace_strmem.c:635)
==19376== by 0x56D5E11: std::string::_Rep::_M_clone(std::allocator const&, unsigned long) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16)
==19376== by 0x56D65A3: std::string::assign(std::string const&) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16)
==19376== by 0x4C9165: Logger::ToString(LogLevel) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x4C88A6: Logger::Get(LogLevel, std::string) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x493C4F: intrusive_ptr_release(Table const*) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x4922FE: boost::intrusive_ptr

::~intrusive_ptr() (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x5E0E820: __run_exit_handlers (exit.c:78)
==19376== by 0x5E0E8A4: exit (exit.c:100)
==19376== by 0x5DF4313: (below main) (libc-start.c:258)
==19376== Address 0x65a95dd is 29 bytes inside a block of size 31 free'd
==19376== at 0x4C27FF2: operator delete(void*) (vg_replace_malloc.c:387)
==19376== by 0x56D51E2: std::basic_string, std::allocator >::~basic_string() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16)
==19376== by 0x49867A: void std::_Destroy(std::string*) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x496E59: void std::_Destroy_aux::__destroy(std::string*, std::string*) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x494E1E: void std::_Destroy(std::string*, std::string*) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x493028: void std::_Destroy(std::string*, std::string*, std::allocator&) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x491CA3: std::vector >::~vector() (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x5E0E820: __run_exit_handlers (exit.c:78)
==19376== by 0x5E0E8A4: exit (exit.c:100)
==19376== by 0x5DF4313: (below main) (libc-start.c:258)
==19376==
==19376== Invalid read of size 8
==19376== at 0x56D5E12: std::string::_Rep::_M_clone(std::allocator const&, unsigned long) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16)
==19376== by 0x56D65A3: std::string::assign(std::string const&) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16)
==19376== by 0x4C9165: Logger::ToString(LogLevel) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x4C88A6: Logger::Get(LogLevel, std::string) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x493C4F: intrusive_ptr_release(Table const*) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x4922FE: boost::intrusive_ptr

::~intrusive_ptr() (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x5E0E820: __run_exit_handlers (exit.c:78)
==19376== by 0x5E0E8A4: exit (exit.c:100)
==19376== by 0x5DF4313: (below main) (libc-start.c:258)
==19376== Address 0x65a95c0 is 0 bytes inside a block of size 31 free'd
==19376== at 0x4C27FF2: operator delete(void*) (vg_replace_malloc.c:387)
==19376== by 0x56D51E2: std::basic_string, std::allocator >::~basic_string() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16)
==19376== by 0x49867A: void std::_Destroy(std::string*) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x496E59: void std::_Destroy_aux::__destroy(std::string*, std::string*) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x494E1E: void std::_Destroy(std::string*, std::string*) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x493028: void std::_Destroy(std::string*, std::string*, std::allocator&) (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x491CA3: std::vector >::~vector() (in /home/gidden/work/cyclus/build/cyclus)
==19376== by 0x5E0E820: __run_exit_handlers (exit.c:78)
==19376== by 0x5E0E8A4: exit (exit.c:100)
==19376== by 0x5DF4313: (below main) (libc-start.c:258)