[Insight-users] ITK crash on Lion/Qt
Christian Lackas
lackas at invicro.com
Fri Oct 14 16:50:03 EDT 2011
Hi Everybody,
we are experiencing strange problems with ITK (3.20.0) crashing in a
simple constructor, but only when used on Mac OS X 10.7 Lion and linked
with Qt.
I have now tried everything I could come up with to diagnose and debug
the issue and any help would be highly appreciated.
Here is the stack trace.
#0 0x00007fff93ad8ce2 in __pthread_kill ()
#1 0x00007fff948c17d2 in pthread_kill ()
#2 0x00007fff948b2a7a in abort ()
#3 0x00007fff9491184c in free ()
#4 0x000000010072c313 in itk::LightObject::~LightObject () at itkFiniteDifferenceFunction.h:195
#5 0x000000010072c7de in itk::LightObject::UnRegister () at itkFiniteDifferenceFunction.h:195
#6 0x000000010073d9ef in itk::SmartPointer<itk::MultiThreader>::UnRegister () at itkFiniteDifferenceFunction.h:195
#7 0x000000010073da07 in itk::SmartPointer<itk::MultiThreader>::~SmartPointer () at itkFiniteDifferenceFunction.h:195
#8 0x000000010073d768 in itk::ProcessObject::ProcessObject () at itkFiniteDifferenceFunction.h:195
#9 0x00000001002ffe1c in itk::ImageSource<itk::Image<float, 2u> >::ImageSource (this=0x109042ee0) at itkImageSource.txx:34
#10 0x00000001000596d0 in itk::ImageToImageFilter<itk::Image<float, 2u>, itk::Image<float, 2u> >::ImageToImageFilter (this=0x109042ee0) at itkImageToImageFilter.txx:33
#11 0x0000000100320bbc in itk::InPlaceImageFilter<itk::Image<float, 2u>, itk::Image<float, 2u> >::InPlaceImageFilter (this=0x109042ee0) at itkInPlaceImageFilter.txx:34
#12 0x0000000100320c04 in itk::FiniteDifferenceImageFilter<itk::Image<float, 2u>, itk::Image<float, 2u> >::FiniteDifferenceImageFilter (this=0x109042ee0) at itkFiniteDifferenceImageFilter.txx:30
#13 0x0000000100320da6 in itk::DenseFiniteDifferenceImageFilter<itk::Image<float, 2u>, itk::Image<float, 2u> >::DenseFiniteDifferenceImageFilter (this=0x109042ee0) at itkDenseFiniteDifferenceImageFilter.h:113
#14 0x00000001003377fc in itk::CurvatureFlowImageFilter<itk::Image<float, 2u>, itk::Image<float, 2u> >::CurvatureFlowImageFilter (this=0x109042ee0) at itkCurvatureFlowImageFilter.txx:31
#15 0x0000000100337a48 in itk::CurvatureFlowImageFilter<itk::Image<float, 2u>, itk::Image<float, 2u> >::New () at itkCurvatureFlowImageFilter.h:100
#16 0x0000000100475dea in main (argc=1, argv=0x7fff5fbff988) at main.cpp:15
#17 0x00000001000053ca in _start ()
#18 0x00000001000052d1 in start ()
This is our (strongly reduced) main.cpp file:
#include "itkImage.h"
#include "itkCurvatureFlowImageFilter.h"
#include <iostream>
int main(int argc, char *argv[]) {
std::cout << "#####: Crash site main.cpp" << std::endl;
typedef itk::Image<float, 2> PreviewImageType;
typedef itk::CurvatureFlowImageFilter<PreviewImageType, PreviewImageType>
PreviewFilterCurvatureType;
PreviewFilterCurvatureType *p = PreviewFilterCurvatureType::New();
std::cout << "p=" << p << std::endl;
}
We have no trouble with that program on Mac OS X 10.6 Snow Leopard (or
Windows), however, on Lion it crashes 6 out of 10 times (so it also does
not crash all the time, but very often). When it does crash, the stack
trace is always the same (for this code), though.
To make it more complicated, the same program when just linking to ITK
(no Qt, VTK, and a few other things we use) works 100%, e.g. using a
CMakeLists.txt like:
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT ( crash )
FIND_PACKAGE(ITK REQUIRED)
IF(ITK_FOUND)
INCLUDE(${ITK_USE_FILE})
ELSE(ITK_FOUND)
MESSAGE(FATAL_ERROR "Set ITK_DIR")
ENDIF(ITK_FOUND)
ADD_EXECUTABLE(crash crash.cxx)
TARGET_LINK_LIBRARIES(crash ${ITK_LIBRARIES})
SET(CMAKE_BUILD_TYPE Release)
So it must be something we link to the executable (or a compiler option)
that triggers a problem in ITK (we have not seen strange behavior in
other parts, e.g. Qt behaves normal, as does VTK and a few other
libraries). Please note, that it also crashes if we have the
PreviewFilterCurvatureType::New() call right at the start of main(), so
we don't have any memory corruption in our code causing the crash in
ITK. And as said, the same compile executable works perfectly on Snow
Leopard, so it must be Lion-related.
What could cause this issue and what could I do to further debug it?
One problem here is that the crash sometimes disappears (i.e. no crashes
in a couple dozen runs of above program), and nothing apparently has
changed.
Thank you very much for your time and any hint you can give us!
Christian
A few more details: We are using
* ITK 3.20.0 (we have the issue with 3.18.0 also, though)
* Qt 4.7.4, 4.8.0rc1
* VTK 5.6
* cc is the Apple gcc 4.2.1 (either from Snow Leopard or from Lion)
--
Dr. Christian Lackas, Managing Partner
inviCRO, LLC -- In Imaging Yours
P: +1 617 933 8733, F: +49 2203 9034722, E: lackas at invicro.com
http://www.invicro.com/ http://www.spect-ct.com/
More information about the Insight-users
mailing list