pylance-release icon indicating copy to clipboard operation
pylance-release copied to clipboard

Remote extension host terminates unexpectedly

Open SKra00 opened this issue 1 year ago • 15 comments

Type: Bug

I am remote SSHing into a Linux server from a Windows machine using VSCode. I have the pylance extension, but as soon as I login to the server it restarts the remote extension host several times before giving up and occasionally kicking me out of the server. I used the extension bisect tool in VSCode, which determined that pylance was the cause. Disabling the extension fixes the problem. I have also tried downgrading the extension which has allowed me to remain connected for slightly longer, but not forever. (Apologies if this is not descriptive enough, I am happy to supply more information.)

Extension version: 2024.5.1 VS Code version: Code 1.89.0 (b58957e67ee1e712cebf466b995adf4c5307b2bd, 2024-05-01T02:09:22.859Z) OS version: Windows_NT x64 10.0.22631 Modes: Connection to 'ssh-remote+ap2002.chtc.wisc.edu' could not be established

System Info
Item Value
CPUs Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz (8 x 1992)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) undefined
Memory (System) 15.88GB (2.88GB free)
Process Argv --crash-reporter-id d100a373-6af0-4ce5-92e5-3770ea91b189
Screen Reader no
VM 0%

Connection to 'ssh-remote+ap2002.chtc.wisc.edu' could not be established

A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
tftest:31042121
vscorecescf:30445987
vscod805cf:30301675
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
pythongtdpath:30769146
welcomedialogc:30910334
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
2e7ec940:31000449
pythontbext0:30879054
accentitlementst:30995554
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
g316j359:31013175
a69g1124:31038041
pythonprt:31039817
dwnewjupytercf:31039676

SKra00 avatar May 08 '24 21:05 SKra00

Can you provide us some logs as described in the troubleshooting guide?

heejaechang avatar May 08 '24 21:05 heejaechang

Can you provide us some logs as described in the troubleshooting guide?

I tried to enable the trace log level (at the User, Remote Server, and Workspace levels) but the Python Language Server output contains nothing at all. Is there another log I can provide that would contain the needed information?

SKra00 avatar May 08 '24 22:05 SKra00

When you say "contains nothing at all", do you mean there's no output at all in the Python Language Server output? Not sure how could that happen. Can you share a screenshot of that? and your settings.json?

StellaHuang95 avatar May 09 '24 17:05 StellaHuang95

When you say "contains nothing at all", do you mean there's no output at all in the Python Language Server output? Not sure how could that happen. Can you share a screenshot of that? and your settings.json?

Here is a screenshot of the Python Language Server output: image

And here is a screenshot of the Python output just to show that this is not a more general output problem: image

Here is the text of the settings.json file:

{
    "editor.minimap.enabled": false,
    "jupyter.askForKernelRestart": false,
    "python.autoComplete.extraPaths": [],
    "python.analysis.extraPaths": [],
    "remote.SSH.remotePlatform": {
        "ap2002.chtc.wisc.edu": "linux"
    },
    "python.defaultInterpreterPath": "C:\\ProgramData\\anaconda3\\envs\\<USER'S NAME>\\python.exe",
    "git.ignoreLegacyWarning": true,
    "remote.SSH.useExecServer": false,
    "python.analysis.logLevel": "Trace",
    "python.analysis.packageIndexDepths": [
        {
            "name": "sklearn",
            "depth": 2
        },
        {
            "name": "matplotlib",
            "depth": 2
        },
        {
            "name": "scipy",
            "depth": 2
        },
        {
            "name": "django",
            "depth": 2
        },
        {
            "name": "flask",
            "depth": 2
        },
        {
            "name": "fastapi",
            "depth": 2
        }
    ]
}

SKra00 avatar May 09 '24 17:05 SKra00

if you are using remote and multi root workspace, make sure you are putting settings in right place and share the right setting files.

you should have settings section similar to this for your remote/workspace/folder image

the precedence of setting will be folder > workspace > remote

and some setting can only applied to certain scope. for example, you can't put logLevel to folder but in workspace and up and etc.

