[Paraview] RE : Catalyst : crash using vtkSmartPointers

HOUSSEN Franck Franck.Houssen at cea.fr
Mon Aug 5 08:46:17 EDT 2013


It seems the crash occurs at Delete for both "regular" pointers and vtkSmartPointer ?!

Can someone reproduce the problem ? If yes, does somebody know what and where is the problem ?!

There are 4 situations :

1. pointer commented + smart pointer allocated but not used : no crash
~>more adaptor.cpp; cmake -DParaView_DIR:string=~/Programs/Paraview/ParaView-v4.0.1-build/local/lib/cmake/paraview-4.0 -DCMAKE_BUILD_TYPE=Debug .; make clean all; ./stupid
...
adaptor::adaptor ()
{
  _spProcessor = vtkSmartPointer<vtkCPProcessor>::New();
//  if ( _spProcessor ) _spProcessor -> Initialize ();
//  _pProcessor = vtkCPProcessor::New();
//  if ( _pProcessor ) _pProcessor -> Initialize ();
  cout << "adaptor OK" << endl;
}
adaptor::~adaptor ()
{
//  if ( _pProcessor ) _pProcessor -> Delete ();
}
...
[ 50%] Building CXX object CMakeFiles/stupid.dir/stupid.cpp.o
[100%] Building CXX object CMakeFiles/stupid.dir/adaptor.cpp.o
Linking CXX executable stupid
[100%] Built target stupid
adaptor OK
OK

2. pointer commented + smart pointer allocated and used : crash
...
adaptor::adaptor ()
{
  _spProcessor = vtkSmartPointer<vtkCPProcessor>::New();
  if ( _spProcessor ) _spProcessor -> Initialize ();
//  _pProcessor = vtkCPProcessor::New();
//  if ( _pProcessor ) _pProcessor -> Initialize ();
  cout << "adaptor OK" << endl;
}
adaptor::~adaptor ()
{
//  if ( _pProcessor ) _pProcessor -> Delete ();
}
...
[ 50%] Building CXX object CMakeFiles/stupid.dir/stupid.cpp.o
[100%] Building CXX object CMakeFiles/stupid.dir/adaptor.cpp.o
Linking CXX executable stupid
[100%] Built target stupid
adaptor OK
OK
*** The MPI_Comm_free() function was called after MPI_FINALIZE was invoked.
*** This is disallowed by the MPI standard.
*** Your MPI job will now abort.
[mdlslx07:16114] Abort after MPI_FINALIZE completed successfully; not able to guarantee that all other processes were killed!
*** The MPI_Comm_free() function was called after MPI_FINALIZE was invoked.
*** This is disallowed by the MPI standard.
*** Your MPI job will now abort.
*** The MPI_Comm_free() function was called after MPI_FINALIZE was invoked.
*** This is disallowed by the MPI standard.
*** Your MPI job will now abort.
[mdlslx07:16114] *** Process received signal ***
[mdlslx07:16114] Signal: Segmentation fault (11)
[mdlslx07:16114] Signal code: Address not mapped (1)
[mdlslx07:16114] Failing at address: 0x54
[mdlslx07:16114] [ 0] /lib/x86_64-linux-gnu/libc.so.6(+0x364a0) [0x7f4d2fc864a0]
[mdlslx07:16114] [ 1] /usr/lib/libmpi.so.0(ompi_errhandler_invoke+0x60) [0x7f4d30a0fd40]
[mdlslx07:16114] [ 2] /usr/lib/libmpi.so.0(PMPI_Comm_free+0x151) [0x7f4d30a3aaf1]
[mdlslx07:16114] [ 3] /home/fhoussen/Programs/Paraview/ParaView-v4.0.1-build/local/lib/paraview-4.0/libvtkParallelMPI-pv4.0.so.1(_ZN18vtkMPICommunicatorD1Ev+0x3f) [0x7f4d2d47412f]
[mdlslx07:16114] [ 4] /home/fhoussen/Programs/Paraview/ParaView-v4.0.1-build/local/lib/paraview-4.0/libvtkParallelMPI-pv4.0.so.1(_ZN18vtkMPICommunicatorD0Ev+0x9) [0x7f4d2d474179]
[mdlslx07:16114] [ 5] /home/fhoussen/Programs/Paraview/ParaView-v4.0.1-build/local/lib/paraview-4.0/libvtkParallelMPI-pv4.0.so.1(_ZN16vtkMPIController25InitializeRMICommunicatorEv+0x13) [0x7f4d2d47e9b3]
[mdlslx07:16114] [ 6] /home/fhoussen/Programs/Paraview/ParaView-v4.0.1-build/local/lib/paraview-4.0/libvtkParallelMPI-pv4.0.so.1(_ZN16vtkMPIControllerD2Ev+0x1d) [0x7f4d2d47eb1d]
[mdlslx07:16114] [ 7] /home/fhoussen/Programs/Paraview/ParaView-v4.0.1-build/local/lib/paraview-4.0/libvtkParallelMPI-pv4.0.so.1(_ZN16vtkMPIControllerD0Ev+0x9) [0x7f4d2d47eb69]
[mdlslx07:16114] [ 8] /lib/x86_64-linux-gnu/libc.so.6(__cxa_finalize+0x9d) [0x7f4d2fc8bd1d]
[mdlslx07:16114] [ 9] /home/fhoussen/Programs/Paraview/ParaView-v4.0.1-build/local/lib/paraview-4.0/libvtkPVClientServerCoreCore-pv4.0.so.1(+0x3d166) [0x7f4d2f0be166]
[mdlslx07:16114] *** End of error message ***

