How to get rid of a zombie Matlab engine?
8 views (last 30 days)
Show older comments
While starting a named shared Matlab engine in R2018b, I got the following error:
Error using matlab.engine.shareEngine (line 41)
MATLAB session 'MATLABEngineX' already exists. Current MATLAB session is now shared with default name 'MATLAB_5960'.
I am using this engine from python, who actually does not see the MATLABEngineX session, only the new MATLAB_5960. The former session was indeed not closed properly and apparently turned into a zombie session.
I did not find any question regarding this issue and it took me quite some time to find out how to solve it: there is a zero-byte file in C:\Temp with the name of the engine that apparently serves as a marker for Matlab (but not for python). Manually removing this file resolved the issue.
I don't understand why Matlab needs this marker if python does not, but it would be good to include a hint in the error message. For example:
MATLAB session 'MATLABEngineX' already exists (if this is due to a session not being closed properly, remove the file C:\Temp\MATLABEngineX).
1 Comment
Csaba
on 24 Aug 2022
A session name file may be stuck in the tempdir.
Check it here:
>> tempdir
If there is an empty file with the engine name, delete it and restart Matlab.
Answers (0)
See Also
Categories
Find more on Call Python from MATLAB in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!