[vtkusers] vtkGraph::AddVertex segfault

Aashish Chaudhary aashish.chaudhary at kitware.com
Thu May 13 16:07:25 EDT 2010


On Thu, May 13, 2010 at 3:59 PM, Caleb Johnston <cjj37 at cornell.edu> wrote:

> I only get a SIGSEGV signal from the OS. However, I do get some other
> strange behavior that I don't fully understand. I have included it below.
>
> When I start the program in the debugger, I get this:
> ** (<unknown>:15767): CRITICAL **: atk_object_set_name: assertion `name !=
> NULL' failed
>
> I believe this is gtk / gnome issue. I used to see this when I was using
Ubuntu 9.04 not anymore with 10.04


> And when the seg fault happens, I see this:
> (Internal error: pc 0x3b4adb in read in psymtab, but not in symtab.)
> (Internal error: pc 0x3b4ada in read in psymtab, but not in symtab.)
> (Internal error: pc 0x3b4ada in read in psymtab, but not in symtab.)
> (Internal error: pc 0x3b4ada in read in psymtab, but not in symtab.)
> (Internal error: pc 0x3b4a80 in read in psymtab, but not in symtab.)
> (Internal error: pc 0x3c25a7 in read in psymtab, but not in symtab.)
> (Internal error: pc 0x3c25a6 in read in psymtab, but not in symtab.)
> (Internal error: pc 0x3c25a6 in read in psymtab, but not in symtab.)
> (Internal error: pc 0x3c25a6 in read in psymtab, but not in symtab.)
> (Internal error: pc 0x3c2390 in read in psymtab, but not in symtab.)
>
> I just did a quick google search .. looks like this is more or less gdb
issue

>
> On windows, I just get error code 3 at the same point. The only reason I
> tried to perform the Update call is because I thought it might alleviate
> this problem. But it didn't. If its of use, here is some more system info:
>
> Linux: Ubuntu 9.10
> Windows: XP SP3
>
> Linux runs in VMware Fusion but i get the same problem in windows without
> the VM. And the Windows machine has over 3GB of Ram, so I doubt that its out
> of memory in this case.
>
> Does your program crash in release mode (release build) ?


> thanks,
> Caleb
>
>
> On Thu, May 13, 2010 at 3:45 PM, Aashish Chaudhary <
> aashish.chaudhary at kitware.com> wrote:
>
>> normally a push on vector should not result in crash. Something else is
>> wrong somewhere.
>>
>> Also are you getting std::bad_alloc exception?
>>
>>
>> On Thu, May 13, 2010 at 3:41 PM, Caleb Johnston <cjj37 at cornell.edu>wrote:
>>
>>> If I comment out the code, it does not crash. But I also have to end the
>>> whole control flow at that point because everything after it depends upon
>>> that data. But there is no crash.
>>>
>>> Caleb
>>>
>>>
>>> On Thu, May 13, 2010 at 3:25 PM, Aashish Chaudhary <
>>> aashish.chaudhary at kitware.com> wrote:
>>>
>>>> Can you try this..
>>>>
>>>> Can you comment the code where you are loading volume data? And see if
>>>> you can replicate the crash?
>>>>
>>>>
>>>> On Thu, May 13, 2010 at 3:17 PM, Caleb Johnston <cjj37 at cornell.edu>wrote:
>>>>
>>>>> The code is not that compilable without Qt, VTK, ITK, and Cmake
>>>>> installed. It is publicly hosted at SourceForge:
>>>>> http://sourceforge.net/projects/glassbrain/
>>>>>
>>>>> And the stack trace shows the problem arrises from the AddVertex call.
>>>>>
>>>>>
>>>>> On Thu, May 13, 2010 at 2:25 PM, David Doria <daviddoria+vtk at gmail.com<daviddoria%2Bvtk at gmail.com>
>>>>> > wrote:
>>>>>
>>>>>> On Thu, May 13, 2010 at 2:16 PM, Caleb Johnston <cjj37 at cornell.edu>
>>>>>> wrote:
>>>>>> > I'm getting a segfault when calling
>>>>>> vtkMutableUndirectedGraph::AddVertex.
>>>>>> > However, it does not always occur at the same vertex. Sometimes it
>>>>>> is after
>>>>>> > the 2nd vertex. Sometimes it won't happen at all (though rarely).
>>>>>> I'm only
>>>>>> > adding about 120 vertices. And the program is not consuming large
>>>>>> amounts of
>>>>>> > data so I don't understand why this is happening. Also, this only
>>>>>> happens in
>>>>>> > Linux and Windows but not MacOS X. Below, I have included my
>>>>>> algorithm for
>>>>>> > adding vertices.
>>>>>> > thanks,
>>>>>> > Caleb
>>>>>> > ...
>>>>>> > int len = 0;
>>>>>> > double X,Y,Z,Count;
>>>>>> > for(i=0, j=0; j<numberOfLabels; i+=3, j++){
>>>>>> >    X = (double)coords[i];
>>>>>> >    Y = (double)coords[i+1];
>>>>>> >    Z = (double)coords[i+2];
>>>>>> >    Count = (double)centroids[j];
>>>>>> >    if(Count>0.0){
>>>>>> >       X = X / Count;
>>>>>> >       Y = Y / Count;
>>>>>> >       Z = Z / Count;
>>>>>> >       len++;
>>>>>> >       graph->AddVertex();  // crashes here.
>>>>>> >       graph->Update();
>>>>>> >       points->InsertNextPoint(X, Y, Z);
>>>>>> >    }
>>>>>> > }
>>>>>> > ...
>>>>>>
>>>>>> I've used this in Linux plenty of times with no problems. If you post
>>>>>> some compilable code I can see if it works on my machine. My initial
>>>>>> bet is that something is going wrong around there, like accessing out
>>>>>> of bounds elements in coords or centroids.
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> David
>>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> 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 VTK FAQ at:
>>>>> http://www.vtk.org/Wiki/VTK_FAQ
>>>>>
>>>>> Follow this link to subscribe/unsubscribe:
>>>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> | Aashish Chaudhary
>>>> | R&D Engineer
>>>> | Kitware Inc.
>>>> | www.kitware.com
>>>>
>>>
>>>
>>
>>
>> --
>> | Aashish Chaudhary
>> | R&D Engineer
>> | Kitware Inc.
>> | www.kitware.com
>>
>
>


-- 
| Aashish Chaudhary
| R&D Engineer
| Kitware Inc.
| www.kitware.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100513/0f83cc9e/attachment.htm>


More information about the vtkusers mailing list