[vtkusers] crash: EXCEPTION_ACCESS_VIOLATION error in native code outside th e Java VM

Jeff Lee jeff at cdnorthamerica.com
Fri Sep 20 06:56:07 EDT 2002

Hi Lichan,
Are you using vtk4.0 release or vtk4.x?  There are a couple of possible 
solutions to your problem.   The first rule is to NEVER call  
vtkRenderWindow.Render() directly from java.  You should always use 
vtkPanel's Render() method which does the appropriate mutex locking of 
the awt drawing surface.  The problem stems from the fact that X is not 
thread safe and that attempts to modify the drawing surface from 
different threads can cause this behavior.  The most rigorous way to 
ensure this never happens is to place mutex locks around all methods 
which can possibly modify the drawing surface.  vtkRenderWindow.Render() 
is one of these methods.  Any method that calls glxMakeCurrent() is also 
a candidate for locking.  vtkPanel tries to do this locking for you in 
places  where problems are known to exist.  First try using 
vtkPanel.Render() directly instead of vtkRenderWindow.Render().  If the 
problem still occurs, then expose two public methods on vtkPanel called 
lock() and unlock() which just call Lock() and UnLock() respectively. 
 Now you can place a lock/unlock around your button press event and see 
if it fixes the problem.  Please let me know if this fixes your problem.

Lichan.Hong at parc.com wrote:

>I have been building my application using the VTK Java interface. Recently, my
>system crashes frequently, resulting in the following error message:
>An unexpected exception has been detected in native code outside the VM.
>Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x23A73EFD
>NOTE: We are unable to locate the function name symbol for the error
>      just occurred. Please refer to release documentation for possible
>      reason and solutions.
>Current Java thread:
>	at vtk.vtkPointSet.GetPoints_13(Native Method)
>	at vtk.vtkPointSet.GetPoints(vtkPointSet.java:64)
>	at MyFilter.executeMethod(MyFilter.java:81)
>	at vtkPanel.RenderInternal(Native Method)
>	at vtkPanel.render(vtkPanel.java:157)
>	- locked <02F4E1D0> (a vtkPanel)
>	......	
>	at java.awt.Button.processActionEvent(Button.java:381)
>	......
>Essentially, what I try to do is: when a certain button is pressed, it triggers an animation. During
>this animation, class "MyFilter" deforms a piece of geometry and then I call render() of vtkPanel
>to generate a new frame. "MyFilter", a subclass of vtkPragrammableFilter, is a simple class
>that I wrote. Its method "executeMethod()" preforms the geometry deformation.
>Since my animation is running in a sequential manner: 
>				render
>				geometry update
>				render
>				geometry update
>				......
>I am deeply puzzled by the above error message. 
>Any helps will be greatly appreciated.
>This is the private VTK discussion list. 
>Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:

More information about the vtkusers mailing list