3. smart pointer commented + pointer allocated and used but not deleted : no crash
~>more adaptor.cpp; cmake -DParaView_DIR:string=~/Programs/Paraview/ParaView-v4.0.1-build/local/lib/cmake/paraview-4.0 -DCMAKE_BUILD_TYPE=Debug .; make clean all; ./stupid
...
adaptor::adaptor ()
{
//  _spProcessor = vtkSmartPointer<vtkCPProcessor>::New();
//  if ( _spProcessor ) _spProcessor -> Initialize ();
  _pProcessor = vtkCPProcessor::New();
  if ( _pProcessor ) _pProcessor -> Initialize ();
  cout << "adaptor OK" << endl;
}
adaptor::~adaptor ()
{
//  if ( _pProcessor ) _pProcessor -> Delete ();
}
...
[ 50%] Building CXX object CMakeFiles/stupid.dir/stupid.cpp.o
[100%] Building CXX object CMakeFiles/stupid.dir/adaptor.cpp.o
Linking CXX executable stupid
[100%] Built target stupid
adaptor OK
OK

3. smart pointer commented + pointer allocated and used and deleted : crash
~>more adaptor.cpp; cmake -DParaView_DIR:string=~/Programs/Paraview/ParaView-v4.0.1-build/local/lib/cmake/paraview-4.0 -DCMAKE_BUILD_TYPE=Debug .; make clean all; ./stupid
...
adaptor::adaptor ()
{
//  _spProcessor = vtkSmartPointer<vtkCPProcessor>::New();
//  if ( _spProcessor ) _spProcessor -> Initialize ();
  _pProcessor = vtkCPProcessor::New();
  if ( _pProcessor ) _pProcessor -> Initialize ();
  cout << "adaptor OK" << endl;
}
adaptor::~adaptor ()
{
  if ( _pProcessor ) _pProcessor -> Delete ();
}
...
[ 50%] Building CXX object CMakeFiles/stupid.dir/stupid.cpp.o
[100%] Building CXX object CMakeFiles/stupid.dir/adaptor.cpp.o
Linking CXX executable stupid
[100%] Built target stupid
adaptor OK
OK
*** The MPI_Comm_free() function was called after MPI_FINALIZE was invoked.
*** This is disallowed by the MPI standard.
*** Your MPI job will now abort.
[mdlslx07:16411] Abort after MPI_FINALIZE completed successfully; not able to guarantee that all other processes were killed!
*** The MPI_Comm_free() function was called after MPI_FINALIZE was invoked.
*** This is disallowed by the MPI standard.
*** Your MPI job will now abort.
*** The MPI_Comm_free() function was called after MPI_FINALIZE was invoked.
*** This is disallowed by the MPI standard.
*** Your MPI job will now abort.
[mdlslx07:16411] *** Process received signal ***
[mdlslx07:16411] Signal: Segmentation fault (11)
[mdlslx07:16411] Signal code: Address not mapped (1)
[mdlslx07:16411] Failing at address: 0x54
[mdlslx07:16411] [ 0] /lib/x86_64-linux-gnu/libc.so.6(+0x364a0) [0x7f462a7e24a0]
[mdlslx07:16411] [ 1] /usr/lib/libmpi.so.0(ompi_errhandler_invoke+0x60) [0x7f462b56bd40]
[mdlslx07:16411] [ 2] /usr/lib/libmpi.so.0(PMPI_Comm_free+0x151) [0x7f462b596af1]
[mdlslx07:16411] [ 3] /home/fhoussen/Programs/Paraview/ParaView-v4.0.1-build/local/lib/paraview-4.0/libvtkParallelMPI-pv4.0.so.1(_ZN18vtkMPICommunicatorD1Ev+0x3f) [0x7f4627fd012f]
[mdlslx07:16411] [ 4] /home/fhoussen/Programs/Paraview/ParaView-v4.0.1-build/local/lib/paraview-4.0/libvtkParallelMPI-pv4.0.so.1(_ZN18vtkMPICommunicatorD0Ev+0x9) [0x7f4627fd0179]
[mdlslx07:16411] [ 5] /home/fhoussen/Programs/Paraview/ParaView-v4.0.1-build/local/lib/paraview-4.0/libvtkParallelMPI-pv4.0.so.1(_ZN16vtkMPIController25InitializeRMICommunicatorEv+0x13) [0x7f4627fda9b3]
[mdlslx07:16411] [ 6] /home/fhoussen/Programs/Paraview/ParaView-v4.0.1-build/local/lib/paraview-4.0/libvtkParallelMPI-pv4.0.so.1(_ZN16vtkMPIControllerD2Ev+0x1d) [0x7f4627fdab1d]
[mdlslx07:16411] [ 7] /home/fhoussen/Programs/Paraview/ParaView-v4.0.1-build/local/lib/paraview-4.0/libvtkParallelMPI-pv4.0.so.1(_ZN16vtkMPIControllerD0Ev+0x9) [0x7f4627fdab69]
[mdlslx07:16411] [ 8] /lib/x86_64-linux-gnu/libc.so.6(__cxa_finalize+0x9d) [0x7f462a7e7d1d]
[mdlslx07:16411] [ 9] /home/fhoussen/Programs/Paraview/ParaView-v4.0.1-build/local/lib/paraview-4.0/libvtkPVClientServerCoreCore-pv4.0.so.1(+0x3d166) [0x7f4629c1a166]
[mdlslx07:16411] *** End of error message ***

