Skip to content

Debugger not connecting since version 25.0.0 #618

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
RaphaelMelanconAtBentley opened this issue Feb 18, 2025 · 12 comments
Open

Debugger not connecting since version 25.0.0 #618

RaphaelMelanconAtBentley opened this issue Feb 18, 2025 · 12 comments
Assignees
Labels
triage-needed Needs assignment to the proper sub-team

Comments

@RaphaelMelanconAtBentley

Whenever I am launching a debug session since the release of version 25.0.0 of the extension, the debugger hangs for ~30s, then I get this popup:

Image

This happens when launching via a launch config or directly launching a file in debug mode.

Reverting to version 24.14.2 of the extension fixes this.

I am on WSL, using a Pixi Python environment.

Here are the Python Debugger logs:

2025-02-18 12:02:20.629 [info] Debugging using the editor button 'Debug in terminal'
2025-02-18 12:02:20.643 [info] Getting configurations for workspace
2025-02-18 12:02:20.645 [info] Using configuration in launch.json
2025-02-18 12:02:20.821 [info] Using workspaceFolder found for the program:  /home/pan/repositories/Booster-AI
2025-02-18 12:02:20.879 [info] Resolving launch configuration with substituted variables
2025-02-18 12:02:20.879 [info] Using workspaceFolder found for the program:  /home/pan/repositories/Booster-AI
2025-02-18 12:02:20.939 [info] DAP Server launched with command: /home/pan/repositories/Booster-AI/.pixi/envs/booster-ai-development/bin/python /home/pan/.vscode-server/extensions/ms-python.debugpy-2025.0.1/bundled/libs/debugpy/adapter
2025-02-18 12:02:21.070 [info] Received 'debugpySockets' event from debugpy.
2025-02-18 12:02:21.075 [info] Received 'debugpySockets' event from debugpy.
2025-02-18 12:02:21.075 [info] Received 'debugpySockets' event from debugpy.

The Python logs:

2025-02-18 12:02:21.143 [info] Not enabling terminal env var experiment in multiroot remote workspaces
2025-02-18 12:02:21.144 [info] Send text to terminal: /home/pan/.pixi/bin/pixi shell --manifest-path /home/pan/repositories/Booster-AI/pixi.toml --environment booster-ai-development
2025-02-18 12:02:21.896 [info] Send text to terminal:  /usr/bin/env /home/pan/repositories/Booster-AI/.pixi/envs/booster-ai-development/bin/python /home/pan/.vscode-server/extensions/ms-python.debugpy-2025.0.1/bundled/libs/debugpy/adapter/../../debugpy/launcher 34449 -- /home/pan/repositories/Booster-AI/project_management/workspace/configurator.py 
@eleanorjboyd eleanorjboyd transferred this issue from microsoft/vscode-python-debugger Feb 18, 2025
@rchiodo
Copy link
Contributor

rchiodo commented Feb 18, 2025

I would hazard a guess this is similar to the problem with this issue: #617

@rchiodo rchiodo transferred this issue from microsoft/debugpy Feb 18, 2025
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Feb 18, 2025
@eleanorjboyd
Copy link
Member

yes good guess @rchiodo

@RaphaelMelanconAtBentley can you include the launch config you are trying to run with? And the code you are attempting to debug?

@eleanorjboyd eleanorjboyd self-assigned this Feb 18, 2025
@RaphaelMelanconAtBentley
Copy link
Author

Well, there isn't always a launch config, as it also happens when I simply use this option:

Image

And it happens with any code, even this:

# test_debugger.py
if __name__ == "__main__":
    print("Hello, world!")

Might it have something to do with the environment activation in the terminal?
I have "python.terminal.activateEnvironment": true and "python.terminal.activateEnvInCurrentTerminal": true.

Here is what the Python Debug Console terminal shows when it is created:

> /home/pan/.pixi/bin/pixi shell --manifest-path /home/pan/repositories/Booster-AI/pixi.toml --environment booster-ai-development
> /home/pan/.pixi/bin/pixi shell --manifest-path /home/pan/repositories/Booster-AI/pixi.toml --environment booster-ai-development
 /usr/bin/env /home/pan/repositories/Booster-AI/.pixi/envs/booster-ai-development/bin/python /home/pan/.vscode-server/extensions/ms-python.debugpy-2025.0.1/bundled/libs/debugpy/adapter/../../debugpy/launcher 34863 -- /home/pan/repositories/Booster-AI/test_debugger.py

