[Ctk-developers] Crash in ~OFCondition()

Julien Finet julien.finet at kitware.com
Thu Feb 16 12:11:27 EST 2012


Hi Jorg,

Nice job, I tried the head of DCMTK, and the OfCondition crash disappeared.
However I'm experiencing another crash. I can reproduce in my small program
(ofConditionCrash) and in the test application ctkDICOM in CTK.

This is very odd, a static OFList is instantiated twice with the same
address  and deleted twice at the same address, therefore a crash. See
below the backtrace when I place a breakpoint in OFList() and ~OFList().
Note that the address is always the same (0xa6ea70). Btw, the address is a
32bits address, does it mean DCMTK is built in 32bits ?

I tried with a clean build of CTK. Can you eventually try that CTK branch
https://github.com/finetjul/CTK/tree/dcmtk-trunk  and see if you have a
crash when running ctkDICOM ?

Thanks,
Julien.

At startup:

First time the OFList at address 0xa6ea70 is constructed:

Breakpoint 1, OFList<DcmCodecList*>::OFList (this=0xa6ea70)
    at
/home/julien/Work/CTK/CTK-noPython/DCMTK/ofstd/include/dcmtk/ofstd/oflist.h:330
330        OFList() : OFListBase() { }
(gdb) backtrace
#0  OFList<DcmCodecList*>::OFList (this=0xa6ea70)
    at
/home/julien/Work/CTK/CTK-noPython/DCMTK/ofstd/include/dcmtk/ofstd/oflist.h:330
#1  0x00007ffff5711005 in __static_initialization_and_destruction_0 (
    __initialize_p=1, __priority=65535)
    at /home/julien/Work/CTK/CTK-noPython/DCMTK/dcmdata/libsrc/dccodec.cc:43
#2  0x00007ffff5711069 in _GLOBAL__sub_I_dccodec.cc(void) ()
    at
/home/julien/Work/CTK/CTK-noPython/DCMTK/dcmdata/libsrc/dccodec.cc:652
#3  0x00007ffff7deab26 in ?? () from /lib64/ld-linux-x86-64.so.2
#4  0x00007ffff7deabff in ?? () from /lib64/ld-linux-x86-64.so.2
#5  0x00007ffff7ddd5ea in ?? () from /lib64/ld-linux-x86-64.so.2
#6  0x0000000000000001 in ?? ()
#7  0x00007fffffffe507 in ?? ()
#8  0x0000000000000000 in ?? ()

Second time the OFList at address 0xa6ea70 is constructed

Breakpoint 1, OFList<DcmCodecList*>::OFList (this=0xa6ea70)
    at
/home/julien/Work/CTK/CTK-noPython/DCMTK/ofstd/include/dcmtk/ofstd/oflist.h:330
330        OFList() : OFListBase() { }
(gdb) backtrace
#0  OFList<DcmCodecList*>::OFList (this=0xa6ea70)
    at
/home/julien/Work/CTK/CTK-noPython/DCMTK/ofstd/include/dcmtk/ofstd/oflist.h:330
#1  0x00000000006f997d in __static_initialization_and_destruction_0 (
    __initialize_p=1, __priority=65535)
    at /home/julien/Work/CTK/CTK-noPython/DCMTK/dcmdata/libsrc/dccodec.cc:43
#2  0x00000000006f99e1 in _GLOBAL__sub_I_dccodec.cc(void) ()
    at
/home/julien/Work/CTK/CTK-noPython/DCMTK/dcmdata/libsrc/dccodec.cc:652
#3  0x00000000007469ed in __libc_csu_init ()
#4  0x00007ffff5be92a0 in __libc_start_main ()
   from /lib/x86_64-linux-gnu/libc.so.6
#5  0x00000000004b0fd9 in _start ()

When the application exits:

First time it gets into the destructor:

Breakpoint 2, OFListBase::~OFListBase (this=0xa6ea70,
    __in_chrg=<optimized out>)
    at /home/julien/Work/CTK/CTK-noPython/DCMTK/ofstd/libsrc/oflist.cc:54
54            delete afterLast;
(gdb) backtrace
#0  OFListBase::~OFListBase (this=0xa6ea70, __in_chrg=<optimized out>)
    at /home/julien/Work/CTK/CTK-noPython/DCMTK/ofstd/libsrc/oflist.cc:54
