MATLAB: Does MATLAB crash in Linux (with NVIDIA drivers) when trying to plot or save/export figures (with “TextureObject” mentioned in the crash report)

MATLABtextureobjecttextureobjectmanagertextureobjectset

Why is MATLAB crashing on my Linux machine when trying to plot or save/export figures? The stack trace in the crash report includes references to "libosg.so" (an OpenSceneGraph library), specifically to "TextureObjectSet" or "TextureObjectManager".
For example, here is the stack trace for one such crash report:
[ 0] 0x00007f0bb0d15040 /usr/local/MATLAB/R2017b/bin/glnxa64/libosg.so.130+02285632 _ZN3osg7Texture20TextureObjectManager20releaseTextureObjectEPNS0_13TextureObjectE+00000000
[ 1] 0x00007f0cb9863160 <unknown-module>+00000000

Best Answer

This crash appears to be due to a bug in the NVIDIA graphics driver for your Linux machine. You may be able to resolve the issue by upgrading your NVIDIA graphics driver to a later version (e.g. in the 4xx.xx series) that is supported for your specific graphics card. Here are relevant links from NVIDIA's website:
An alternative workaround is to use MATLAB with the software implementation of OpenGL. To do so, execute the following command in the Linux Terminal:
$ matlab -softwareopengl
If you would like to have this setting persist for future sessions of MATLAB, you can subsequently execute the following MATLAB command:
>> opengl('save','software')
For more information, here are relevant links from our documentation: