Matlab crashes after mex from cpp

Hello
I usually have my Matlab crashes after the succesfully completion of mex from cpp to mexmaci64. It gives a warning message that an internal error occured and needs to shut down and it prompts me either send a report to Matlab or not.
I need to try maybe more than 6-8 times to make it run without crashing. After multiple attemps, it will eventually finishes running without crashing. Any idea why this might happen?

5 Commenti

Here is the crash report. Any help?
MATLAB crash file:/Users/steliosphanourakes/matlab_crash_dump.67224-1:
--------------------------------------------------------------------------------
Segmentation violation detected at Sun Aug 04 18:14:35 2019 +0100
--------------------------------------------------------------------------------
Configuration:
Crash Decoding : Disabled - No sandbox or build area path
Crash Mode : continue (default)
Default Encoding : UTF-8
Deployed : false
Graphics Driver : Unknown hardware
Java Version : Java 1.8.0_152-b16 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
MATLAB Architecture : maci64
MATLAB Entitlement ID : 4798894
MATLAB Root : /Applications/MATLAB_R2018b.app
MATLAB Version : 9.5.0.944444 (R2018b)
OpenGL : hardware
Operating System : Mac OS Version 10.14.5 (Build 18F132)
Process ID : 67224
Processor ID : x86 Family 6 Model 61 Stepping 4, GenuineIntel
Session Key : dad9a3aa-4b2c-4508-a025-a5193eb3f79a
Window System : Quartz
Fault Count: 1
Abnormal termination
Register State (from fault):
RAX = 00000000003fac00 RBX = 00000000003fac00
RCX = 000000017cea6020 RDX = 000000000000028c
RSP = 00000000003fac00 RBP = 00000000003fac00
RSI = 00007fff7b21dd79 RDI = 0000700003bc4940
R8 = 0000700003bc4960 R9 = 00007fff782f2378
R10 = 00000000003fac00 R11 = 000000000007f580
R12 = 0000700003bc49d0 R13 = 0000000173e2390f
R14 = 0000000000000000 R15 = 0000700003bc4bf8
RIP = 0000000000000320 RFL = 000000010d4b103e
CS = 0000600003c91c50 FS = 000000000000028c GS = 0000600003c91c50
Stack Trace (from fault):
[ 0] 0x000000010b0c9dd1 bin/maci64/libmwfl.dylib+00007633 _ZN10foundation4core4diag15stacktrace_base7captureERKNS1_14thread_contextEm+00000049
[ 1] 0x000000010b0cf4b5 bin/maci64/libmwfl.dylib+00029877 _ZN10foundation4core4test17terminate_handledEv+00006181
[ 2] 0x000000010b0cd9f5 bin/maci64/libmwfl.dylib+00023029 _ZN10foundation4core4diag13terminate_logEPKcPK17__darwin_ucontext+00000149
[ 3] 0x000000010fcfd67b bin/maci64/libmwmcr.dylib+00632443 _Z19mnPrintErrorMessageRKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE+00012635
[ 4] 0x000000010fcfb207 bin/maci64/libmwmcr.dylib+00623111 _Z19mnPrintErrorMessageRKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE+00003303
[ 5] 0x000000010fcf8d64 bin/maci64/libmwmcr.dylib+00613732 mnFatalSignalHandler+00000148
[ 6] 0x00007fff7b25eb5d /usr/lib/system/libsystem_platform.dylib+00019293 _sigtramp+00000029
[ 7] 0x0000600003c88e10 <unknown-module>+00000000
[ 8] 0x0000000110d834bc bin/maci64/libmex.dylib+00242876 _ZNK18C_DispatchStrategy8dispatchEiPP11mxArray_tagiS2_+00000140
[ 9] 0x0000000110d83a6d bin/maci64/libmex.dylib+00244333 _ZNK24SCCompatDispatchStrategy8dispatchEiPP11mxArray_tagiS2_+00000061
[ 10] 0x0000000110d83274 bin/maci64/libmex.dylib+00242292 _ZN7Mfh_mex30dispatch_file_with_protectionsEiPP11mxArray_tagiS2_+00000484
[ 11] 0x0000000110d6adbf bin/maci64/libmex.dylib+00142783 _ZN7Mfh_mex13dispatch_fileEiPP11mxArray_tagiS2_+00000159
[ 12] 0x000000010fe3e40a bin/maci64/libmwm_dispatcher.dylib+00500746 _ZN8Mfh_file16dispatch_fh_implEMS_FviPP11mxArray_tagiS2_EiS2_iS2_+00000746
[ 13] 0x000000010fe3e593 bin/maci64/libmwm_dispatcher.dylib+00501139 _ZN8Mfh_file11dispatch_fhEiPP11mxArray_tagiS2_+00000035
[ 14] 0x00000001117e0fd7 bin/maci64/libmwm_lxe.dylib+09338839 _ZN9MathWorks3lxe17LxeDispatcherImpl12apply_handleEPNS0_29DispatcherFunctionHandleTokenEmPNS0_6xvalueEmPKS4_NS0_9ApplyTypeE+00001303
[ 15] 0x00000001118e02eb bin/maci64/libmwm_lxe.dylib+10384107 _ZN9MathWorks3lxe12apply_handleEPvNS_2ts4TypeEPKvS1_S1_+00000507
[ 16] 0x000000011183ecde bin/maci64/libmwm_lxe.dylib+09723102 _ZN9MathWorks3lxe38cpp_primitive_template_fn_with_contextIXadL_ZNS0_12apply_handleEPvNS_2ts4TypeEPKvS2_S2_EEEEbS2_S4_S6_S2_S2_+00000014
[ 17] 0x0000000111073740 bin/maci64/libmwm_lxe.dylib+01550144 _ZN9MathWorks3lxe13IrInterpreter17ApplyCppPrimitiveEPN2ir4termES4_RKNS_2ts4TypeES8_+00000448
[ 18] 0x0000000111072ad2 bin/maci64/libmwm_lxe.dylib+01546962 _ZN9MathWorks3lxe13IrInterpreter31process_application_of_constantEPN2ir4termE+00001202
[ 19] 0x000000011107132d bin/maci64/libmwm_lxe.dylib+01540909 _ZN9MathWorks3lxe13IrInterpreter13applyConstantEPN2ir4termE+00000077
[ 20] 0x000000011106cd13 bin/maci64/libmwm_lxe.dylib+01522963 _ZN9MathWorks3lxe12IRTreeWalker9applyTermEPN2ir4termE+00000099
[ 21] 0x000000011106cfb9 bin/maci64/libmwm_lxe.dylib+01523641 _ZN9MathWorks3lxe12IRTreeWalker11getNextIRPCENS0_9irpc_typeE+00000217
[ 22] 0x00000001110710c7 bin/maci64/libmwm_lxe.dylib+01540295 _ZN9MathWorks3lxe13IrInterpreter9tree_walkERKNS0_9irpc_typeES4_+00000215
[ 23] 0x0000000111070fab bin/maci64/libmwm_lxe.dylib+01540011 _ZN9MathWorks3lxe13IrInterpreter9InterpretEv+00000091
[ 24] 0x000000011117efaf bin/maci64/libmwm_lxe.dylib+02645935 _ZN9MathWorks3lxe15ExecutionDriver9ThreadRunEv+00000911
[ 25] 0x0000000111184107 bin/maci64/libmwm_lxe.dylib+02666759 _ZN9MathWorks3lxe12IrEngineImpl5ApplyERKN2ir4termEPvS6_+00000295
[ 26] 0x00000001116bc0b9 bin/maci64/libmwm_lxe.dylib+08138937 _ZN9MathWorks3lxe17IrEngineDecorator5ApplyERKN2ir4termEPvS6_+00000153
[ 27] 0x00000001117d7bf9 bin/maci64/libmwm_lxe.dylib+09300985 _ZN9MathWorks3lxe27FileBasedMatlabCodeFunction14DispatchScriptEiPP11mxArray_tagiS4_+00000297
[ 28] 0x00000001117d7e51 bin/maci64/libmwm_lxe.dylib+09301585 _ZN9MathWorks3lxe27FileBasedMatlabCodeFunction12DispatchFileEiPP11mxArray_tagiS4_b+00000129
[ 29] 0x000000010fe3e40a bin/maci64/libmwm_dispatcher.dylib+00500746 _ZN8Mfh_file16dispatch_fh_implEMS_FviPP11mxArray_tagiS2_EiS2_iS2_+00000746
[ 30] 0x000000010fe3e593 bin/maci64/libmwm_dispatcher.dylib+00501139 _ZN8Mfh_file11dispatch_fhEiPP11mxArray_tagiS2_+00000035
[ 31] 0x00000001117e0fd7 bin/maci64/libmwm_lxe.dylib+09338839 _ZN9MathWorks3lxe17LxeDispatcherImpl12apply_handleEPNS0_29DispatcherFunctionHandleTokenEmPNS0_6xvalueEmPKS4_NS0_9ApplyTypeE+00001303
[ 32] 0x00000001118e0989 bin/maci64/libmwm_lxe.dylib+10385801 _ZN9MathWorks3lxe16ans_apply_handleEPvNS_2ts4TypeEPKvS1_S1_+00000361
[ 33] 0x000000011183ed5e bin/maci64/libmwm_lxe.dylib+09723230 _ZN9MathWorks3lxe38cpp_primitive_template_fn_with_contextIXadL_ZNS0_16ans_apply_handleEPvNS_2ts4TypeEPKvS2_S2_EEEEbS2_S4_S6_S2_S2_+00000014
[ 34] 0x0000000111073740 bin/maci64/libmwm_lxe.dylib+01550144 _ZN9MathWorks3lxe13IrInterpreter17ApplyCppPrimitiveEPN2ir4termES4_RKNS_2ts4TypeES8_+00000448
[ 35] 0x0000000111072ad2 bin/maci64/libmwm_lxe.dylib+01546962 _ZN9MathWorks3lxe13IrInterpreter31process_application_of_constantEPN2ir4termE+00001202
[ 36] 0x000000011107132d bin/maci64/libmwm_lxe.dylib+01540909 _ZN9MathWorks3lxe13IrInterpreter13applyConstantEPN2ir4termE+00000077
[ 37] 0x000000011106cd13 bin/maci64/libmwm_lxe.dylib+01522963 _ZN9MathWorks3lxe12IRTreeWalker9applyTermEPN2ir4termE+00000099
[ 38] 0x000000011106cfb9 bin/maci64/libmwm_lxe.dylib+01523641 _ZN9MathWorks3lxe12IRTreeWalker11getNextIRPCENS0_9irpc_typeE+00000217
[ 39] 0x00000001110710c7 bin/maci64/libmwm_lxe.dylib+01540295 _ZN9MathWorks3lxe13IrInterpreter9tree_walkERKNS0_9irpc_typeES4_+00000215
[ 40] 0x0000000111070fab bin/maci64/libmwm_lxe.dylib+01540011 _ZN9MathWorks3lxe13IrInterpreter9InterpretEv+00000091
[ 41] 0x000000011117efaf bin/maci64/libmwm_lxe.dylib+02645935 _ZN9MathWorks3lxe15ExecutionDriver9ThreadRunEv+00000911
[ 42] 0x0000000111184107 bin/maci64/libmwm_lxe.dylib+02666759 _ZN9MathWorks3lxe12IrEngineImpl5ApplyERKN2ir4termEPvS6_+00000295
[ 43] 0x00000001116bc0b9 bin/maci64/libmwm_lxe.dylib+08138937 _ZN9MathWorks3lxe17IrEngineDecorator5ApplyERKN2ir4termEPvS6_+00000153
[ 44] 0x000000011166b609 bin/maci64/libmwm_lxe.dylib+07808521 _ZN9MathWorks3lxe9Evaluator15ApplyStatementsERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERKN2ir4termERNS0_18IEvaluationContextE+00000425
[ 45] 0x000000011166f0ee bin/maci64/libmwm_lxe.dylib+07823598 _ZN9MathWorks3lxe9Evaluator17EvalStatementImplERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERNS0_18IEvaluationContextE+00000206
[ 46] 0x000000011166f1ba bin/maci64/libmwm_lxe.dylib+07823802 _ZN9MathWorks3lxe9Evaluator13EvalStatementERKNSt3__112basic_stringIDsNS2_11char_traitsIDsEENS2_9allocatorIDsEEEERNS0_18IEvaluationContextE+00000106
[ 47] 0x00000001116f7b87 bin/maci64/libmwm_lxe.dylib+08383367 _ZN9MathWorks3lxe9LxeBridge7EvalCmdERKNSt3__112basic_stringIDsNS2_11char_traitsIDsEENS2_9allocatorIDsEEEEb+00000327
[ 48] 0x00000001116f7a77 bin/maci64/libmwm_lxe.dylib+08383095 _ZN9MathWorks3lxe9LxeBridge7EvalCmdERKNSt3__112basic_stringIDsNS2_11char_traitsIDsEENS2_9allocatorIDsEEEEb+00000055
[ 49] 0x0000000110e8ed8d bin/maci64/libmwbridge.dylib+00073101 _Z8mnParserv+00000653
[ 50] 0x000000010fc928c9 bin/maci64/libmwmcr.dylib+00194761 _ZN3mcr7runtime26InterpreterThreadSingleton4Impl16break_event_loopERKN7mwboost10shared_ptrIS2_EE+00003369
[ 51] 0x000000010fc92bf9 bin/maci64/libmwmcr.dylib+00195577 _ZN3mcr7runtime26InterpreterThreadSingleton4Impl16break_event_loopERKN7mwboost10shared_ptrIS2_EE+00004185
[ 52] 0x000000010fc6f1f5 bin/maci64/libmwmcr.dylib+00049653 _ZN14cmddistributor15PackagedTaskIIP13getTypeStringIvEENSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEv+00000917
[ 53] 0x000000010fc6f137 bin/maci64/libmwmcr.dylib+00049463 _ZN14cmddistributor15PackagedTaskIIP13getTypeStringIvEENSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEv+00000727
[ 54] 0x000000010fc6f0e2 bin/maci64/libmwmcr.dylib+00049378 _ZN14cmddistributor15PackagedTaskIIP13getTypeStringIvEENSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEv+00000642
[ 55] 0x000000010fb6f74e bin/maci64/libmwiqm.dylib+00366414 _ZN7mwboost6detail8function21function_obj_invoker0INSt3__18functionIFNS_3anyEvEEES5_E6invokeERNS1_15function_bufferE+00000030
[ 56] 0x000000010fb6f16b bin/maci64/libmwiqm.dylib+00364907 _ZN3iqm18PackagedTaskPlugin7executeEP15inWorkSpace_tag+00000251
[ 57] 0x000000010fb50b5f bin/maci64/libmwiqm.dylib+00240479 _ZNK3iqm17DefaultPacketInfo7executeEP15inWorkSpace_tag+00000799
[ 58] 0x000000010fb3499b bin/maci64/libmwiqm.dylib+00125339 _ZN3iqm10DefaultIqm13dequeueHelperEN7mwboost8optionalImEERKNSt3__112basic_stringIDsNS4_11char_traitsIDsEENS4_9allocatorIDsEEEEN6mlutil14cmddistributor13WhenToDequeue13WhenToDequeueERKNS4_8functionIFbRKNS4_5tupleIJSG_NS1_10shared_ptrINS_22IntermediatePacketInfoEEESA_EEEEEE+00001195
[ 59] 0x000000010fb28dca bin/maci64/libmwiqm.dylib+00077258 _ZN3iqm10DefaultIqm7dequeueEN6mlutil14cmddistributor13WhenToDequeue13WhenToDequeueEN7mwboost8optionalImEE+00000362
[ 60] 0x000000010fb3a766 bin/maci64/libmwiqm.dylib+00149350 _ZN3tbb10interface519concurrent_hash_mapIN6mlutil10contextmgr5McrIDEN7mwboost10shared_ptrIN3iqm17DebugEventHandlerEEEN10foundation7msg_svc10threadutil4HashIS4_EENS_13tbb_allocatorINSt3__14pairIS4_S9_EEEEE28allocate_node_copy_constructERNSF_INSK_4nodeEEERKS4_PKS9_+00006198
[ 61] 0x0000000108cbf8e5 bin/maci64/libmwservices.dylib+01239269 _Z40svWS_ProcessPendingEventsWithLimitedRateb+00003301
[ 62] 0x0000000108cbe0f6 bin/maci64/libmwservices.dylib+01233142 _Z25svWS_ProcessPendingEventsiib+00001094
[ 63] 0x0000000108cbdd5f bin/maci64/libmwservices.dylib+01232223 _Z25svWS_ProcessPendingEventsiib+00000175
[ 64] 0x000000010fc91284 bin/maci64/libmwmcr.dylib+00189060 _ZN3mcr7runtime26InterpreterThreadSingleton4Impl14process_eventsERKN7mwboost10shared_ptrIS2_EE+00000356
[ 65] 0x000000010fc91957 bin/maci64/libmwmcr.dylib+00190807 _ZN3mcr7runtime26InterpreterThreadSingleton4Impl3runERKN7mwboost10shared_ptrIS2_EEPNS2_12init_contextE+00000279
[ 66] 0x000000010fc8cc1a bin/maci64/libmwmcr.dylib+00171034 _Z26run_init_and_handle_eventsPv+00000266
[ 67] 0x00007fff7b2672eb /usr/lib/system/libsystem_pthread.dylib+00013035 _pthread_body+00000126
[ 68] 0x00007fff7b26a249 /usr/lib/system/libsystem_pthread.dylib+00025161 _pthread_start+00000066
[ 69] 0x00007fff7b26640d /usr/lib/system/libsystem_pthread.dylib+00009229 thread_start+00000013
This error was detected while a MEX-file was running. If the MEX-file
is not an official MathWorks function, please examine its source code
for errors. Please consult the External Interfaces Guide for information
on debugging MEX-files.
Is this something that happens just as a result of using mex(), or is it something that happens when you run code that has been compiled with mex?
It happens after the mex compiler finishes successfully the compilation. I guess since the compilation is successful and crashes later on, then it has to do with the .mexmaci64 file
The crash is because of a bug in the code that was compiled as mex. The mex file tries to access some memory it's not allowed.
For example if you compile the code and then quit MATLAB and then restart MATLAB and run code that uses the .mex* file, then do you still get the crash?
If you use mex to compile the file but do not run the .mex* file, then does the crash still appear?

Accedi per commentare.

Più risposte (0)

Categorie

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by