[2021a] Hanging for several minutes in getSettingsRoot/mlock

6 views (last 30 days)
I've been noticing an intermittent issue where MATLAB will take several minutes to run a piece of code instead of the usual <1 second. This occurs across many functions with no apparent pattern.
When I hit "Pause" in the debugger it always gives control back on line 2 of matlab.internal.getSettingsRoot, calling mlock. Running dbstack shows the call stack at sort of nonsensical locations, such as an if isempty() call.
This just started happening in the last few days and my colleagues are unable to reproduce this at all. When I use the "Step Out" feature of the debugger I can copy-paste the function call that took several minutes and then it takes less than a second, so I can't even reproduce it on the same piece of code.
My only guess is it has something to do with MATLAB internally checking my license or something? Maybe an issue with the debugger? Any help would be greatly appreciated, I found very little information regarding the purpose of getSettingsRoot.
  3 Comments
G Bielsa
G Bielsa on 13 Oct 2022
Hi, Im facing the same issue. Matlab gets stuck in that function, but unfortunately in my case, the simulations that should take an hour take couple of hours...
Julian H
Julian H on 4 Nov 2023
I am facing the same issue on MATLAB 2022b. It's very hard to trace what is actually causing this since the origin of the paused call stack seems almost arbitrary. It just always ends at C:\Program Files\MATLAB\R2022b\toolbox\matlab\configtools\+matlab\+internal\getSettingsRoot.m line 2.
Depending on the code structure, it is possible to breakpoint, go up the call stack, and just F9 the subsequent code. But that obviously only works if it gets stuck at the highest call level.
Ctrl + C also doesn't work in this scenario, nor does trying to close the application normally. It is necessary to kill the MATLAB process to get out of it.
If I profile my code, I get this as the main time sink:
ParallelSettingsUpgrader>iGetVersionSetting (Calls: 1, Time: 1301.653 s)
with most time spent on
if ~parallelRoot.hasGroup(ParallelSettingsTree.VersionNodeName)

Sign in to comment.

Answers (1)

Pratik
Pratik on 14 Feb 2024
Hi Russell,
As per my understanding, there is siginficant slow down in performance of your MATLAB code and MATLAB gets "stuck" in the mlock in getSettingsRoot.
From the limited information available, it can be deduced that the issue can be because of the Version upgrade of MATLAB. Due to change in architecture of some function, it might have significantlly slowed down.
As a workaround to this issue, previous version of MATLAB can be used. However, if it is necessary to use the latest version, you may need to restructure your code to reduce the number of calls to the function. MATLAB Profiler can be used to identify the bottleneck function.
Please refer to the documentation of MATLAB Profiler for more information:
I hope this helps!

Categories

Find more on Scope Variables and Generate Names in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!