heejaechang avatar May 09 '24 18:05 heejaechang

since it looks like pylance is crashing even before starting server, you probably can't use https://github.com/microsoft/pylance-release/wiki/Collecting-data-for-an-investigation.#collecting-trace-logs-using-commands but if you somehow could manage to make server to start you could use the command to get log we need.

heejaechang avatar May 09 '24 18:05 heejaechang

if you are using remote and multi root workspace, make sure you are putting settings in right place and share the right setting files.

you should have settings section similar to this for your remote/workspace/folder image

the precedence of setting will be folder > workspace > remote

and some setting can only applied to certain scope. for example, you can't put logLevel to folder but in workspace and up and etc.

I have set the loglevel setting to Trace at the User, Remote, and Workspace levels just to make sure I had the right one. The Folder option does not have this setting available as far as I can tell.

SKra00 avatar May 10 '24 00:05 SKra00

since it looks like pylance is crashing even before starting server, you probably can't use https://github.com/microsoft/pylance-release/wiki/Collecting-data-for-an-investigation.#collecting-trace-logs-using-commands but if you somehow could manage to make server to start you could use the command to get log we need.

I have used slightly downgraded versions of pylance recently that will successfully load/connect for a while before restarting the remote extension host. I just connected with v2024.2.3 and was able to get output in the Python Language Server. I will wait to see if the restart issue occurs and report back with the output.

SKra00 avatar May 10 '24 00:05 SKra00

After downgrading to v2024.2.1, I was able to connect to my remote ssh with pylance functioning properly, but after waiting some time in the editor pylance seemed to stutter and disconnect. It attempted to reconnect a couple times before successfully doing so. I am attaching the python language server output starting at the moment it initially disconnected.

Please note: this is NOT the exact issue I have with newer versions of pylance. If I use the most recent version, it fails to connect at all upon logging in through the ssh process. pylance python language server output v2024.2.1.txt

SKra00 avatar May 13 '24 18:05 SKra00

I can not see any issue on pylance log, it looks like pylance extension suddenly restarted. can you look other logs in the output window and see whether it contains error message such as remote got disconnected? if you see one, can you share that log with us? it might be an issue with vscode remote and we just happen to restarted since vscode-server got re-initialized.

heejaechang avatar May 13 '24 18:05 heejaechang

I can not see any issue on pylance log, it looks like pylance extension suddenly restarted. can you look other logs in the output window and see whether it contains error message such as remote got disconnected? if you see one, can you share that log with us? it might be an issue with vscode remote and we just happen to restarted since vscode-server got re-initialized.

I monitored a couple of the logs while trying to recreate the issue, but I could not seem to identify any that would provide useful information as to what is happening. Here is the list of logs available: image

For example, Extension Host (Remote) seemed promising, but it appears to clear/restart whenever this occurs, so I cannot see what happened prior to the issue occurring.

Are there any you would like to see specifically?

SKra00 avatar May 14 '24 20:05 SKra00

how about remote - SSH log? does it contain anything interesting there?

heejaechang avatar May 14 '24 21:05 heejaechang

how about remote - SSH log? does it contain anything interesting there?

Nothing is very interesting in that log either. For example, here is all the additional output produced by this issue occurring once:

[16:17:13.840] [Forwarding server port 52873] Got connection 9

The integer at the end increases every time this happens (starts at 1).

SKra00 avatar May 14 '24 21:05 SKra00

could it be something related to something like this? https://stackoverflow.com/questions/64172004/vscode-ssh-extension-keeps-disconnecting-after-moving-to-a-new-location

heejaechang avatar May 14 '24 22:05 heejaechang

could it be something related to something like this? https://stackoverflow.com/questions/64172004/vscode-ssh-extension-keeps-disconnecting-after-moving-to-a-new-location

I tried the suggested solution of removing the .vscode-server and .vscode-remote (this second one did not exist in my case, so I only removed the first one), but it did not fix the issue. The Remote Extension host still terminates upon logging in via ssh when using the most recent version of pylance.

