microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.56k stars 29.01k forks source link

Debugging a cell leads to a loop of `Invalid message: Session is already initialized` pop-up notifications #164676

Closed michaelweinold closed 1 year ago

michaelweinold commented 1 year ago

Type: Bug

When connected to a server via SSH, debugging a cell in a Jupyter notebook leads to pop-up window that keeps appearing, even if closed. The only remedy is to kill VS Code with the Activity Monitor.

Invalid message:
Session is already initialized

Difficult to reproduce without the underlying (proprietary) data used by the python packages.

Screenshot 2022-10-26 at 09 44 12

VS Code version: Code 1.72.2 (d045a5eda657f4d7b676dedbfa7aab8207f8a075, 2022-10-12T22:15:55.763Z) OS version: Darwin arm64 22.1.0 Modes: Sandboxed: No

System Info |Item|Value| |---|---| |CPUs|Apple M1 Max (10 x 24)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off| |Load (avg)|6, 5, 4| |Memory (System)|32.00GB (4.51GB free)| |Process Argv|| |Screen Reader|no| |VM|0%|
Extensions (32) Extension|Author (truncated)|Version ---|---|--- preview-pdf|ana|1.0.0 github-markdown-preview|bie|0.3.0 markdown-checkbox|bie|0.3.3 markdown-emoji|bie|0.3.0 markdown-footnotes|bie|0.0.7 markdown-mermaid|bie|1.15.2 markdown-preview-github-styles|bie|1.0.1 markdown-yaml-preamble|bie|0.1.0 gitignore|cod|0.9.0 gitlens|eam|13.0.3 gc-excelviewer|Gra|4.2.56 l13-diff|L13|1.0.3 restructuredtext-pack|lex|1.0.1 markwhen|Mar|0.2.0 python|ms-|2022.16.1 vscode-pylance|ms-|2022.10.30 jupyter|ms-|2022.9.1202862440 jupyter-keymap|ms-|1.0.0 jupyter-renderers|ms-|1.0.10 vscode-jupyter-cell-tags|ms-|0.1.6 vscode-jupyter-powertoys|ms-|0.0.6 vscode-jupyter-slideshow|ms-|0.1.5 remote-ssh|ms-|0.90.1 remote-ssh-edit|ms-|0.84.0 live-server|ms-|0.4.3 vscode-sanddance|msr|4.0.1 vscode-json-editor|nic|0.3.0 autodocstring|njp|0.6.1 vscode-inline-bookmarks|tin|0.1.0 intellicode-api-usage-examples|Vis|0.2.6 vscodeintellicode|Vis|1.2.29 markdown-all-in-one|yzh|3.4.3 (1 theme extensions excluded)
michaelweinold commented 1 year ago

launch.json has not been changed from the default value:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "justMyCode": true
        }
    ]
}x
michaelweinold commented 1 year ago

Compare also this related question on StackOverflow.

roblourens commented 1 year ago

Made some changes to cell debugging this month- could you try with the latest VS Code Insiders build + Jupyter pre-release extension, (or try again after the release next week)?

michaelweinold commented 1 year ago

The latest insider build + Jupyter pre-release gives another error (with a series of pop-up notifications that keep reappearing until VS Code is killed with Activity Monitor):

Couldn't find a debug adapter descriptor
for debug type 'Python Kernel Debug Adapter'
(extension might have failed to activate)
Screenshot 2022-10-27 at 06 13 58
roblourens commented 1 year ago

Could you set "jupyter.logging.level": "verbose", try again, and share the log from the Jupyter output channel?

michaelweinold commented 1 year ago

Since the entire app freezes upon this error, I would need to copy the debugging logs from a file rather than from the output console. I could not find the Jupytter logs among at location given by Developer: Open Logs Folder. Could you let me know where the Jupyter logs are stored (when connected to a server via SSH)?

Screenshot 2022-11-05 at 08 00 58
roblourens commented 1 year ago

There is a command, "Open extension logs folder"

michaelweinold commented 1 year ago
Screenshot 2022-11-08 at 08 32 07

I can't find a log file for the Jupyter output in the extension logs folder. After checking all other filed, I found none of the files contains the relevant log information.

roblourens commented 1 year ago

Could you share the code that you're trying to debug? I notice the "child process" error message which maybe indicates that you're trying to debug code that spawns subprocesses which isn't supported in jupyter debugging currently (but shouldn't break this badly)

Also, please try debugging a cell like print('hello') if you haven't already.

vscodenpa commented 1 year ago

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!