[vtkusers] Leak + Segfault in XML Image Reader

Kevin H. Hobbs hobbsk at ohiou.edu
Mon Oct 2 11:03:01 EDT 2006


I've been seeing segfaults while reading some XML Images. The number of
streamed pieces seems to matter. I've attached example code. I've run
the program in both ddd and valgrind.

valgrind tells me that there are leaks whenever there are streamed
pieces. ddd tells me that the segfault happens after several pieces are
read.

I've mentioned this before in bug #3363 :
http://www.vtk.org/Bug/bug.php?op=show&bugid=3363&pos=2


####################
# valgrind 1 piece #
####################

[kevin at gargon huge_streamed_test]$ valgrind --leak-check=full --show-reachable=yes ./streamed_test 10 10 10 1
==31900== Memcheck, a memory error detector.
==31900== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
==31900== Using LibVEX rev 1471, a library for dynamic binary translation.
==31900== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP.
==31900== Using valgrind-3.1.0, a dynamic binary instrumentation framework.
==31900== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
==31900== For more details, rerun with: -v
==31900==
--31900-- WARNING: unhandled syscall: 273
--31900-- You may be able to write your own handler.
--31900-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
Now we have a big VTI image.
Now we have a 2nd big VTI image.
==31900==
==31900== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 5 from 1)
==31900== malloc/free: in use at exit: 0 bytes in 0 blocks.
==31900== malloc/free: 2,246 allocs, 2,246 frees, 863,338 bytes allocated.
==31900== For counts of detected errors, rerun with: -v
==31900== No malloc'd blocks -- no leaks are possible.

#####################
# valgrind 2 pieces #
#####################

[kevin at gargon huge_streamed_test]$ valgrind --leak-check=full --show-reachable=yes ./streamed_test 10 10 10 2
==31908== Memcheck, a memory error detector.
==31908== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
==31908== Using LibVEX rev 1471, a library for dynamic binary translation.
==31908== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP.
==31908== Using valgrind-3.1.0, a dynamic binary instrumentation framework.
==31908== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
==31908== For more details, rerun with: -v
==31908==
--31908-- WARNING: unhandled syscall: 273
--31908-- You may be able to write your own handler.
--31908-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
Now we have a big VTI image.
Now we have a 2nd big VTI image.
==31908==
==31908== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 5 from 1)
==31908== malloc/free: in use at exit: 12 bytes in 2 blocks.
==31908== malloc/free: 2,630 allocs, 2,628 frees, 1,569,105 bytes allocated.
==31908== For counts of detected errors, rerun with: -v
==31908== searching for pointers to 2 not-freed blocks.
==31908== checked 876,368 bytes.
==31908==
==31908== 4 bytes in 1 blocks are definitely lost in loss record 1 of 2
==31908==    at 0x4905A0A: operator new[](unsigned long) (vg_replace_malloc.c:201)
==31908==    by 0x5645431: vtkXMLDataReader::SetupOutputData() (vtkXMLDataReader.cxx:381)
==31908==    by 0x567B1A5: vtkXMLReader::ReadXMLData() (vtkXMLReader.cxx:516)
==31908==    by 0x56442DA: vtkXMLDataReader::ReadXMLData() (vtkXMLDataReader.cxx:544)
==31908==    by 0x5685576: vtkXMLStructuredDataReader::ReadXMLData() (vtkXMLStructuredDataReader.cxx:224)
==31908==    by 0x567E93D: vtkXMLReader::RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) (vtkXMLReader.cxx:481)
==31908==    by 0x567BBF6: vtkXMLReader::ProcessRequest(vtkInformation*, vtkInformationVector**, vtkInformationVector*) (vtkXMLReader.cxx:1143)
==31908==    by 0x5A47AA7: vtkExecutive::CallAlgorithm(vtkInformation*, int, vtkInformationVector**, vtkInformationVector*) (vtkExecutive.cxx:748)
==31908==    by 0x5A426C0: vtkDemandDrivenPipeline::ExecuteData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) (vtkDemandDrivenPipeline.cxx:509)
==31908==    by 0x5A459B5: vtkDemandDrivenPipeline::ProcessRequest(vtkInformation*, vtkInformationVector**, vtkInformationVector*) (vtkDemandDrivenPipeline.cxx:282)
==31908==    by 0x5B70280: vtkStreamingDemandDrivenPipeline::ProcessRequest(vtkInformation*, vtkInformationVector**, vtkInformationVector*) (vtkStreamingDemandDrivenPipeline.cxx:147)
==31908==    by 0x5A49BC7: vtkExecutive::ForwardUpstream(vtkInformation*) (vtkExecutive.cxx:645)
==31908==
==31908==
==31908== 8 bytes in 1 blocks are definitely lost in loss record 2 of 2
==31908==    at 0x4905A0A: operator new[](unsigned long) (vg_replace_malloc.c:201)
==31908==    by 0x5645458: vtkXMLDataReader::SetupOutputData() (vtkXMLDataReader.cxx:382)
==31908==    by 0x567B1A5: vtkXMLReader::ReadXMLData() (vtkXMLReader.cxx:516)
==31908==    by 0x56442DA: vtkXMLDataReader::ReadXMLData() (vtkXMLDataReader.cxx:544)
==31908==    by 0x5685576: vtkXMLStructuredDataReader::ReadXMLData() (vtkXMLStructuredDataReader.cxx:224)
==31908==    by 0x567E93D: vtkXMLReader::RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) (vtkXMLReader.cxx:481)
==31908==    by 0x567BBF6: vtkXMLReader::ProcessRequest(vtkInformation*, vtkInformationVector**, vtkInformationVector*) (vtkXMLReader.cxx:1143)
==31908==    by 0x5A47AA7: vtkExecutive::CallAlgorithm(vtkInformation*, int, vtkInformationVector**, vtkInformationVector*) (vtkExecutive.cxx:748)
==31908==    by 0x5A426C0: vtkDemandDrivenPipeline::ExecuteData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) (vtkDemandDrivenPipeline.cxx:509)
==31908==    by 0x5A459B5: vtkDemandDrivenPipeline::ProcessRequest(vtkInformation*, vtkInformationVector**, vtkInformationVector*) (vtkDemandDrivenPipeline.cxx:282)
==31908==    by 0x5B70280: vtkStreamingDemandDrivenPipeline::ProcessRequest(vtkInformation*, vtkInformationVector**, vtkInformationVector*) (vtkStreamingDemandDrivenPipeline.cxx:147)
==31908==    by 0x5A49BC7: vtkExecutive::ForwardUpstream(vtkInformation*) (vtkExecutive.cxx:645)
==31908==
==31908== LEAK SUMMARY:
==31908==    definitely lost: 12 bytes in 2 blocks.
==31908==      possibly lost: 0 bytes in 0 blocks.
==31908==    still reachable: 0 bytes in 0 blocks.
==31908==         suppressed: 0 bytes in 0 blocks.

