MantisBT - VTK
View Issue Details
0010528VTK(No Category)public2010-04-09 10:112016-07-07 09:23
Paul Melis 
Andy Bauer 
normalcrashalways
closedfixed 
 
7.1.0 
0010528: vtkXMLUnstructuredGridWriter segfault
See the attached Python script which loads a polydata .vtp file containing only points and associated scalar arrays. The polydata gets clipped and then saved to a .vtu file, but a segfault occurs.
Save both files in the sample place, run bug.py
vtk 5.4.2

(gdb) bt
#0 0xb6785567 in vtkXMLUnstructuredDataWriter::ConvertCells () from /home/paulm/vtk/lib/vtk-5.4/libvtkIO.so.5.4
#1 0xb6786d56 in vtkXMLUnstructuredDataWriter::WriteCellsInline () from /home/paulm/vtk/lib/vtk-5.4/libvtkIO.so.5.4
#2 0xb678a0e8 in vtkXMLUnstructuredGridWriter::WriteInlinePiece () from /home/paulm/vtk/lib/vtk-5.4/libvtkIO.so.5.4
#3 0xb678710d in vtkXMLUnstructuredDataWriter::WriteInlineMode () from /home/paulm/vtk/lib/vtk-5.4/libvtkIO.so.5.4
#4 0xb678523a in vtkXMLUnstructuredDataWriter::WriteAPiece () from /home/paulm/vtk/lib/vtk-5.4/libvtkIO.so.5.4
#5 0xb6786286 in vtkXMLUnstructuredDataWriter::ProcessRequest () from /home/paulm/vtk/lib/vtk-5.4/libvtkIO.so.5.4
#6 0xb6b51512 in vtkExecutive::CallAlgorithm () from /home/paulm/vtk/lib/vtk-5.4/libvtkFiltering.so.5.4
#7 0xb6b48e4d in vtkDemandDrivenPipeline::ExecuteData () from /home/paulm/vtk/lib/vtk-5.4/libvtkFiltering.so.5.4
#8 0xb6b4c56b in vtkDemandDrivenPipeline::ProcessRequest () from /home/paulm/vtk/lib/vtk-5.4/libvtkFiltering.so.5.4
0000009 0xb6c5d7ed in vtkStreamingDemandDrivenPipeline::ProcessRequest () from /home/paulm/vtk/lib/vtk-5.4/libvtkFiltering.so.5.4
#10 0xb6b4ae3e in vtkDemandDrivenPipeline::UpdateData () from /home/paulm/vtk/lib/vtk-5.4/libvtkFiltering.so.5.4
0000011 0xb6c5d56b in vtkStreamingDemandDrivenPipeline::Update () from /home/paulm/vtk/lib/vtk-5.4/libvtkFiltering.so.5.4
#12 0xb6b50b33 in vtkExecutive::Update () from /home/paulm/vtk/lib/vtk-5.4/libvtkFiltering.so.5.4
#13 0xb6b496ad in vtkDemandDrivenPipeline::Update () from /home/paulm/vtk/lib/vtk-5.4/libvtkFiltering.so.5.4
#14 0xb6c5729d in vtkStreamingDemandDrivenPipeline::Update () from /home/paulm/vtk/lib/vtk-5.4/libvtkFiltering.so.5.4
#15 0xb6af0435 in vtkAlgorithm::Update () from /home/paulm/vtk/lib/vtk-5.4/libvtkFiltering.so.5.4
#16 0xb678e9d4 in vtkXMLWriter::Write () from /home/paulm/vtk/lib/vtk-5.4/libvtkIO.so.5.4
#17 0xb69305be in PyvtkXMLWriter_Write () from /home/paulm/vtk/lib/vtk-5.4/libvtkIOPythonD.so.5.4
#18 0x080c9ab3 in PyEval_EvalFrameEx (f=0x817747c, throwflag=0) at ../Python/ceval.c:3573
#19 0x080cb1f7 in PyEval_EvalCodeEx (co=0xb75449f8, globals=0xb7593acc, locals=0xb7593acc, args=0x0, argcount=0, kws=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0) at ../Python/ceval.c:2836
#20 0x080cb347 in PyEval_EvalCode (co=0xb75449f8, globals=0xb7593acc, locals=0xb7593acc) at ../Python/ceval.c:494
#21 0x080ea818 in PyRun_FileExFlags (fp=0x816b008, filename=0xbfcac33f "./bug.py", start=257, globals=0xb7593acc, locals=0xb7593acc, closeit=1, flags=0xbfcaaa98) at ../Python/pythonrun.c:1273
#22 0x080eaab9 in PyRun_SimpleFileExFlags (fp=0x816b008, filename=0xbfcac33f "./bug.py", closeit=1, flags=0xbfcaaa98) at ../Python/pythonrun.c:879
#23 0x08059335 in Py_Main (argc=1, argv=0xbfcaab64) at ../Modules/main.c:523
#24 0x080587f2 in main (argc=-1232770872, argv=0x2) at ../Modules/python.c:23
No tags attached.
? bug.py (446) 2010-04-09 10:11
https://www.vtk.org/Bug/file/8015/bug.py
? doh.vtp (1,109) 2010-04-09 10:11
https://www.vtk.org/Bug/file/8016/doh.vtp
Issue History
2010-04-09 10:11Paul MelisNew Issue
2010-04-09 10:11Paul MelisFile Added: bug.py
2010-04-09 10:11Paul MelisFile Added: doh.vtp
2010-04-20 17:17David DoriaNote Added: 0020302
2011-06-16 13:11Zack GalbreathCategory => (No Category)
2011-11-29 04:44Paul MelisNote Added: 0027742
2016-07-06 17:13Andy BauerAssigned To => Andy Bauer
2016-07-06 17:13Andy BauerStatusexpired => backlog
2016-07-07 09:22Andy BauerNote Added: 0036326
2016-07-07 09:22Andy BauerStatusbacklog => closed
2016-07-07 09:23Andy BauerResolutionopen => fixed
2016-07-07 09:23Andy BauerFixed in Version => 7.1.0

