JuliaInterop / JuliaInterop/MATLAB.jl

How to shut down engine on Windows 10?

Open
#166 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
286
Forks
64
PR merge metrics
No merged PRs in 30d

Description

I have tried several different methods to shut down the Matlab engine, before logging out of a Jupyter notebook running a Julia 1.3 kernel in Firefox on a Windows-10 box. (I never explicitly launch the engine, just use mat"" commands.) When I restart the notebook (and the Julia kernel), then import MATLAB.jl, my Matlab workspace variables and path from the previous session are all still there. And Windows TaskManager shows a MATLAB process running. Of course I can just use TaskManager to "End task" - but that seems rather indirect.

The only way I have found to shut down the engine within the notebook is to do

MATLAB.mat"quit"

which results in

MATLAB.MEngineError("invalid engine session (err = 1)")

followed by

MATLAB.close_default_msession()
MATLAB.restart_default_msession()

which crashes the Julia kernel. Sometimes the kernel restarts on its own, other times I need to use the menu Kernel->Restart.

Please advise.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the shutdown sequence in a Jupyter notebook on Windows 10, focusing on MATLAB.mat"quit", MATLAB.close_default_msession(), and MATLAB.restart_default_msession(). Confirm whether the MATLAB process can be terminated without an invalid engine error or Julia kernel crash.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, matlab
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.