SKra00 avatar May 15 '24 00:05 SKra00

Were there any fixes for this? It's rather annoying hehe.

ACE07-Sev avatar Apr 18 '25 16:04 ACE07-Sev

Were there any fixes for this? It's rather annoying hehe.

Ultimately, I found no solution other than downgrading pylance to a version that didn't cause the issue. However, after more recent updates to pylance, the issue stopped occurring. I'm not sure what was changed, but I haven't had the issue since (knock on wood).

SKra00 avatar Apr 18 '25 16:04 SKra00

Thanks for the prompt response!

I have latest, but it's happening all the time. What version are you using right now?

ACE07-Sev avatar Apr 18 '25 16:04 ACE07-Sev

v2025.4.1

SKra00 avatar Apr 18 '25 18:04 SKra00

@SKra00 I have the same version, and am on the latest vscode version. Then it's something else I guess.

ACE07-Sev avatar Apr 19 '25 10:04 ACE07-Sev

Here's my log (I reproduced the crash)

2025-04-19 19:02:38.405 [info] (Client) Pylance async client (2025.4.1) started with python extension (2025.4.0)
2025-04-19 19:02:38.553 [info] [Info  - 7:02:38 PM] (7068) Loading pyproject.toml file at /home/ace07/Documents/GitHub/QICKIT/pyproject.toml
2025-04-19 19:02:38.560 [info] [Info  - 7:02:38 PM] (7068) Setting environmentName for service "QICKIT": "3.11.11 (.venv venv)"
2025-04-19 19:02:38.563 [info] [Info  - 7:02:38 PM] (7068) Setting pythonPath for service "QICKIT": "/home/ace07/Documents/GitHub/QICKIT/.venv/bin/python"
2025-04-19 19:02:38.570 [info] [Info  - 7:02:38 PM] (7068) No include entries specified; assuming /home/ace07/Documents/GitHub/QICKIT
2025-04-19 19:02:38.574 [info] [Info  - 7:02:38 PM] (7068) Auto-excluding **/node_modules
2025-04-19 19:02:38.575 [info] [Info  - 7:02:38 PM] (7068) Auto-excluding **/__pycache__
2025-04-19 19:02:38.587 [info] [Info  - 7:02:38 PM] (7068) Auto-excluding **/.*
2025-04-19 19:02:38.588 [info] [Info  - 7:02:38 PM] (7068) Assuming Python version 3.11.11.final.0
2025-04-19 19:02:38.769 [info] [Info  - 7:02:38 PM] (7068) Found 187 source files
2025-04-19 19:02:38.944 [info] [Info  - 7:02:38 PM] (7068) Loading pyproject.toml file at /home/ace07/Documents/GitHub/QICKIT/pyproject.toml
2025-04-19 19:02:39.063 [info] [Info  - 7:02:39 PM] (7068) Setting environmentName for service "QICKIT": "3.11.11 (.venv venv)"
2025-04-19 19:02:39.071 [info] [Info  - 7:02:39 PM] (7068) Setting pythonPath for service "QICKIT": "/home/ace07/Documents/GitHub/QICKIT/.venv/bin/python"
2025-04-19 19:02:39.072 [info] [Info  - 7:02:39 PM] (7068) No include entries specified; assuming /home/ace07/Documents/GitHub/QICKIT
2025-04-19 19:02:39.073 [info] [Info  - 7:02:39 PM] (7068) Auto-excluding **/node_modules
2025-04-19 19:02:39.073 [info] [Info  - 7:02:39 PM] (7068) Auto-excluding **/__pycache__
2025-04-19 19:02:39.073 [info] [Info  - 7:02:39 PM] (7068) Auto-excluding **/.*
2025-04-19 19:02:39.074 [info] [Info  - 7:02:39 PM] (7068) Assuming Python version 3.11.11.final.0
2025-04-19 19:02:39.074 [info] [Info  - 7:02:39 PM] (7068) Found 187 source files
2025-04-19 19:02:39.116 [info] [Info  - 7:02:39 PM] (7068) BG: Priority queue background worker(2) root directory: file:///home/ace07/.vscode-server/extensions/ms-python.vscode-pylance-2025.4.1/dist
2025-04-19 19:02:39.120 [info] [Info  - 7:02:39 PM] (7068) BG: Priority queue background worker(2) started
2025-04-19 19:02:39.346 [info] [Info  - 7:02:39 PM] (7068) BG: Indexer background runner(3) root directory: file:///home/ace07/.vscode-server/extensions/ms-python.vscode-pylance-2025.4.1/dist (index)
2025-04-19 19:02:39.347 [info] [Info  - 7:02:39 PM] (7068) BG: Indexing(3) started
2025-04-19 19:02:40.240 [info] [Info  - 7:02:40 PM] (7068) BG: scanned(3) 361 files over 1 exec env
2025-04-19 19:02:40.444 [info] [Info  - 7:02:40 PM] (7068) BG: indexed(3) 361 files over 1 exec env
2025-04-19 19:02:40.561 [info] [Info  - 7:02:40 PM] (7068) BG: Indexing finished(3).
2025-04-19 19:02:52.636 [info] [Info  - 7:02:52 PM] (7068) BG: [BG(1)] Long operation: checking: file:///home/ace07/Documents/GitHub/QICKIT/tests/circuit/test_cirq_circuit.py (2960ms)
2025-04-19 19:02:52.637 [info] [Info  - 7:02:52 PM] (7068) BG: [BG(1)] Long operation: analyzing: file:///home/ace07/Documents/GitHub/QICKIT/tests/circuit/test_cirq_circuit.py (2960ms)
2025-04-19 19:02:55.585 [info] [Info  - 7:02:55 PM] (7068) BG: [BG(1)] Long operation: checking: file:///home/ace07/Documents/GitHub/QICKIT/tests/circuit/test_pennylane_circuit.py (2824ms)
2025-04-19 19:02:55.585 [info] [Info  - 7:02:55 PM] (7068) BG: [BG(1)] Long operation: analyzing: file:///home/ace07/Documents/GitHub/QICKIT/tests/circuit/test_pennylane_circuit.py (2825ms)
2025-04-19 19:02:58.287 [info] [Info  - 7:02:58 PM] (7068) BG: [BG(1)] Long operation: checking: file:///home/ace07/Documents/GitHub/QICKIT/tests/circuit/test_qiskit_circuit.py (2653ms)
2025-04-19 19:02:58.287 [info] [Info  - 7:02:58 PM] (7068) BG: [BG(1)] Long operation: analyzing: file:///home/ace07/Documents/GitHub/QICKIT/tests/circuit/test_qiskit_circuit.py (2654ms)
2025-04-19 19:03:00.216 [info] [Info  - 7:03:00 PM] (7068) Starting service instance "<default>" for workspace ""
2025-04-19 19:03:00.239 [info] [Info  - 7:03:00 PM] (7068) Setting environmentName for service "<default>": "3.11.11 (.venv venv)"
2025-04-19 19:03:00.239 [info] [Info  - 7:03:00 PM] (7068) Setting pythonPath for service "<default>": "/home/ace07/Documents/GitHub/QICKIT/.venv/bin/python"
2025-04-19 19:03:00.239 [info] [Info  - 7:03:00 PM] (7068) No include entries specified; assuming /<default workspace root>
2025-04-19 19:03:00.239 [info] [Info  - 7:03:00 PM] (7068) Auto-excluding **/node_modules
2025-04-19 19:03:00.239 [info] [Info  - 7:03:00 PM] (7068) Auto-excluding **/__pycache__
2025-04-19 19:03:00.239 [info] [Info  - 7:03:00 PM] (7068) Auto-excluding **/.*
2025-04-19 19:03:00.256 [info] [Info  - 7:03:00 PM] (7068) Assuming Python version 3.11.11.final.0
2025-04-19 19:03:00.302 [info] [Error - 7:03:00 PM] (7068) File or directory "/<default workspace root>" does not exist.
2025-04-19 19:03:00.302 [info] [Info  - 7:03:00 PM] (7068) No source files found.
2025-04-19 19:03:00.679 [info] [Info  - 7:03:00 PM] (7068) BG: Priority queue background worker(5) root directory: file:///home/ace07/.vscode-server/extensions/ms-python.vscode-pylance-2025.4.1/dist
2025-04-19 19:03:00.679 [info] [Info  - 7:03:00 PM] (7068) BG: Priority queue background worker(5) started
2025-04-19 19:03:19.956 [info] (Client) Pylance async client (2025.4.1) started with python extension (2025.4.0)
2025-04-19 19:03:20.350 [info] [Info  - 7:03:20 PM] (7873) Server root directory: file:///home/ace07/.vscode-server/extensions/ms-python.vscode-pylance-2025.4.1/dist
2025-04-19 19:03:20.351 [info] [Info  - 7:03:20 PM] (7873) Pylance language server 2025.4.1 (pyright version 1.1.398, commit 4f24eccc) starting
2025-04-19 19:03:20.352 [info] [Info  - 7:03:20 PM] (7873) Starting service instance "QICKIT" for workspace "/home/ace07/Documents/GitHub/QICKIT"
2025-04-19 19:03:20.668 [info] [Info  - 7:03:20 PM] (7873) Loading pyproject.toml file at /home/ace07/Documents/GitHub/QICKIT/pyproject.toml
2025-04-19 19:03:20.670 [info] [Info  - 7:03:20 PM] (7873) Setting environmentName for service "QICKIT": "3.11.11 (.venv venv)"
2025-04-19 19:03:20.671 [info] [Info  - 7:03:20 PM] (7873) Setting pythonPath for service "QICKIT": "/home/ace07/Documents/GitHub/QICKIT/.venv/bin/python"
2025-04-19 19:03:20.672 [info] [Info  - 7:03:20 PM] (7873) No include entries specified; assuming /home/ace07/Documents/GitHub/QICKIT
2025-04-19 19:03:20.672 [info] [Info  - 7:03:20 PM] (7873) Auto-excluding **/node_modules
2025-04-19 19:03:20.672 [info] [Info  - 7:03:20 PM] (7873) Auto-excluding **/__pycache__
2025-04-19 19:03:20.672 [info] [Info  - 7:03:20 PM] (7873) Auto-excluding **/.*
2025-04-19 19:03:20.691 [info] [Info  - 7:03:20 PM] (7873) Assuming Python version 3.11.11.final.0
2025-04-19 19:03:20.799 [info] [Info  - 7:03:20 PM] (7873) Found 187 source files
2025-04-19 19:03:20.817 [info] [Info  - 7:03:20 PM] (7873) Loading pyproject.toml file at /home/ace07/Documents/GitHub/QICKIT/pyproject.toml
2025-04-19 19:03:20.817 [info] [Info  - 7:03:20 PM] (7873) Setting environmentName for service "QICKIT": "3.11.11 (.venv venv)"
2025-04-19 19:03:20.818 [info] [Info  - 7:03:20 PM] (7873) Setting pythonPath for service "QICKIT": "/home/ace07/Documents/GitHub/QICKIT/.venv/bin/python"
2025-04-19 19:03:20.818 [info] [Info  - 7:03:20 PM] (7873) No include entries specified; assuming /home/ace07/Documents/GitHub/QICKIT
2025-04-19 19:03:20.819 [info] [Info  - 7:03:20 PM] (7873) Auto-excluding **/node_modules
2025-04-19 19:03:20.819 [info] [Info  - 7:03:20 PM] (7873) Auto-excluding **/__pycache__
2025-04-19 19:03:20.819 [info] [Info  - 7:03:20 PM] (7873) Auto-excluding **/.*
2025-04-19 19:03:20.839 [info] [Info  - 7:03:20 PM] (7873) Assuming Python version 3.11.11.final.0
2025-04-19 19:03:20.918 [info] [Info  - 7:03:20 PM] (7873) Found 187 source files
2025-04-19 19:03:21.214 [info] [Info  - 7:03:21 PM] (7873) BG: Priority queue background worker(2) root directory: file:///home/ace07/.vscode-server/extensions/ms-python.vscode-pylance-2025.4.1/dist
2025-04-19 19:03:21.214 [info] [Info  - 7:03:21 PM] (7873) BG: Priority queue background worker(2) started
2025-04-19 19:03:21.872 [info] [Info  - 7:03:21 PM] (7873) BG: Indexer background runner(3) root directory: file:///home/ace07/.vscode-server/extensions/ms-python.vscode-pylance-2025.4.1/dist (index)
2025-04-19 19:03:21.873 [info] [Info  - 7:03:21 PM] (7873) BG: Indexing(3) started
2025-04-19 19:03:22.202 [info] [Info  - 7:03:22 PM] (7873) BG: scanned(3) 361 files over 1 exec env
2025-04-19 19:03:22.481 [info] [Info  - 7:03:22 PM] (7873) BG: indexed(3) 361 files over 1 exec env
2025-04-19 19:03:22.604 [info] [Info  - 7:03:22 PM] (7873) BG: Indexing finished(3).
2025-04-19 19:03:36.153 [info] [Info  - 7:03:36 PM] (7873) BG: [BG(1)] Long operation: checking: file:///home/ace07/Documents/GitHub/QICKIT/tests/circuit/test_cirq_circuit.py (3000ms)
2025-04-19 19:03:36.153 [info] [Info  - 7:03:36 PM] (7873) BG: [BG(1)] Long operation: analyzing: file:///home/ace07/Documents/GitHub/QICKIT/tests/circuit/test_cirq_circuit.py (3000ms)
2025-04-19 19:03:39.111 [info] [Info  - 7:03:39 PM] (7873) BG: [BG(1)] Long operation: checking: file:///home/ace07/Documents/GitHub/QICKIT/tests/circuit/test_pennylane_circuit.py (2840ms)
2025-04-19 19:03:39.111 [info] [Info  - 7:03:39 PM] (7873) BG: [BG(1)] Long operation: analyzing: file:///home/ace07/Documents/GitHub/QICKIT/tests/circuit/test_pennylane_circuit.py (2840ms)
2025-04-19 19:03:42.045 [info] [Info  - 7:03:42 PM] (7873) BG: [BG(1)] Long operation: checking: file:///home/ace07/Documents/GitHub/QICKIT/tests/circuit/test_qiskit_circuit.py (2884ms)
2025-04-19 19:03:42.045 [info] [Info  - 7:03:42 PM] (7873) BG: [BG(1)] Long operation: analyzing: file:///home/ace07/Documents/GitHub/QICKIT/tests/circuit/test_qiskit_circuit.py (2884ms)
2025-04-19 19:03:44.894 [info] [Info  - 7:03:44 PM] (7873) BG: [BG(1)] Long operation: checking: file:///home/ace07/Documents/GitHub/QICKIT/tests/circuit/test_quimb_circuit.py (2846ms)
2025-04-19 19:03:44.894 [info] [Info  - 7:03:44 PM] (7873) BG: [BG(1)] Long operation: analyzing: file:///home/ace07/Documents/GitHub/QICKIT/tests/circuit/test_quimb_circuit.py (2846ms)
2025-04-19 19:03:47.763 [info] [Info  - 7:03:47 PM] (7873) BG: [BG(1)] Long operation: checking: file:///home/ace07/Documents/GitHub/QICKIT/tests/circuit/test_tket_circuit.py (2865ms)
2025-04-19 19:03:47.763 [info] [Info  - 7:03:47 PM] (7873) BG: [BG(1)] Long operation: analyzing: file:///home/ace07/Documents/GitHub/QICKIT/tests/circuit/test_tket_circuit.py (2865ms)

Here's where it exactly crashed

2025-04-19 19:03:19.956 [info] (Client) Pylance async client (2025.4.1) started with python extension (2025.4.0)

ACE07-Sev avatar Apr 19 '25 11:04 ACE07-Sev