[Insight-users] ITK crash on Lion/Qt
Christian Lackas
lackas at invicro.com
Tue Oct 18 10:39:43 EDT 2011
* Nicolas Rannou <nicolas.lists at gmail.com> [111018 15:59]:
Hi Nicolas,
thanks for your feedback.
> We had a similar issue.
> In shared mode, ITK-related code was crashing in our application on 10.5
> cocoa and 10.7.
What do you mean by shared code?
> We didn't figure out what is wrong yet but:
> From your experience, it sounds like it is related to Qt and CMake.
For the minimal example I was able to produce, the crash went away when
I changed MACOSX_DEPLOYMENT_TARGET from 10.4 to 10.5 in Qt's qmake
Makefiles (which is not set in CMake Makefiles. Other than that I don't
see ITK crash in standalone programs, but I still do in our application
(which uses Qt, VTK, dcmtk, ImageMagick, and a couple of other things).
So something external must trigger this problem in ITK, in the same way
that MACOSX_DEPLOYMENT_TARGET=10.4 triggers it in ITK-only programs.
I just lack the knowledge to find the cause, since this seems to be on a
level below the C++ I feel familiar with.
I was not successful with gathering any information using libgmalloc
(did not crash when using that malloc, whatever that means) nor
malloc_history (what's the addr parameter it needs?).
> Qt is not supported on 10.7 yet, so you might want to wait for the
> next release...
It's true, Qt 4.7.4 for instance emits a warning, however, we have not
experienced any other issues and we run in the same issue with Qt
4.8.0rc1 (which does support Lion officially).
Also, we do NOT see any random crashes in various places, but rather
only in ITK's SmartPointer code. My guess is, this is related to the
mutex locking.
> Do you know if the OSX 10.7 installation is a "clean" one (installed
> from scratch) or an update from 10.6?
One system was clean, the other one was upgraded. With MallocScribble
on, we see the same behavior on 10.6 also, which suggests its a general
issue on Mac.
Christian
--
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/
> On Tue, Oct 18, 2011 at 9:14 AM, Christian Lackas <lackas at invicro.com>wrote:
>
> > * Sean McBride <sean at rogue-research.com> [111014 23:46]:
> >
> > Hi Sean, Everybody,
> >
> > > If you're dying in free() it's probably because of a memory error.
> > > You could try enabling MallocScribble and friends (see 'man malloc')
> > > and/or guard malloc (see 'man libgmalloc').
> >
> > thanks for your suggestions. They gave me a few more ideas on how to
> > look at the problem.
> >
> > > Does it work if you build in 10.6 and run that executable in 10.7? If
> > > so, it could be related to SDK and deployment target choice.
> >
> > It does not matter where it is build.
> > However, thanks to MallocScribble, I now also get it to crash on Snow
> > Leopard (which makes development much easier for me, since I have not
> > upgraded yet).
> >
> > > Is there nothing in the console? Failures in malloc/free often log
> > something.
> >
> > Nothing on the console.
> >
> > When trying to understand the source of memory issue, I reduced the
> > example to a minimum, basically just a main() with a call like this:
> >
> > PreviewFilterCurvatureType *p = PreviewFilterCurvatureType::New();
> >
> > An complete project is available here (just set ITK_DIR env variable to
> > your ITK build directory):
> >
> > http://www.invicro.com/vtk/itkcrash.tgz
> >
> > If I do (see run.sh):
> >
> > qmake && make clean && make && MallocScribble=1
> > ./crash.app/Contents/MacOS/crash
> >
> > I get this crash:
> >
> > #0 0x000000010000afb6 in
> > itk::SmartPointer<itk::CurvatureFlowFunction<itk::Image<float, 2u> >
> > >::Register (this=0x7fff5fbff040) at itkSmartPointer.h:142
> > #1 0x000000010000b004 in
> > itk::SmartPointer<itk::CurvatureFlowFunction<itk::Image<float, 2u> >
> > >::operator= (this=0x7fff5fbff040, r=0x101510a80) at itkSmartPointer.h:122
> > #2 0x000000010000b04b in
> > itk::SmartPointer<itk::CurvatureFlowFunction<itk::Image<float, 2u> >
> > >::operator= (this=0x7fff5fbff040, r=@0x7fff5fbff050) at
> > itkSmartPointer.h:113
> > #3 0x000000010002114a in
> > itk::CurvatureFlowImageFilter<itk::Image<float, 2u>, itk::Image<float, 2u>
> > >::CurvatureFlowImageFilter (this=0x101510540) at
> > itkCurvatureFlowImageFilter.txx:38
> > #4 0x0000000100021208 in
> > itk::CurvatureFlowImageFilter<itk::Image<float, 2u>, itk::Image<float, 2u>
> > >::New () at itkCurvatureFlowImageFilter.h:100 #5 0x000000010000aa20 in
> > main (argc=1, argv=0x7fff5fbff158) at crash.cxx:15
> >
> > Attached below is the output for the LightObject on which it tries to call
> > Register(), which seems to be uninitialized.
> >
> > Interestingly, it only crashed when using qmake, not when building a
> > similar cmake build script. In the end I found that the problem was a
> >
> > export MACOSX_DEPLOYMENT_TARGET = 10.4
> >
> > in the qmake produced makefile, and setting this to 10.5 fixed it for
> > the small example.
> > Can anybody please tell me why it crashes with the 10.4 setting? I was
> > not able to figure that part out. I could not figure out how to use
> > malloc_history(1), yet.
> >
> > Unfortunately, our main application still crashes in the
> > PreviewFilterCurvatureType::New(), even with the 10.5 setting, and since
> > I believe this is related (although not exactly the same) as the minimal
> > example above, I wonder if anybody can give me another pointer on how to
> > debug this.
> >
> > Sean, could you please try the minimal example and give me a hint on how
> > I would debug the actual cause of the problem there?
> >
> > Is this a compiler issue? An ITK issue? Or what else?
> >
> > Thanks,
> > Christian
> >
> >
> > (gdb) p *m_Pointer
> > $2 = {
> > <itk::FiniteDifferenceFunction<itk::Image<float, 2u> >> = {
> > <itk::LightObject> = {
> > _vptr$LightObject = 0x5555555555555555,
> > m_ReferenceCount = 1431655765,
> > m_ReferenceCountLock = {
> > m_FastMutexLock = {
> > __sig = 6148914691236517205,
> > __opaque = 'U' <repeats 56 times>
> > }
> > }
> > },
> > members of itk::FiniteDifferenceFunction<itk::Image<float, 2u> >:
> > m_Radius = {
> > m_Size = {6148914691236517205, 6148914691236517205}
> > },
> > m_ScaleCoefficients = {1.1945305291614955e+103, 1.1945305291614955e+103}
> > },
> > members of itk::CurvatureFlowFunction<itk::Image<float, 2u> >:
> > m_TimeStep = 1.1945305291614955e+103
> > }
> >
> >
> > --
> > 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