###############################
# ddd backtrace for 10 pieces #
###############################

(gdb) bt
#0  0x0000003ab962ee25 in raise () from /lib64/libc.so.6
#1  0x0000003ab9630770 in abort () from /lib64/libc.so.6
#2  0x0000003ab966613b in __libc_message () from /lib64/libc.so.6
#3  0x0000003ab966d58a in free () from /lib64/libc.so.6
#4  0x00002aaaab6e26e1 in vtkXMLDataParser::ReadCompressedData (this=0x519a80, data=0x5276e4 "
#5  0x00002aaaab6e369c in vtkXMLDataParser::ReadBinaryData (this=0x519a80, in_buffer=0x5276e4, startWord=0, numWords=28, wordType=10) at /home/kevin/kitware/VTK/IO/vtkXMLDataParser.cxx:773
#6  0x00002aaaab6e37b0 in vtkXMLDataParser::ReadAppendedData (this=0x519a80, offset=4996, buffer=0x5276e4, startWord=0, numWords=28, wordType=10) at /home/kevin/kitware/VTK/IO/vtkXMLDataParser.cxx:859
#7  0x00002aaaab6ebf14 in vtkXMLDataReaderReadArrayValues<vtkArrayIteratorTemplate<float> > (da=0x524e00, xmlparser=0x519a80, arrayIndex=133, iter=0x51ec80, startIndex=0, numValues=28) at /home/kevin/kitware/VTK/IO/vtkXMLDataReader.cxx:614
#8  0x00002aaaab6e7e39 in vtkXMLDataReader::ReadArrayValues (this=0x517bc0, da=0x524e00, arrayIndex=133, array=0x51f730, startIndex=0, numValues=28) at /home/kevin/kitware/VTK/IO/vtkXMLDataReader.cxx:746
#9  0x00002aaaab727c86 in vtkXMLStructuredDataReader::ReadSubExtent (this=0x517bc0, inExtent=0x51ab58, inDimensions=0x52044c, inIncrements=0x516598, outExtent=0x517d34, outDimensions=0x517d4c, outIncrements=0x517d68, subExtent=0x517d98, subDimensions=0x517db0, da=0x524e00, array=0x51f730) at /home/kevin/kitware/VTK/IO/vtkXMLStructuredDataReader.cxx:417
#10 0x00002aaaab728f22 in vtkXMLStructuredDataReader::ReadArrayForPoints (this=0x517bc0, da=0x524e00, outArray=0x51f730) at /home/kevin/kitware/VTK/IO/vtkXMLStructuredDataReader.cxx:304
#11 0x00002aaaab6e88d9 in vtkXMLDataReader::ReadPieceData (this=0x517bc0) at /home/kevin/kitware/VTK/IO/vtkXMLDataReader.cxx:484
#12 0x00002aaaab6e6dce in vtkXMLDataReader::ReadPieceData (this=0x517bc0, piece=9) at /home/kevin/kitware/VTK/IO/vtkXMLDataReader.cxx:440
#13 0x00002aaaab729ae3 in vtkXMLStructuredDataReader::ReadXMLData (this=0x517bc0) at /home/kevin/kitware/VTK/IO/vtkXMLStructuredDataReader.cxx:283
#14 0x00002aaaab72293e in vtkXMLReader::RequestData (this=0x517bc0, request=0x519580, outputVector=0x51a7e0) at /home/kevin/kitware/VTK/IO/vtkXMLReader.cxx:481
#15 0x00002aaaab71fbf7 in vtkXMLReader::ProcessRequest (this=0x517bc0, request=0x519580, inputVector=0x0, outputVector=0x51a7e0) at /home/kevin/kitware/VTK/IO/vtkXMLReader.cxx:1143
#16 0x00002aaaabaecaa8 in vtkExecutive::CallAlgorithm (this=0x518160, request=0x519580, direction=1, inInfo=0x0, outInfo=0x51a7e0) at /home/kevin/kitware/VTK/Filtering/vtkExecutive.cxx:748
#17 0x00002aaaabae76c1 in vtkDemandDrivenPipeline::ExecuteData (this=0x518160, request=0x519580, inInfo=0x0, outInfo=0x51a7e0) at /home/kevin/kitware/VTK/Filtering/vtkDemandDrivenPipeline.cxx:509
#18 0x00002aaaabaea9b6 in vtkDemandDrivenPipeline::ProcessRequest (this=0x518160, request=0x519580, inInfoVec=0x0, outInfoVec=0x51a7e0) at /home/kevin/kitware/VTK/Filtering/vtkDemandDrivenPipeline.cxx:282
#19 0x00002aaaabc15281 in vtkStreamingDemandDrivenPipeline::ProcessRequest (this=0x518160, request=0x519580, inInfoVec=0x0, outInfoVec=0x51a7e0) at /home/kevin/kitware/VTK/Filtering/vtkStreamingDemandDrivenPipeline.cxx:147
#20 0x00002aaaabaeebc8 in vtkExecutive::ForwardUpstream (this=0x518ed0, request=0x519580) at /home/kevin/kitware/VTK/Filtering/vtkExecutive.cxx:645
#21 0x00002aaaabaea931 in vtkDemandDrivenPipeline::ProcessRequest (this=0x518ed0, request=0x519580, inInfoVec=0x519050, outInfoVec=0x518fa0) at /home/kevin/kitware/VTK/Filtering/vtkDemandDrivenPipeline.cxx:268
#22 0x00002aaaabc15281 in vtkStreamingDemandDrivenPipeline::ProcessRequest (this=0x518ed0, request=0x519580, inInfoVec=0x519050, outInfoVec=0x518fa0) at /home/kevin/kitware/VTK/Filtering/vtkStreamingDemandDrivenPipeline.cxx:147
#23 0x00002aaaabaea2bd in vtkDemandDrivenPipeline::UpdateData (this=0x518ed0, outputPort=-1) at /home/kevin/kitware/VTK/Filtering/vtkDemandDrivenPipeline.cxx:452
#24 0x00002aaaabc141eb in vtkStreamingDemandDrivenPipeline::Update (this=0x518ed0, port=-1) at /home/kevin/kitware/VTK/Filtering/vtkStreamingDemandDrivenPipeline.cxx:191
#25 0x00002aaaabaed991 in vtkExecutive::Update (this=0x518ed0) at /home/kevin/kitware/VTK/Filtering/vtkExecutive.cxx:318
#26 0x00002aaaabaea597 in vtkDemandDrivenPipeline::Update (this=0x518ed0) at /home/kevin/kitware/VTK/Filtering/vtkDemandDrivenPipeline.cxx:315
#27 0x00002aaaabc1508d in vtkStreamingDemandDrivenPipeline::Update (this=0x518ed0) at /home/kevin/kitware/VTK/Filtering/vtkStreamingDemandDrivenPipeline.cxx:171
#28 0x00002aaaaba987fa in vtkAlgorithm::Update (this=0x516730) at /home/kevin/kitware/VTK/Filtering/vtkAlgorithm.cxx:1098
#29 0x0000000000401059 in main (argc=5, argv=0x7fff5c1872f8) at /home/kevin/Documents/huge_streamed_test/streamed_test.cxx:54
-------------- next part --------------
A non-text attachment was scrubbed...
Name: streamed_test.cxx
Type: text/x-c++src
Size: 1669 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20061002/ad39ed65/attachment.cxx>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20061002/ad39ed65/attachment.pgp>


More information about the vtkusers mailing list