[Paraview] Segmentation Fault when using the vtkPVDReader

Sebastien Jourdain sebastien.jourdain at kitware.com
Thu Oct 23 13:51:40 EDT 2014


If you provide the stack trace, that may be helpful.

Seb

On Thu, Oct 23, 2014 at 10:36 AM, Bogdan Daqui Herrera <bdaqui at simscale.de>
wrote:

> Hi Seb,
>
> Thanks for the quick reply. Yes the project is managed with CMake. I have
> not however been able to find the relevant posts by Marcus (in the users
> list). Is
> that in the users or developers mailing list?
>
> It does sound like it could be a problem with some initialization, as you
> can see below.
>
> One short update, it looks like setting ForceMultiBlockDataSet Output with:
> pReader->SetForceOutputTypeToMultiBlock(1);
> leads to the segmentation fault at Update() (The deepcopy is never
> reached). With or without setting the previous line, the error
> vtkPVDReader (0x1cb49e0): Error creating "vtkXMLMultiBlockDataReader"
> using vtkPVInstantiator.
>
> The code looks like this now:
>         vtkSmartPointer < vtkPVDReader > pReader = vtkSmartPointer <
> vtkPVDReader >::New();
>         pReader->SetFileName("/some/file.pvd");
>         pReader->Update(); (where the error is triggered)
>
> Kind Regards,
> Bogdan
>
> On 10/23/2014 04:47 PM, Sebastien Jourdain wrote:
> > Hi Bogdan,
> >
> > here are some issue in your code:
> >
> > vtkSmartPointer <vtkPVDReader> pReader = vtkPVDReader::New(); // <==
> Memory LEAK
> > // Should be either
> > // vtkNew<vtkPVDReader> pReader;
> > // vtkSmartPointer<vtkPVDReader> pReader =
> vtkSmartPointer<vtkPVDReader>::New()
> >
> > Then here on a "NULL" object you try to call a method.
> >
> > vtkMultiBlockDataSet*
> pMultiBlockDataSet->DeepCopy(vtkMultiBlockDataSet::SafeDownCast(pReader->GetOutputDataObject(0)));
> >
> > Should be something like that:
> >
> > vtkNew< vtkMultiBlockDataSet > pMultiBlockDataSet;
> >
> pMultiBlockDataSet->DeepCopy(vtkMultiBlockDataSet::SafeDownCast(pReader->GetOutputDataObject(0)));
> >
> > Then you might have some other issue where pReader output being
> empty/null, but for that I don't know.
> >
> > Are you managing your project with CMake? Did you include the necessary
> file with the proper dependency declaration. This seems to be related to
> the factory not
> > being properly initialized. You can search the mailing list, Marcus did
> answer several questions about that.
> >
> > Seb
> >
> >
> >
> > On Thu, Oct 23, 2014 at 7:26 AM, Bogdan Daqui Herrera <
> bdaqui at simscale.de <mailto:bdaqui at simscale.de>> wrote:
> >
> >     Hello all,
> >
> >     I am attempting to write some code in c++ which uses the
> vtkPVDReader from the paraview library to read a series of vtm files.
> However I am encountering some
> >     problems and I am not sure whether there is something I am missing
> or whether this could be a bug.
> >
> >     I am trying to use the reader in the following manner:
> >     My Code:
> >             vtkSmartPointer <vtkPVDReader> pReader = vtkPVDReader::New();
> >             pReader->SetForceOutputTypeToMultiBlock(1);
> >             pReader->SetFileName("/some/fileName.pvd");
> >             pReader->Update();
> >             vtkMultiBlockDataSet*
> pMultiBlockDataSet->DeepCopy(vtkMultiBlockDataSet::SafeDownCast(pReader->GetOutputDataObject(0)));
> >
> >     Error:
> >             The error occurs at Update() with the following result:
> >             ERROR: In
> /misc/dn47/SALOME/PRODUCTS/7x/opt/Ubuntu.13.10.64/7.4.0/tmp/ParaView-4.1.0_SRC/ParaViewCore/VTKExtensions/Default
> >             /vtkXMLCollectionReader.cxx, line 316
> >             vtkPVDReader (0x224d9e0): Error creating
> "vtkXMLMultiBlockDataReader" using vtkPVInstantiator.
> >             Segmentation fault
> >
> >     Possible error Source
> >     The code concerning line 316 from vtkXMLCollectionReader.cxx is:
> >
> >           // Use the instantiator to create the reader.
> >           vtkObject* o = vtkPVInstantiator::CreateInstance(rname);
> >           vtkXMLReader* reader = vtkXMLReader::SafeDownCast(o);
> >           this->Internal->Readers[index] = reader;
> >           if(reader)
> >             {
> >             reader->Delete();
> >             }
> >           else
> >             {
> >             // The class was not registered with the instantiator.
> >             vtkErrorMacro("Error creating \"" << rname
> >                           << "\" using vtkPVInstantiator.");
> >             if(o)
> >               {
> >               o->Delete();
> >               }
> >             }
> >           }
> >
> >     I have isolated the following lines and tested them independently:
> >           vtkObject* o = vtkPVInstantiator::CreateInstance(rname);
> >           vtkXMLReader* reader = vtkXMLReader::SafeDownCast(o);
> >
> >     The pointer "vtkObject* o" is NULL regardless of the class name I
> pass to instantiate, and I can imagine something like that happening in the
> library, too and
> >     causing the segmentation fault, when calling a SafeDownCast(o)
> (which is NULL).
> >
> >
> >     Any suggestions on how to deal with this problem or if you would be
> so kind to point me to an example for an alternative solution (Could be
> vtkFileSeriesReader,
> >     but this fails, as well in my case) would be appreciated.
> >
> >     Kind Regards,
> >     Bogdan
> >
> >     P.S.: Using the PVDReader from python code works flawlessly, which
> is also quite confusing, as to why it would fail in the C++ code.
> >
> >     --
> >     Bogdan Daqui
> >     Software Development
> >
> >     SimScale GmbH
> >     Lichtenbergstraße 8
> >     85748 Garching bei München
> >
> >     Phone: +49 (0)89 3398 4078
> >     Email: bdaqui at simscale.de <mailto:bdaqui at simscale.de>
> >
> >     Amtsgericht München, HRB 201813
> >     Geschäftsführer: Vincenz Dölle & David Heiny
> >
> >     http://www.simscale.de
> >     _______________________________________________
> >     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://public.kitware.com/mailman/listinfo/paraview
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20141023/2c57b718/attachment-0001.html>


More information about the ParaView mailing list