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

Unable to connect to MATLAB 2023b using extension on macOS Sonoma #92

Closed jecs closed 7 months ago

jecs commented 7 months ago

Describe the bug VSCode fails to connect to MATLAB, even though it starts a new process every time, as verified on System Monitor.

To Reproduce

  1. Run "Connect to MATLAB" command
  2. Wait a few seconds, until the message "MATLAB has been closed. Some functionality might not be available." pops up.

Expected behavior I expect a connection to be established and for VSCode to only launch one instance.

Useful Information

Additional context Here are the extension logs:

(18:20:40) matlabls: Launching MATLAB...
(18:20:45) matlabls: Started MATLAB
[Warn  - 6:20:45 PM] (18:20:45) matlabls - WARNING: Error while communicating with MATLAB - disconnecting
dklilley commented 7 months ago

Thank you for sharing this info!

Here are a few additional questions which would be helpful:

  1. Do you have a HTTP/HTTPS proxy set up on your machine? For example, the following environment variables may be set: HTTP_PROXY, HTTPS_PROXY, and NO_PROXY
  2. Try the following steps and share the output:
    1. First, make sure there are no MATLAB instances running on your machine
    2. Attempt to connect to MATLAB in VS Code
    3. Run the following command from a system Terminal: sudo lsof -i -P -n > lsof.txt
      • This will gather data about the processes running on your machine
    4. In the generated lsof.txt file, find the entry for MATLAB. It should look something like the following: MATLAB 12345 username 1120u IPv4 123456123 0t0 TCP 127.0.0.1:35737 (LISTEN)
    5. Find the port number that your MATLAB is listening on. In the above example, it is port 35737.
    6. The following command will attempt to query MATLAB on this port. Please run this command (swapping in your port number) and share the output with us: curl -v -k https://127.0.0.1:35737
jecs commented 7 months ago

Of course. Thank you for your reply!

  1. I checked in System Settings under Network and could not find a proxy under the Ethernet device that I am using. I also checked for those environment variables, but they were unset:
    
    ~ % echo $HTTP_PROXY

~ % echo $HTTPS_PROXY

~ % echo $NO_PROXY


The only thing that *might* be interfering is the Falcon content filter that the university/hospital requires on this machine. I have had no issues with it so far.

2. I followed your instructions. I made sure that no instances of MATLAB were running by Force Quitting the zombie instances using System Monitor. I attempted to connect once. I see two instances of MATLAB running now. `lsof` lists a couple of ports that are listed with `(LISTEN)` and do not have established connections. I attach one for the first process and one for the second.
[curl1.txt](https://github.com/mathworks/MATLAB-extension-for-vscode/files/14272827/curl1.txt)
[curl2.txt](https://github.com/mathworks/MATLAB-extension-for-vscode/files/14272828/curl2.txt)
wzh4464 commented 7 months ago

I have the same problem.

jecs commented 7 months ago

Figured it out! It seems that it's the "New Desktop" addon that is preventing VSCode from connecting. Disabling the new desktop resolves the issue. Not ideal for my sensitive eyes, but it's a workaround for now.

dklilley commented 7 months ago

Thanks for letting us know! This is a known issue (captured in #24) which we are working to resolve.