MATLAB: Does MATLAB R2013b, R2014a crash when using Mac OS X

MATLAB

MATLAB R2013b and R2014a have been crashing frequently when used in Mac OS X for various reasons:
a) Sometimes it happens when plugging/unplugging external monitors or displays
b) Sometimes it happens after the computer wakes from or the screen saves goes off.
At times I noticed the crash would not happen right away after any of the above events, but would happen a little after when I would open a new figure, execute code, etc.
The crash produces the following log:
 
[  0] 0x000000010715c874 /Applications/MATLAB_R2014a.app/bin/maci64/libmwfl.dylib+00030836 _ZN2fl4diag15stacktrace_base7captureERKNS0_14thread_contextEm+00000052
[  1] 0x00000001071602aa /Applications/MATLAB_R2014a.app/bin/maci64/libmwfl.dylib+00045738 _ZN2fl4test17terminate_handledEv+00000906
[  2] 0x000000010715fcf5 /Applications/MATLAB_R2014a.app/bin/maci64/libmwfl.dylib+00044277 _ZN2fl4diag13terminate_logEPKcPK17__darwin_ucontext+00000117
[  3] 0x0000000106cd8d07 /Applications/MATLAB_R2014a.app/bin/maci64/libmwmcr.dylib+00269575 _Z32mnRunPathDependentInitializationv+00003127
[  4] 0x0000000106cd8ff8 /Applications/MATLAB_R2014a.app/bin/maci64/libmwmcr.dylib+00270328 _Z32mnRunPathDependentInitializationv+00003880
[  5] 0x0000000106cd681a /Applications/MATLAB_R2014a.app/bin/maci64/libmwmcr.dylib+00260122 mnFatalSignalHandler+00000298
[  6] 0x00007fff969615aa           /usr/lib/system/libsystem_platform.dylib+00013738 _sigtramp+00000026
[  7] 0x0000000000000002                                   <unknown-module>+00000000
[  8] 0x0000000117a39647 /Applications/MATLAB_R2014a.app/sys/java/jre/maci64/jre/lib/lwawt/liblwawt.dylib+00206407 __Java_sun_lwawt_macosx_CWrapper_00024NSObject_release_block_invoke_1+00000091
[  9] 0x00000001168715f5 /System/Library/Frameworks/JavaVM.framework/Versions/A/Frameworks/JavaNativeFoundation.framework/Versions/A/JavaNativeFoundation+00026101 +[JNFRunLoop _performCopiedBlock:]+00000020
[ 10] 0x00007fff8d1f213e /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation+00405822 __NSThreadPerformPerform+00000229
Why does this happen?

Best Answer

This is unexpected behavior in the releases since MATLAB R2013b.  The cause of this issue is a bug in the Java shipped within these releases for the Mac OS X platform.  The above work-flows cause MATLAB to crash generating a crash log that contains a line with the following:
   __Java_sun_lwawt_macosx_CWrapper_00024NSObject_release_block_invoke_1
If the crash log does contain this line, see the External Bug Report for more up-to-date information as well as a workaround:
Related Question