Access Violation Detected MatLAB
100 views (last 30 days)
Show older comments
Hello everyone, I hope you are all well. I am trying to parallize a non-paralell for loop. However, when I tried it out, I get the error message "Access Violation Detected". For context, I have added the full log below (NOTE there are 12 log files, one for each cpu core, so I only added one of the logs). I believe it has to do with one of our MEX functions, since the disp statements right after it stop showing up. However, even when I remove that function from the loop, the same error occurs, so I cannot narrow it down either. Is there any general solution to this problem? If not, I will provide the code as well that is causing it. Thank you.
--------------------------------------------------------------------------------
Access violation detected at 2023-11-24 14:30:23 -0700
--------------------------------------------------------------------------------
Configuration:
Crash Decoding : Disabled - No sandbox or build area path
Crash Mode : continue (default)
Default Encoding : UTF-8
Deployed : false
Graphics Driver : Uninitialized hardware
Graphics card 1 : Microsoft ( 0x0 ) Microsoft Remote Display Adapter Version 10.0.19041.3636 (2006-6-21)
Graphics card 2 : NVIDIA ( 0x10de ) NVIDIA GeForce RTX 3080 Version 31.0.15.3640 (2023-6-23)
Java Version : Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
MATLAB Architecture : win64
MATLAB Entitlement ID : 1981661
MATLAB Root : C:\Program Files\MATLAB\R2022b
MATLAB Version : 9.13.0.2080170 (R2022b) Update 1
OpenGL : hardware
Operating System : Microsoft Windows 10 Education
Process ID : 10228
Processor ID : x86 Family 6 Model 151 Stepping 2, GenuineIntel
Session Key : 12eb73e4-dc2d-4f07-be65-515a51b6b228
Window System : Version 10.0 (Build 19045)
Fault Count: 1
Abnormal termination:
Access violation
Current Thread: 'MCR 0 interpreter thread' id 17652
Register State (from fault):
RAX = 00000297ded1a540 RBX = 0000000000000006
RCX = 0000000000000015 RDX = 00000297aa7d84b8
RSP = 000000c0e9ff99c0 RBP = 000001e6c3706800
RSI = 00000297afa748a0 RDI = 00000297aa4b1060
R8 = 000000000000000b R9 = 000000c0e9ff9a00
R10 = 0000000000000040 R11 = 000000c0e9ff99b0
R12 = 00000297e3c577d0 R13 = 00000297afc75ad0
R14 = 000000c0e9ff9b80 R15 = 0000000000000001
RIP = 00007fff12ac1177 EFL = 00010202
CS = 0033 FS = 0053 GS = 002b
Stack Trace (from fault):
[ 0] 0x00007fff12ac1177 C:\Users\labadmin\Desktop\MagedBridges\BridgesOctree\+octtrees\query_index_moct.mexw64+00004471 mexFunction+00000215
[ 1] 0x00007ffe62069149 C:\Program Files\MATLAB\R2022b\bin\win64\libmex.dll+00561481 mexfile::Inspector::needs_upgrade+00027273
[ 2] 0x00007ffe6206cb32 C:\Program Files\MATLAB\R2022b\bin\win64\libmex.dll+00576306 MexRetrieveVersion+00011746
[ 3] 0x00007ffe6206ce57 C:\Program Files\MATLAB\R2022b\bin\win64\libmex.dll+00577111 MexRetrieveVersion+00012551
[ 4] 0x00007ffe6204b10e C:\Program Files\MATLAB\R2022b\bin\win64\libmex.dll+00438542 mexUnlock+00017022
[ 5] 0x00007ffe61e0da32 C:\Program Files\MATLAB\R2022b\bin\win64\m_dispatcher.dll+01038898 Mfh_file::dispatch_file_common+00000178
[ 6] 0x00007ffe61e0c728 C:\Program Files\MATLAB\R2022b\bin\win64\m_dispatcher.dll+01034024 Mfh_error::lookup+00011224
[ 7] 0x00007ffe61e0d92d C:\Program Files\MATLAB\R2022b\bin\win64\m_dispatcher.dll+01038637 Mfh_file::dispatch+00000045
[ 8] 0x00007ffe50250606 C:\Program Files\MATLAB\R2022b\bin\win64\mcos_impl.dll+03540486 mcos::waitforWrapper+00574966
[ 9] 0x00007ffe50195f77 C:\Program Files\MATLAB\R2022b\bin\win64\mcos_impl.dll+02776951 mcos::impl::terminateFcn+00885479
[ 10] 0x00007ffe5019612a C:\Program Files\MATLAB\R2022b\bin\win64\mcos_impl.dll+02777386 mcos::impl::terminateFcn+00885914
[ 11] 0x00007ffe501964a1 C:\Program Files\MATLAB\R2022b\bin\win64\mcos_impl.dll+02778273 mcos::impl::terminateFcn+00886801
[ 12] 0x00007ffe5019992b C:\Program Files\MATLAB\R2022b\bin\win64\mcos_impl.dll+02791723 mcos::impl::terminateFcn+00900251
[ 13] 0x00007ffe5028df4e C:\Program Files\MATLAB\R2022b\bin\win64\mcos_impl.dll+03792718 namedArgsToCell+00001438
[ 14] 0x00007ffe50381a9a C:\Program Files\MATLAB\R2022b\bin\win64\mcos_impl.dll+04790938 musBeA+00295610
[ 15] 0x00007ffe50380cf6 C:\Program Files\MATLAB\R2022b\bin\win64\mcos_impl.dll+04787446 musBeA+00292118
[ 16] 0x00007ffe61d1b76e C:\Program Files\MATLAB\R2022b\bin\win64\m_dispatcher.dll+00046958
[ 17] 0x00007ffe61d3d1ad C:\Program Files\MATLAB\R2022b\bin\win64\m_dispatcher.dll+00184749 Mfh_MATLAB_fn_impl::dispatch+00000045
[ 18] 0x00007ffe61b10c74 C:\Program Files\MATLAB\R2022b\bin\win64\libmwlxemainservices.dll+00330868 mwboost::archive::codecvt_null<wchar_t>::do_max_length+00234740
[ 19] 0x00007ffe61b1f1f0 C:\Program Files\MATLAB\R2022b\bin\win64\libmwlxemainservices.dll+00389616 mwboost::archive::codecvt_null<wchar_t>::do_max_length+00293488
[ 20] 0x00007ffe5e8c1f41 C:\Program Files\MATLAB\R2022b\bin\win64\m_lxe.dll+05709633 MathWorks::lxe::ReadOnlyXvaluePtr::operator=+00006049
[ 21] 0x00007ffe5e8c3d18 C:\Program Files\MATLAB\R2022b\bin\win64\m_lxe.dll+05717272 MathWorks::lxe::ReadOnlyXvaluePtr::operator=+00013688
[ 22] 0x00007ffe5e8c48b4 C:\Program Files\MATLAB\R2022b\bin\win64\m_lxe.dll+05720244 MathWorks::lxe::ReadOnlyXvaluePtr::operator=+00016660
[ 23] 0x00007ffe5e80e148 C:\Program Files\MATLAB\R2022b\bin\win64\m_lxe.dll+04972872 MathWorks::lxe::printLxeProfStatsForFeature+00300760
[ 24] 0x00007ffe5e828a09 C:\Program Files\MATLAB\R2022b\bin\win64\m_lxe.dll+05081609 MathWorks::lxe::printLxeProfStatsForFeature+00409497
[ 25] 0x00007ffe5e61803b C:\Program Files\MATLAB\R2022b\bin\win64\m_lxe.dll+02916411 MathWorks::lxe::LXEConstants::IsIfElse+00525851
[ 26] 0x00007ffe5e61c644 C:\Program Files\MATLAB\R2022b\bin\win64\m_lxe.dll+02934340 MathWorks::lxe::LXEConstants::IsY+00012980
[ 27] 0x00007ffe5e619a91 C:\Program Files\MATLAB\R2022b\bin\win64\m_lxe.dll+02923153 MathWorks::lxe::LXEConstants::IsY+00001793
[ 28] 0x00007ffe5e61d785 C:\Program Files\MATLAB\R2022b\bin\win64\m_lxe.dll+02938757 MathWorks::lxe::LXEConstants::IsY+00017397
[ 29] 0x00007ffe5e61da33 C:\Program Files\MATLAB\R2022b\bin\win64\m_lxe.dll+02939443 MathWorks::lxe::LXEConstants::IsY+00018083
[ 30] 0x00007ffe5e61d388 C:\Program Files\MATLAB\R2022b\bin\win64\m_lxe.dll+02937736 MathWorks::lxe::LXEConstants::IsY+00016376
[ 31] 0x00007ffe5e619236 C:\Program Files\MATLAB\R2022b\bin\win64\m_lxe.dll+02921014 MathWorks::lxe::LxeTypes::GetTypeXvalueOf+00000598
[ 32] 0x00007ffe5e6e6f53 C:\Program Files\MATLAB\R2022b\bin\win64\m_lxe.dll+03764051 MathWorks::lxe::SetEngineImplUnlinkFlagForAllCallsOnStack+00042979
[ 33] 0x00007ffe5e6eaa60 C:\Program Files\MATLAB\R2022b\bin\win64\m_lxe.dll+03779168 MathWorks::lxe::SetEngineImplUnlinkFlagForAllCallsOnStack+00058096
[ 34] 0x00007ffe61be4a90 C:\Program Files\MATLAB\R2022b\bin\win64\libmwlxemainservices.dll+01198736 FeatureTestObservableWorkspace+00184240
[ 35] 0x00007ffe61b09aa1 C:\Program Files\MATLAB\R2022b\bin\win64\libmwlxemainservices.dll+00301729 mwboost::archive::codecvt_null<wchar_t>::do_max_length+00205601
[ 36] 0x00007ffe61b09495 C:\Program Files\MATLAB\R2022b\bin\win64\libmwlxemainservices.dll+00300181 mwboost::archive::codecvt_null<wchar_t>::do_max_length+00204053
[ 37] 0x00007ffe61b0bad8 C:\Program Files\MATLAB\R2022b\bin\win64\libmwlxemainservices.dll+00309976 mwboost::archive::codecvt_null<wchar_t>::do_max_length+00213848
[ 38] 0x00007ffe61e0da32 C:\Program Files\MATLAB\R2022b\bin\win64\m_dispatcher.dll+01038898 Mfh_file::dispatch_file_common+00000178
[ 39] 0x00007ffe61e0c9e8 C:\Program Files\MATLAB\R2022b\bin\win64\m_dispatcher.dll+01034728 Mfh_error::lookup+00011928
[ 40] 0x00007ffe61e0daed C:\Program Files\MATLAB\R2022b\bin\win64\m_dispatcher.dll+01039085 Mfh_file::dispatch_with_reuse+00000045
[ 41] 0x00007ffe5e8ef270 C:\Program Files\MATLAB\R2022b\bin\win64\m_lxe.dll+05894768 MathWorks::lxe::CreateUnboundFunctionHandle+00010688
[ 42] 0x00007ffe61b50dad C:\Program Files\MATLAB\R2022b\bin\win64\libmwlxemainservices.dll+00593325 mwboost::archive::detail::pointer_oserializer<mwboost::archive::xml_oarchive,MathWorks::lxe::PreLineExecutionEvent>::save_object_ptr+00078989
[ 43] 0x00007ffe61b50ebb C:\Program Files\MATLAB\R2022b\bin\win64\libmwlxemainservices.dll+00593595 mwboost::archive::detail::pointer_oserializer<mwboost::archive::xml_oarchive,MathWorks::lxe::PreLineExecutionEvent>::save_object_ptr+00079259
[ 44] 0x00007ffe61baf321 C:\Program Files\MATLAB\R2022b\bin\win64\libmwlxemainservices.dll+00979745 mwboost::archive::detail::iserializer<mwboost::archive::text_iarchive,MathWorks::MatlabComponents::ComponentIdentifier>::load_object_data+00305057
[ 45] 0x00007ffe61baeed9 C:\Program Files\MATLAB\R2022b\bin\win64\libmwlxemainservices.dll+00978649 mwboost::archive::detail::iserializer<mwboost::archive::text_iarchive,MathWorks::MatlabComponents::ComponentIdentifier>::load_object_data+00303961
[ 46] 0x00007ffe61baf6ec C:\Program Files\MATLAB\R2022b\bin\win64\libmwlxemainservices.dll+00980716 mwboost::archive::detail::iserializer<mwboost::archive::text_iarchive,MathWorks::MatlabComponents::ComponentIdentifier>::load_object_data+00306028
[ 47] 0x00007ffe6194c0d3 C:\Program Files\MATLAB\R2022b\bin\win64\m_interpreter.dll+00573651 inCallFcnWithTrapInDesiredWSAndPublishEvents+00000099
[ 48] 0x00007ffe6224e922 C:\Program Files\MATLAB\R2022b\bin\win64\iqm.dll+00715042 iqm::BaseFEvalPlugin::inCallFcnWithTrap+00000066
[ 49] 0x00007ffe6224e1f2 C:\Program Files\MATLAB\R2022b\bin\win64\iqm.dll+00713202 iqm::BaseFEvalPlugin::execute+00000466
[ 50] 0x00007ffe6224e002 C:\Program Files\MATLAB\R2022b\bin\win64\iqm.dll+00712706 iqm::FEvalPlugin<cmddistributor::FEvalIIP>::execute+00000018
[ 51] 0x00007ffe62372080 C:\Program Files\MATLAB\R2022b\bin\win64\mcr.dll+00401536 mcrInstantiationError::operator=+00082192
[ 52] 0x00007ffe622571e3 C:\Program Files\MATLAB\R2022b\bin\win64\iqm.dll+00750051 iqm::DelegateToAnotherIqmPlugin::execute+00000019
[ 53] 0x00007ffe552fbede C:\Program Files\MATLAB\R2022b\bin\win64\jmi.dll+00638686 LoadJAWTLibrary+00009934
[ 54] 0x00007ffe62238a4c C:\Program Files\MATLAB\R2022b\bin\win64\iqm.dll+00625228 iqm::Iqm::setupIqmFcnPtrs+00097324
[ 55] 0x00007ffe62209c12 C:\Program Files\MATLAB\R2022b\bin\win64\iqm.dll+00433170 iqm::Iqm::create+00007586
[ 56] 0x00007ffe6211311e C:\Program Files\MATLAB\R2022b\bin\win64\libmwbridge.dll+00078110 ioReadLine+00000430
[ 57] 0x00007ffe62112f35 C:\Program Files\MATLAB\R2022b\bin\win64\libmwbridge.dll+00077621 ioReadLine+00000165
[ 58] 0x00007ffe62144a10 C:\Program Files\MATLAB\R2022b\bin\win64\libmwbridge.dll+00281104 mnGetCommandLineBuffer+00000288
[ 59] 0x00007ffe62144ea2 C:\Program Files\MATLAB\R2022b\bin\win64\libmwbridge.dll+00282274 mnParser+00000466
[ 60] 0x00007ffe62377c64 C:\Program Files\MATLAB\R2022b\bin\win64\mcr.dll+00425060 mcr_set_enableReadingFromStdin+00013524
[ 61] 0x00007ffe623287f3 C:\Program Files\MATLAB\R2022b\bin\win64\mcr.dll+00100339 mcrFunctionSignature::set_signature+00080067
[ 62] 0x00007ffe62346050 C:\Program Files\MATLAB\R2022b\bin\win64\mcr.dll+00221264 mwboost::archive::codecvt_null<wchar_t>::`default constructor closure'+00017616
[ 63] 0x00007ffe622620ca C:\Program Files\MATLAB\R2022b\bin\win64\iqm.dll+00794826 iqm::PackagedTaskPlugin::execute+00000074
[ 64] 0x00007ffe62372350 C:\Program Files\MATLAB\R2022b\bin\win64\mcr.dll+00402256 mcrInstantiationError::operator=+00082912
[ 65] 0x00007ffe62238a4c C:\Program Files\MATLAB\R2022b\bin\win64\iqm.dll+00625228 iqm::Iqm::setupIqmFcnPtrs+00097324
[ 66] 0x00007ffe6220ade1 C:\Program Files\MATLAB\R2022b\bin\win64\iqm.dll+00437729 iqm::Iqm::create+00012145
[ 67] 0x00007ffe6220a529 C:\Program Files\MATLAB\R2022b\bin\win64\iqm.dll+00435497 iqm::Iqm::create+00009913
[ 68] 0x00007ffe623606dc C:\Program Files\MATLAB\R2022b\bin\win64\mcr.dll+00329436 mcrInstantiationError::operator=+00010092
[ 69] 0x00007ffe62361105 C:\Program Files\MATLAB\R2022b\bin\win64\mcr.dll+00332037 mcrInstantiationError::operator=+00012693
[ 70] 0x00007ffe6235ea00 C:\Program Files\MATLAB\R2022b\bin\win64\mcr.dll+00322048 mcrInstantiationError::operator=+00002704
[ 71] 0x00007ffed2aa855a C:\Program Files\MATLAB\R2022b\bin\win64\mwboost_thread-vc142-mt-x64-1_75.dll+00034138 mwboost::thread::swap+00000074
[ 72] 0x00007fff18f01bb2 C:\WINDOWS\System32\ucrtbase.dll+00138162 configthreadlocale+00000146
[ 73] 0x00007fff1afb7344 C:\WINDOWS\System32\KERNEL32.DLL+00095044 BaseThreadInitThunk+00000020
[ 74] 0x00007fff1b2e26b1 C:\WINDOWS\SYSTEM32\ntdll.dll+00337585 RtlUserThreadStart+00000033
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.
I
0 Comments
Answers (1)
Edric Ellis
on 1 Dec 2023
That crash dump clearly implicates your MEX file octtrees.query_index_moct. One of the common pitfalls when running MEX files in parallel is omitting setup or teardown phases if the code references static data or similar.
What problems do you see when you remove calls to that MEX file from your parfor code?
2 Comments
Edric Ellis
on 4 Dec 2023
I would suggest first trying to narrow down the problem - if the problem is (relatively) quick and easy to reproduce, then iterate by taking anything out of the MEX source that isn't involved in the crash. Try reproducing on a pool of just 1 worker. Think about any setup phase you're running on the client, and think about whether you need to run this on the workers too. (I'd also be willing to bet the crash can be reproduced on a client if you call it in the right way...). Take a careful look at any static data in the MEX file. If you're still struggling, then either post the simplified code that still reproduces the problem, or use the main MathWorks support channel.
See Also
Categories
Find more on Platform and License in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!