[Paraview] RE : Catalyst : crash using vtkSmartPointers

Andy Bauer andy.bauer at kitware.com
Tue Aug 6 10:39:51 EDT 2013


Hi,

I think the only problem was that you needed to delete adaptor before
finalizing MPI. I attached my changes which do that.

Regards,
Andy

On Mon, Aug 5, 2013 at 8:46 AM, HOUSSEN Franck <Franck.Houssen at cea.fr>wrote:

>  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>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
>>
>> 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/20130806/b0a3f08f/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: files.tgz
Type: application/x-gzip
Size: 533 bytes
Desc: not available
URL: <http://www.paraview.org/pipermail/paraview/attachments/20130806/b0a3f08f/attachment-0001.bin>


More information about the ParaView mailing list