mathworks / MATLAB-extension-for-vscode

This extension provides support for editing MATLAB® code in Visual Studio® Code and includes features such as syntax highlighting, code analysis, navigation support, and more.
https://marketplace.visualstudio.com/items?itemName=MathWorks.language-matlab
MIT License
234 stars 15 forks source link

Background MATLAB instances not always terminating on VS Code close #61

Closed Naetmul closed 5 months ago

Naetmul commented 1 year ago

Describe the bug The background MATLAB instance does not always terminate when VS Code is closed. This leads to accumulated MATLAB processes occupying RAM and virtual memory after multiple instances of opening and closing VS Code.

To Reproduce Steps to reproduce the behavior:

  1. Start VS Code.
  2. Wait for the background MATLAB instance to start (observable in Task Manager).
  3. Close VS Code.
  4. Observe that the MATLAB instance (specifically with the path "D:\Program Files\MATLAB\R2023a\bin\win64\MATLAB.exe" "-log" "-noAppIcon" "-nosplash" "-r" "addpath(fullfile('%USERPROFILE%\.vscode-insiders\extensions\mathworks.language-matlab-1.1.3\server\out', '..', 'matlab')); initmatlabls('%USERPROFILE%\AppData\Local\Temp\matlabls_?????\matlabls_conn.json')" "-useStartupFolderPref" "-noDisplayDesktop" "") is still running in the background. This does not always occur, but it happens frequently.

Expected behavior When VS Code is closed, the background MATLAB instance should also terminate and not remain in the background.

Screenshots image

Useful Information

Additional context The extension is enabled for a workspace.

MATLAB version: R2023a Update 5 (9.14.0.2337262) Extension version: v1.1.3

I am using VS Code Insiders.

  Version: 1.83.0-insider (user setup)
  Commit: 109e1f8d8afb754ed31317f79937a44e98d5063b
  Date: 2023-09-25T10:41:26.295Z
  Electron: 25.8.2
  ElectronBuildId: 23977753
  Chromium: 114.0.5735.289
  Node.js: 18.15.0
  V8: 11.4.183.29-electron.0
  OS: Windows_NT x64 10.0.19045
ChristianStadelmann commented 10 months ago

Same here. In my case, the Matlab process has 2 subprocesses, mwdocsearch.exe and conhost.exe. grafik

dklilley commented 6 months ago

Hi @Naetmul, I believe this should be improved in the newest version of the extension (v1.2.1). Can you try this out and let us know if you see a reduction in leaking MATLAB instances?

Thanks!

Naetmul commented 5 months ago

Thank you for the update regarding the newest version (v1.2.1) of the extension. I am currently using a different system (Windows 11), with the updated version of the extension, and I can confirm that the issue of lingering MATLAB processes does not occur on this system.

This observation suggests that the improvements might be effective. However, as the conditions differ from my original setup, I cannot confirm this conclusively.

dklilley commented 5 months ago

Thank you for trying this out!

dklilley commented 5 months ago

Closing this issue for now, as this should have been improved. I am happy to reopen if more reports of this arise.