Clear Filters
Clear Filters

How to get rid of a zombie Matlab engine?

6 views (last 30 days)
Jaron Kurk
Jaron Kurk on 7 Mar 2019
Commented: Csaba on 24 Aug 2022
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
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.

Sign in to comment.

Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!