#1  0x00000000006f9cc8 in OFList<DcmCodecList*>::~OFList (this=0xa6ea70,
    __in_chrg=<optimized out>)
    at
/home/julien/Work/CTK/CTK-noPython/DCMTK/ofstd/include/dcmtk/ofstd/oflist.h:291
#2  0x00007ffff5c03821 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#3  0x00007ffff5c038a5 in exit () from /lib/x86_64-linux-gnu/libc.so.6
#4  0x00007ffff5be9314 in __libc_start_main ()
   from /lib/x86_64-linux-gnu/libc.so.6
#5  0x00000000004b0fd9 in _start ()

Second time it gets into the destructor:

(gdb) backtrace
#0  OFListBase::~OFListBase (this=0xa6ea70, __in_chrg=<optimized out>)
    at /home/julien/Work/CTK/CTK-noPython/DCMTK/ofstd/libsrc/oflist.cc:54
#1  0x00000000006f9cc8 in OFList<DcmCodecList*>::~OFList (this=0xa6ea70,
    __in_chrg=<optimized out>)
    at
/home/julien/Work/CTK/CTK-noPython/DCMTK/ofstd/include/dcmtk/ofstd/oflist.h:291
#2  0x00007ffff5c03c3d in __cxa_finalize ()
   from /lib/x86_64-linux-gnu/libc.so.6
#3  0x00007ffff5473e06 in __do_global_dtors_aux ()
   from
/home/julien/Work/CTK/CTK-noPython/CTK-build/bin/libCTKDICOMCore.so.0.1
#4  0x00007fffffffdf00 in ?? ()
#5  0x00007fffffffe140 in ?? ()
#6  0x00007ffff5839ff1 in _fini ()
   from
/home/julien/Work/CTK/CTK-noPython/CTK-build/bin/libCTKDICOMCore.so.0.1
#7  0x00007fffffffe140 in ?? ()
#8  0x00007ffff7deb105 in ?? () from /lib64/ld-linux-x86-64.so.2
Backtrace stopped: previous frame inner to this frame (corrupt stack?)


This then leads to the following crash:

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000031 in ?? ()
(gdb) up
#1  0x000000000073cb8b in OFListBase::~OFListBase (this=0xa6ea70,
    __in_chrg=<optimized out>)
    at /home/julien/Work/CTK/CTK-noPython/DCMTK/ofstd/libsrc/oflist.cc:54
54            delete afterLast;
(gdb) backtrace
#0  0x0000000000000031 in ?? ()
#1  0x000000000073cb8b in OFListBase::~OFListBase (this=0xa6ea70,
    __in_chrg=<optimized out>)
    at /home/julien/Work/CTK/CTK-noPython/DCMTK/ofstd/libsrc/oflist.cc:54
#2  0x00000000006f9cc8 in OFList<DcmCodecList*>::~OFList (this=0xa6ea70,
    __in_chrg=<optimized out>)
    at
/home/julien/Work/CTK/CTK-noPython/DCMTK/ofstd/include/dcmtk/ofstd/oflist.h:291
#3  0x00007ffff5c03c3d in __cxa_finalize ()
   from /lib/x86_64-linux-gnu/libc.so.6
#4  0x00007ffff5473e06 in __do_global_dtors_aux ()
   from
/home/julien/Work/CTK/CTK-noPython/CTK-build/bin/libCTKDICOMCore.so.0.1
#5  0x00007fffffffdf00 in ?? ()
#6  0x00007fffffffe140 in ?? ()
#7  0x00007ffff5839ff1 in _fini ()
   from
/home/julien/Work/CTK/CTK-noPython/CTK-build/bin/libCTKDICOMCore.so.0.1
#8  0x00007fffffffe140 in ?? ()
#9  0x00007ffff7deb105 in ?? () from /lib64/ld-linux-x86-64.so.2
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

On Wed, Feb 15, 2012 at 3:54 PM, Jörg Riesmeier <riesmeier at icsmed.de> wrote:

> Julien,
>
> > Anyway, when you guys rewrite the OfCondition code, can you please try to
> > build DCMTK in CTK and test the ofConditionCrash project
>
> I just did that on the same machine as last time: Now it works :-)
>
> Regards,
> Jörg
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/ctk-developers/attachments/20120216/18a9917b/attachment.html>


More information about the Ctk-developers mailing list