I don't understand why this is crashing !?...

FH

________________________________
De : Andy Bauer [andy.bauer at kitware.com]
Date d'envoi : dimanche 4 août 2013 21:59
À : HOUSSEN Franck
Cc: paraview at paraview.org
Objet : Re: [Paraview] Catalyst : crash using vtkSmartPointers

Hi,

I didn't have any problems using a vtkSmartPointer for vtkCPProcessor. I'd have to see your full code to know for sure but my guess is that _spProcessor is a pointer to a vtkCPProcessor and not a vtkSmartPointer<vtkCPProcessor>. When I make that mistake I get a crash.

Regards,
Andy

On Sat, Aug 3, 2013 at 4:41 AM, HOUSSEN Franck <Franck.Houssen at cea.fr<mailto:Franck.Houssen at cea.fr>> wrote:
Hello,

I try to understand if (and how) I can use Catalyst for my need (in-situ visualisation). I started with : http://paraview.org/Wiki/ParaView/Catalyst/Overview

To code the adaptor, you need to handle VTK objects. When using VTK, I generally prefer to use smart pointers (avoid looking for leaks).
Here is my code (this is the only call / use of VTK object in the all code)
paraviewAdaptor::paraviewAdaptor ()
{
  _spProcessor = vtkSmartPointer<vtkCPProcessor>::New ();
//  _spProcessor -> Initialize (); // Crash if uncommented ?!
}
Compilation is OK, but at run time I get a crash with this error message :
*** The MPI_Comm_free() function was called after MPI_FINALIZE was invoked.
*** This is disallowed by the MPI standard.

So I tried to use pointers instead of smartpointers :
paraviewAdaptor::paraviewAdaptor ()
{
  _pProcessor = vtkCPProcessor::New ();
  _pProcessor -> Initialize (); // Don't crash ?!
}
And I don't get any crash anymore ?!....

Why is that ? How can I use vtkSmartPointers ?

Note : I use ParaView-v4.0.1-source.tgz and I run on Ubuntu 12.04

Thanks,

FH

_______________________________________________
Powered by www.kitware.com<http://www.kitware.com>

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20130805/6c06116e/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: adaptor.cpp
Type: text/x-c++src
Size: 458 bytes
Desc: adaptor.cpp
URL: <http://www.paraview.org/pipermail/paraview/attachments/20130805/6c06116e/attachment-0002.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: adaptor.h
Type: text/x-chdr
Size: 209 bytes
Desc: adaptor.h
URL: <http://www.paraview.org/pipermail/paraview/attachments/20130805/6c06116e/attachment-0001.h>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CMakeLists.txt
URL: <http://www.paraview.org/pipermail/paraview/attachments/20130805/6c06116e/attachment-0001.txt>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stupid.cpp
Type: text/x-c++src
Size: 198 bytes
Desc: stupid.cpp
URL: <http://www.paraview.org/pipermail/paraview/attachments/20130805/6c06116e/attachment-0003.cpp>


More information about the ParaView mailing list