Notes
(0020302)
David Doria   
2010-04-20 17:17   
I tried it in c++ and got the same segfault.

Here is the code to reproduce in c++:

#include <vtkSmartPointer.h>
#include <vtkClipDataSet.h>
#include <vtkBox.h>
#include <vtkPolyData.h>
#include <vtkXMLPolyDataReader.h>
#include <vtkXMLUnstructuredGridWriter.h>
#include <vtkUnstructuredGrid.h>

int main (int argc, char *argv[])
{
  vtkSmartPointer<vtkXMLPolyDataReader> dr =
      vtkSmartPointer<vtkXMLPolyDataReader>::New();
  dr->SetFileName("doh.vtp");
  dr->Update();
  
  vtkSmartPointer<vtkBox> box =
      vtkSmartPointer<vtkBox>::New();
  box->SetBounds(0, 0.65, -0.982, 0.984, -1.03, -0.302);
  
  vtkSmartPointer<vtkClipDataSet> clip =
      vtkSmartPointer<vtkClipDataSet>::New();
  clip->SetInputConnection(dr->GetOutputPort());
  clip->SetClipFunction(box);
  clip->Update();
    
  vtkUnstructuredGrid* ug = clip->GetOutput();
  cout << ug->GetNumberOfPoints() << endl;
  
  vtkSmartPointer<vtkXMLUnstructuredGridWriter> dw =
      vtkSmartPointer<vtkXMLUnstructuredGridWriter>::New();
  dw->SetInputConnection(clip->GetOutputPort());
  dw->SetDataModeToAscii();
  dw->SetFileName("doh.vtu");
  dw->Write();

  
  return EXIT_SUCCESS;
}


If you comment
  dw->SetDataModeToAscii();

it does not segfault.
(0027742)
Paul Melis   
2011-11-29 04:44   
Still crashes with VTK 5.8.0
(0036326)
Andy Bauer   
2016-07-07 09:22   
Fixed in https://gitlab.kitware.com/vtk/vtk/merge_requests/1648#note_135580 [^]