Multiple Instances of MATLAB operating on Simulink Data Dictionaries can lead to crash or errors "database slddc is locked"
27 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MathWorks Support Team
le 20 Août 2025
Modifié(e) : MathWorks Support Team
le 13 Oct 2025 à 13:06
I am running multiple MATLAB instance on my machine that operate on Simulink Data Dictionaries. This could be either:
- Multiple MATLAB's started at the same time by calling the matlab executable in a batch or similar script.
- Multiple MATLAB workers using parfeval, parfor, etc and doing Simulink Data Dictionary operations on these workers.
In some cases I get this error:
The database \\?\C:\Users\rspence\AppData\Local\Temp\data_model_repository3.4_R2023b_v1_rspence.slddc is locked, or a table in the database is locked. (database is locked)
In other cases I get a MATLAB Crash where the stacktrace points to something in Simulink Data Dictionary.
What could be the cause?
Réponse acceptée
MathWorks Support Team
le 20 Août 2025
Modifié(e) : MathWorks Support Team
le 13 Oct 2025 à 13:06
Simulink Data Dictionaries use a cache file in the tempdir called the SLDDC file. These files assume only one MATLAB instance doing SLDD operations at a time. If multiple MATLAB instances try to access this file at the same time, it could lead to errors or crashes.
To avoid this issue with multiple MATLAB Instances, give each MATLAB Instance its own tempdir. To do this, set the environment variable for the temporary directory before starting MATLAB. For Linux and MAC the temporary directory is set by the environment variable 'TMPDIR'. For Windows the environment variable is 'TEMP' and/or 'TMP'.
To avoid this issue for MATLAB workers in a Parallel Pool, use the function Simulink.data.dictionary.setupWorkerCache to give each worker its own Data Dictionary cache. Note that Simulink specific parallel functions like parsim, batchsim, and parallel build already do this setup for you.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Simulink Functions dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!