Skip to content
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

Python Debugger: "Timed out waiting for launcher to connect" (take 2) #1713

Closed
wabiloo opened this issue Oct 28, 2024 · 12 comments
Closed

Python Debugger: "Timed out waiting for launcher to connect" (take 2) #1713

wabiloo opened this issue Oct 28, 2024 · 12 comments
Assignees
Labels
needs repro Issue has not been reproduced yet

Comments

@wabiloo
Copy link

wabiloo commented Oct 28, 2024

Environment data

  • debugpy version: 1.8.7 (I think, but that's after running python3 -m pip install debugpy, and may not be the version used by VS Code. Not sure how to get that one. The Python Debugger extension is v2024.13.2024101501 (pre-release) (but same problem with v2024.12.0)
  • OS and version: MacOS 14.3 (23D56)
  • Python version (& distribution if applicable, e.g. Anaconda): v3.12.6 (but same issue with v3.11.7)
  • Using VS Code or Visual Studio: VS Code v1.94.2 (but same issue on v1.93.1)

Actual behavior

Exactly the same as reported in #1677

I have a very simple script:

import sys

print(len(sys.argv))
print(sys.argv)
if len(sys.argv) < 3:
    print(
        "specify <sheet-name> <operation> where operation is 'create', 'insert', show' or 'delete'"
    )
    sys.exit(1)

print("argument list:", str(sys.argv))
sheetname = sys.argv[1]
operation = sys.argv[2]

I launch it from the following launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python Debugger: Current File",
            "type": "debugpy",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal"
        }
    ]
}

And I get the dreaded error message "Timed out waiting for the launcher to connect"

Strangely, I'm on v1.94.2 and have been for at least a week, and everything was working fine, until suddenly in the middle of the afternoon last Friday, it stopped working... I had not changed anything to my settings or environment.

  • Restarted the computer - no change
  • I downgraded to VS Code v1.93.1 - no change
  • Changed the version of python - no change

Logs attached
debugger.vscode_62aa6d5d-f757-4cfc-a67f-52d139dcd71a.log
debugpy.adapter-93288.log

Expected behavior

Ability to run and debug Python code in VS Code

@github-actions github-actions bot added the needs repro Issue has not been reproduced yet label Oct 28, 2024
@wabiloo
Copy link
Author

wabiloo commented Oct 28, 2024

For what is worth, I tried the trick mentioned by others, ie. to re-try the command line after launch. This did not work:

 _bp="/Users/fabrelambeau/.vscode/extensions/babakks.vscode-copy-from-terminal-0.0.9"; . "$_bp/script/init.sh" "9f7d" "$_bp/temp" "cp2code" "tee2code"
 /usr/bin/env DEBUGPY_LOG_DIR=/Users/fabrelambeau/.vscode/extensions/ms-python.debugpy-2024.12.0-darwin-arm64 /Users/fabrelambeau/Downloads/timedout-launcher-issue/.venv/bin/python /Users/fabrelambeau/.vscode/extensions/ms-python.debugpy-2024.12.0-darwin-arm64/bundled/libs/debugpy/adapter/../../debugpy/launcher 65154 -- /Users/fabrelambeau/Downloads/timedout-launcher-issue/main.py 
  ~/Downloads/timedout-launcher-issue ························································· timedout-launcher-issue  ╱ 13:16:44  ─╮
❯ _bp="/Users/fabrelambeau/.vscode/extensions/babakks.vscode-copy-from-terminal-0.0.9"; . "$_bp/script/init.sh" "9f7d" "$_bp/temp" "cp2code" 
"tee2code"
❯ /usr/bin/env /Users/fabrelambeau/Downloads/timedout-launcher-issue/.venv/bin/python /Users/fabrelambeau/.vscode/extensions/ms-python.debugpy-2024.12.0-darwin-arm64/bundled/libs/debugpy/adapter/../../debugpy/launcher 63608 -- /Users/fabrelambeau/Downloads/timedout-launcher-issue/main.py
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/Users/fabrelambeau/.vscode/extensions/ms-python.debugpy-2024.12.0-darwin-arm64/bundled/libs/debugpy/adapter/../../debugpy/launcher/__main__.py", line 91, in <module>
    main()
  File "/Users/fabrelambeau/.vscode/extensions/ms-python.debugpy-2024.12.0-darwin-arm64/bundled/libs/debugpy/adapter/../../debugpy/launcher/__main__.py", line 47, in main
    launcher.connect(host, port)
  File "/Users/fabrelambeau/.vscode/extensions/ms-python.debugpy-2024.12.0-darwin-arm64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/launcher/__init__.py", line 27, in connect
    sock.connect((host, port))
