[vtkusers] Crashes in Java wrapped vtk on linux because of xcb problems

Clemens Müthing clemens.muething at uni-konstanz.de
Tue Nov 29 06:09:16 EST 2011


Hi together,



On Tue, 29 Nov 2011 06:07:03 +0100, Sebastien Jourdain  
<sebastien.jourdain at kitware.com> wrote:

> Hi Clemens,
>
> if you are using vtk 5.8, can you try to call Delete() on your
> vtkPanel/vtkCanvas before the window get closed by using a window
> observer or something like that,
> and let me know if that solve your issue.
>
> Thanks,
>
> Seb
>


I am using 5.8, and I am also already calling the Delete() on the
vtkRenderWindowPanel when the Frame is closed.

Moreover, I did make sure that I call delete() before the removeNotify()
method is called, so that I can actually delete the objects. Although
I think there might be the problem here. I investigated the Code of the
KNIME framework closer and found out that on closing I get the following
flow of events:

1) First the Framework uses the callback method where I can call the  
delete()
on vtkRenderWindowPanel
2) it then uses SwingUtilites.invokeAndWait() to dispose of the frame,  
using
the following code:

public void run() {
                 m_frame.setVisible(false);
                 m_frame.removeWindowListener(m_windowListener);
                 m_frame.getContentPane().removeAll();
                 m_frame.dispose();
             }

So I thought the problem might be that I call delete() before the frame is
set to be invisible and therefore put my deleting code in invokeLater().
This indeed does call delete() after the framework sets the frame to be
invisible and disposes of it, but I am not sure if this might also be
a problem that I am now calling delete() after the frame has already been
disposed of. Also, the error persists if I do this.

So might this really be the problem? I am not that proficient with the
way JNI and the wrapping of vtk works, so I can't really tell. Maybe
you could answer this?



> On Mon, Nov 28, 2011 at 2:09 PM, Luke Dodd <luke.dodd at gmail.com> wrote:
>> Hi Clemens,
>>
>> I've had these errors before on Linux, and like you had difficulty
>> ever producing a small example.
>>
>> Are you using vtkPanel or vtkCanvas? I have various theories, but I'm
>> not 100% sure about any of them. I think it could be to do with
>> vtkActors not being informed that the opengl context is no longer
>> "good" but still attempting to clean up native resources. What I did
>> conclude is that there is something "off" with vtkPanel/Canvas.
>>
>> To side step this I actually made my own vtkCanvas, it uses LWJGL to
>> set up a opengl context painting to a java panel, and then get vtk to
>> use that OpenGL context using a slightly tweaked
>> vtkGenericRenderWindow class. This, so far (no crashes for a few
>> weeks) has solved the issue.
>>
>> If you (or anyone else) are interested I could clean up this code a
>> little and put it on github. I'd be very happy to do this since if it
>> worked for you a) I would feel better about the stability of my own
>> code and b) if what I've done does actually "fix" it we'd be closer to
>> finding out the actual problem!
>>
>> (Sorry for the multiple emails Clemens, I forgot to hit reply all - I
>> want the rest of this list to see this too)
>>
>> Best Regards,
>> Luke Dodd
>>



As said above, I am using neither the vtkPanel or vtkCanvas, but rather
the vtkRenderWindowPanel directly. Anyway, I tried using the vtkCanvas
for a change, but the crash is still persistent even then.

So I am very interested in trying out your solution, that would be a great
help. Maybe I could even confirm some of my own theories why it crashes :)


So thanks again for the help and best regards

Clemens Müthing






>>
>> On 25 November 2011 15:52, Clemens Müthing
>> <clemens.muething at uni-konstanz.de> wrote:
>>>
>>> Hello everyone,
>>>
>>> I am currently developing a Viewer for Volume Renderings using the Java
>>> Wrappers of vtk.
>>> To complicate things a bit, the Viewer is a plugin for KNIME  
>>> (www.knime.org,
>>> a tool to
>>> perform data mining and other tasks using a node based approach) which  
>>> in
>>> term is an
>>> extension for eclipse.
>>>
>>> Now, the problem is the following: Everytime I run the programm, I can
>>> easily display
>>> the data, manipulate it etc without a crash as long as the window  
>>> containing
>>> the
>>> vtkPanel is open. But when I close the window, at random intervals a  
>>> crash
>>> will
>>> occur, giving me only one of the following error messages:
>>>
>>> java: ../../src/xcb_io.c:140: dequeue_pending_request: Assertion `req  
>>> ==
>>> dpy->xcb->pending_requests failed.
>>> java: ../../src/xcb_io.c:571: _XReply: Assertion `(((long)  
>>> (req->sequence) -
>>> (long) (dpy->request)) <= 0)' failed.
>>> java: ../../src/xcb_io.c:515: _XReply: Assertion  
>>> `!dpy->xcb->reply_data'
>>> failed.
>>>
>>> To ease the problem, I tried to build a minimum example, but this  
>>> didn't
>>> help, as that one is not
>>> crashing at all.
>>>
>>> So my question would be: Has anyone else have had a similar problem and
>>> could maybe give me
>>> a hint to where the problem may be? Or, as I don't have a clue how to  
>>> debug
>>> this any
>>> further, any tips what I might do to get a little bit more output?
>>>
>>> Thanks in advance
>>> _______________________________________________
>>> 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
>>>
>> _______________________________________________
>> 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



More information about the vtkusers mailing list