@eleanorjboyd
Copy link
Member

This should be fixed and be out in the most recent point release of the python debugger extension since it is related to #617 which I fixed. Closing for now but re-comment if not and I can reopen

@RaphaelMelanconAtBentley
Copy link
Author

RaphaelMelanconAtBentley commented Mar 4, 2025

I am on the latest (pre-release) version of both the Python and the Python Debugger extensions, and this is still happening.

@eleanorjboyd Please reopen

@RaphaelMelanconAtBentley
Copy link
Author

Weirdly, I can debug unit test if I use the inline test indicator to debug a test. Bug any other way I tried launching a debugging session results in a hang followed by a timeout error.

@eleanorjboyd eleanorjboyd reopened this Mar 7, 2025
@eleanorjboyd
Copy link
Member

@karthiknadig any ideas here?

@karthiknadig
Copy link
Member

@RaphaelMelanconAtBentley If you open a terminal and debugpy <file path> does it work?

@RaphaelMelanconAtBentley
Copy link
Author

I'm not sure what you want... The debugpy command expects more arguments than just a file path...

$ debugpy /home/pan/repositories/Booster-AI/project_management/workspace/configurator.py
debugpy 1.8.12
See https://aka.ms/debugpy for documentation.

Usage: debugpy --listen | --connect
               [<host>:]<port>
               [--wait-for-client]
               [--configure-<name> <value>]...
               [--log-to <path>] [--log-to-stderr]
               <filename> | -m <module> | -c <code> | --pid <pid>
               [<arg>]...

Error: either --listen or --connect is required

@karthiknadig
Copy link
Member

@RaphaelMelanconAtBentley If you have debugpy installed in the environment, it takes precedence currently. so what you are seeing is raw debugpy commands. we also have a script debugpy.ps1, debugpy.fish etc that is a shortcut to :

debugpy --listen 0 --wait-for-client <file-path>

those scripts are located at (path differs by os):
~\.vscode-insiders\extensions\ms-python.debugpy-2025.5.2025031101-win32-x64\bundled\scripts\noConfigScripts

If you install ms-python.debugpy-2025.4.1, or ms-python.debugpy-2025.5.* pre release version, you should be able to use the debugpy module installed in your environment without interference from the DEBUGPY_ADAPTER_ENDPOINTS that was causing the connection issue. After installing the latest version you will need to reload VS Code.

The contribution list for the latest extension should look like this:

- `PYDEVD_DISABLE_FILE_VALIDATION=1`
- `VSCODE_DEBUGPY_ADAPTER_ENDPOINTS=<some path>`
- `PATH=${env:PATH};<extension path>\bundled\scripts\noConfigScripts`
- `BUNDLED_DEBUGPY_PATH=<extension path>\bundled\libs\debugpy`

in the buggy case it would have been:

- `PYDEVD_DISABLE_FILE_VALIDATION=1`
- `DEBUGPY_ADAPTER_ENDPOINTS=<some path>`   // <----- this is the one that is different
- `PATH=${env:PATH};<extension path>\bundled\scripts\noConfigScripts`
- `BUNDLED_DEBUGPY_PATH=<extension path>\bundled\libs\debugpy`

You can get the contributions by hovering over the terminal title, and selecting "Show Environment Contribution":

Image

@RaphaelMelanconAtBentley
Copy link
Author

I am on the latest pre-release versions of both the python and python-debugger extensions and this is still not working.

Although I can verify that all of the mentioned above exists, not of that explains what the issue is...
The debugger extension does contribute to the terminal environment and the variables are set, but that does not tell me much.

Although I just noticed... Even doing Run Python file without debugging does nothing... But Run Python file in Dedicated Terminal works.

It looks like the issue is with the environment activation:
Image

The pixi shell command cannot be used to run code. It only activates and environment... Not sure what is happening here and what is the intended behavior...

@RaphaelMelanconAtBentley
Copy link
Author

Pretty sure this issue is related: microsoft/vscode-python#24862

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

5 participants