ConnectionRefusedError: [Errno 61] Connection refused

If I try to run debugpy by hand in the terminal, I have no error:

❯ .venv/bin/python3 -m debugpy --listen localhost:12345 main.py
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
1
['main.py']
specify <sheet-name> <operation> where operation is 'create', 'insert', show' or 'delete'

@rchiodo
Copy link
Contributor

rchiodo commented Oct 30, 2024

Are you getting the same problem where the command isn't ending up in the terminal in VS code?

@rchiodo
Copy link
Contributor

rchiodo commented Oct 30, 2024

The vscode log says it received this request:

107 Client <-- Adapter:
{
    "seq": 7,
    "type": "request",
    "command": "runInTerminal",
    "arguments": {
        "kind": "integrated",
        "title": "Python Debug Console",
        "args": [
            "/Users/fabrelambeau/Downloads/timedout-launcher-issue/.venv/bin/python",
            "/Users/fabrelambeau/.vscode/extensions/ms-python.debugpy-2024.12.0-darwin-arm64/bundled/libs/debugpy/adapter/../../debugpy/launcher",
            "49262",
            "--",
            "/Users/fabrelambeau/Downloads/timedout-launcher-issue/main.py"
        ],
        "env": {
            "DEBUGPY_LOG_DIR": "/Users/fabrelambeau/.vscode/extensions/ms-python.debugpy-2024.12.0-darwin-arm64"
        },
        "cwd": "/Users/fabrelambeau/Downloads/timedout-launcher-issue"
    }
}

Which should have showed up in a terminal window in VS code I believe.

@wabiloo
Copy link
Author

wabiloo commented Oct 31, 2024

Here's what the integrated terminal shows at the time of the timeout:

Image

@rchiodo
Copy link
Contributor

rchiodo commented Oct 31, 2024

That looks like there's a whole bunch of stuff that runs first? Not sure where that's coming from but it might be interfering with the debugpy launch.

@wabiloo
Copy link
Author

wabiloo commented Oct 31, 2024

Don't know what it is or where it comes from, but as far as I recall it's always been there

@rchiodo
Copy link
Contributor

rchiodo commented Oct 31, 2024

Maybe it's that 'vscode-copy-from-terminal-0.0.9' extension.

@wabiloo
Copy link
Author

wabiloo commented Nov 1, 2024

Bingo, that was it!
No idea what that extension is and why / how / when it got installed, but getting rid of it fixed the issue. Thanks very much for your help @rchiodo !

@wabiloo wabiloo closed this as completed Nov 1, 2024
@rchiodo
Copy link
Contributor

rchiodo commented Nov 1, 2024

Oh awesome! Glad it works now. We can look out for this sort of thing if other people report the same issue.

@Turiok
Copy link

Turiok commented Nov 4, 2024

Hi,

I have the same problem with the same sequence. But I didn't have the plugin vscode-copy-from-terminal-0.0.9.

I'm using a conda environment to have a python version and poetry with an env too. I'm using vscode and remote SSH.

Here the log : debugger.vscode_2492de48-f138-4f82-b02f-69de95fb34f6.log

Another question, When the vscode terminal is launched to launch the debbuger. Text is written and the terminal is cleared. I can't see what is written. How can I stop the clearing terminal?

@rchiodo
Copy link
Contributor

rchiodo commented Nov 4, 2024

Not sure why the terminal would be cleared, that's not normal. There might be logging somewhere in VS code for that situation though.

You should try this without any other extensions except the debugger and the python extension enabled.

@Turiok
Copy link

Turiok commented Nov 5, 2024

I have tested with the minimal extension for me (see the image) and I have the same problem sadly.
The plugins : git, emmet, merge conflict, github, node debug and server ready action doesn't come from me. In the installed plugins menu there are not here. I'm thinking it's from the vscode base running with remote SSH.

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs repro Issue has not been reproduced yet
Projects
None yet
Development

No branches or pull requests

4 participants