MATLAB: Do I get java exceptions when opening many figures, using Simulink with many scopes or using CFTOOL

MATLAB

I have come across the same Java exception using three different workflows:
1) Within MATLAB, if I open many (>40) figures, or
2) If I open a Simulink model that has many (>40) scopes, or
3) Within MATLAB, if I use "cftool".
The exception I get is the following:
Exception in thread "AWT-EventQueue-0" javax.media.opengl.GLException: AWT-EventQueue-0: Error making temp context(1) current: display 0x7eff959bfc70, context 0x7eff9734eba8, drawable ResizeableImpl[Initialized false, realized true, texUnit 0, samples 8,
Factory   jogamp.opengl.x11.glx.X11GLXDrawableFactory@2c0051f3<mailto:jogamp.opengl.x11.glx.X11GLXDrawableFactory@2c0051f3>,
Handle    0xd800002,
Caps      GLCaps[glx vid 0x27, fbc 0x10d: rgba 8/8/8/1, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/8, sample-ext default, one, mono  , hw, GLProfile[GL3bc/GL3bc.hw], offscr[fbo]],
fboI back 0, front 0, num 0,
FBO front read 0, null,
FBO back  write 0, null,
Surface   WrappedSurface[ displayHandle 0x7eff959bfc70
, surfaceHandle 0xd800002
, size 320×211
, UOB[ OWNS_SURFACE | OWNS_DEVICE | WINDOW_INVISIBLE ] , X11GLXGraphicsConfiguration[X11GraphicsScreen[X11GraphicsDevice[type .x11, connection :0.0, unitID 0, handle 0x7eff959bfc70, owner true, ResourceToolkitLock[obj 0x21805ea2, isOwner true, &lt; 72c4eedc, 5f1de861 &gt;[count 1, qsz 0, owner &lt; AWT-EventQueue-0 &gt; ]]], idx 0], visualID 0x27, fbConfigID 0x10d, requested GLCaps[rgba 8/8/8/1, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/8, sample-ext default, one, mono  , hw, GLProfile[GL3bc/GL3bc.hw], on-scr[.]],
chosen    GLCaps[glx vid 0x27, fbc 0x10d: rgba 8/8/8/1, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/8, sample-ext default, one, mono  , hw, GLProfile[GL3bc/GL3bc.hw], offscr[fbo]]]
, surfaceLock &lt; 24836910, 2f66ac2a &gt; [count 1, qsz 0, owner &lt; AWT-EventQueue-0 &gt;] , X11DummyUpstreamSurfaceHook[ 320×211] , upstreamSurface false ]] at jogamp.opengl.x11.glx.X11GLXContext.createImpl(X11GLXContext.java:351)
at jogamp.opengl.GLContextImpl.makeCurrentWithinLock(GLContextImpl.java:633)
at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:539)
at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:496)
at javax.media.opengl.awt.GLJPanel$OffscreenBackend.initialize(GLJPanel.java:1029)
at javax.media.opengl.awt.GLJPanel.createAndInitializeBackend(GLJPanel.java:766)
at javax.media.opengl.awt.GLJPanel.paintComponent(GLJPanel.java:401)
at com.mathworks.hg.peer.JavaSceneServerGLJPanel.paintComponent(JavaSceneServerGLJPanel.java:61)
at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JComponent.paintChildren(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JComponent.paintChildren(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JComponent.paintChildren(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JComponent.paintChildren(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JComponent.paintChildren(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JComponent.paintChildren(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JComponent.paintChildren(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JComponent.paintChildren(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JComponent.paintChildren(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JComponent.paintChildren(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JComponent.paintChildren(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JComponent.paintChildren(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JComponent.paintChildren(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JComponent.paintChildren(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JComponent.paintChildren(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JComponent.paintChildren(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JComponent.paintChildren(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JComponent.paintChildren(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JComponent.paintChildren(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JLayeredPane.paint(Unknown Source) at javax.swing.JComponent.paintChildren(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JComponent.paintChildren(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JLayeredPane.paint(Unknown Source) at javax.swing.JComponent.paintChildren(Unknown Source) at javax.swing.JComponent.paintToOffscreen(Unknown Source) at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source) at javax.swing.RepaintManager$PaintManager.paint(Unknown Source) at javax.swing.RepaintManager.paint(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at java.awt.GraphicsCallback$PaintCallback.run(Unknown Source) at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source) at sun.awt.SunGraphicsCallback.runComponents(Unknown Source) at java.awt.Container.paint(Unknown Source) at java.awt.Window.paint(Unknown Source) at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source) at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source) at javax.swing.RepaintManager.prePaintDirtyRegions(Unknown Source) at javax.swing.RepaintManager.access$700(Unknown Source) at javax.swing.RepaintManager$ProcessingRunnable.run(Unknown Source) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$200(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source)
 

Best Answer

The exception is caused by outdated OpenGL graphics drivers.  The symptoms include:
1) The exception shown above, and/or
2) Excessive slow response from MATLAB/Simulink.  
The issue is not isolated to a particular OS or platform, but correlates with the amount of resources available (memory, etc).  The workaround this behavior is to upgrade to the latest drivers for your graphics card.
 
Related Question