Skip to content

Debugpy cannot connect to process using process ID on Ubuntu 22.10 #1196

@Joebeazelman

Description

@Joebeazelman

I'm encountering an issue where debugpy is unable to connect to another application running embedded Python. When I choose the process ID, the debug window keeps repeating that it's attaching, but eventually times out. The Debug window suggests setting the PYDEVD_GDB_SCAN_SHARED_LIBRARIES.

I tried to configure VS Code using a port number and server address, but VS Code reports a connection refused error. I thought the port was blocked, but I am running on a VM without a firewall. I've tried every possible solution, including deleting and reinstalling VS Code. I even went as far as setting the environment variable export PYDEVD_GDB_SCAN_SHARED_LIBRARIES="libdl, libltdl, libc, libfreebl3", but it still cannot connect.

I've attached the log files with this issue.

{
    // 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: Attach using Process Id",
            "type": "python",
            "request": "attach",
            "processId": "${command:pickProcess}",
            "justMyCode": true,
            "logToFile": true
        }
    ]
}

Environment data

  • debugpy version: 1.6.6 (1.6.5 target)
  • OS and version: Ubuntu 22.10
  • Python version (& distribution if applicable, e.g. Anaconda): 3.10.7
  • Using VS Code or Visual Studio: 1.74.3

Actual behavior

Error messages from embedded python

ConnectionRefusedError: [Errno 111] Connection refused
Traceback (most recent call last):
File "/home/joebeazelman/.vscode/extensions/ms-python.python-2023.1.10091012/pythonFiles/lib/python/debugpy/adapter/../../debugpy/../debugpy/server/attach_pid_injected.py", line 77, in attach
File "/home/joebeazelman/.vscode/extensions/ms-python.python-2023.1.10091012/pythonFiles/lib/python/debugpy/public_api.py", line 31, in wrapper
File "/home/joebeazelman/.vscode/extensions/ms-python.python-2023.1.10091012/pythonFiles/lib/python/debugpy/server/api.py", line 143, in debug
File "/home/joebeazelman/.vscode/extensions/ms-python.python-2023.1.10091012/pythonFiles/lib/python/debugpy/server/api.py", line 141, in debug
File "/home/joebeazelman/.vscode/extensions/ms-python.python-2023.1.10091012/pythonFiles/lib/python/debugpy/server/api.py", line 297, in connect
File "/home/joebeazelman/.vscode/extensions/ms-python.python-2023.1.10091012/pythonFiles/lib/python/debugpy/server/api.py", line 45, in _settrace
File "/home/joebeazelman/.vscode/extensions/ms-python.python-2023.1.10091012/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydevd.py", line 2821, in settrace
File "/home/joebeazelman/.vscode/extensions/ms-python.python-2023.1.10091012/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydevd.py", line 2902, in _locked_settrace
File "/home/joebeazelman/.vscode/extensions/ms-python.python-2023.1.10091012/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydevd.py", line 1421, in connect
File "/home/joebeazelman/.vscode/extensions/ms-python.python-2023.1.10091012/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py", line 493, in start_client
ConnectionRefusedError: [Errno 111] Connection refused
Traceback (most recent call last):
File "", line 1, in
File "/home/joebeazelman/.vscode/extensions/ms-python.python-2023.1.10091012/pythonFiles/lib/python/debugpy/adapter/../../debugpy/../debugpy/server/attach_pid_injected.py", line 90, in attach
File "/home/joebeazelman/.vscode/extensions/ms-python.python-2023.1.10091012/pythonFiles/lib/python/debugpy/adapter/../../debugpy/../debugpy/server/attach_pid_injected.py", line 77, in attach
File "/home/joebeazelman/.vscode/extensions/ms-python.python-2023.1.10091012/pythonFiles/lib/python/debugpy/public_api.py", line 31, in wrapper
File "/home/joebeazelman/.vscode/extensions/ms-python.python-2023.1.10091012/pythonFiles/lib/python/debugpy/server/api.py", line 143, in debug
File "/home/joebeazelman/.vscode/extensions/ms-python.python-2023.1.10091012/pythonFiles/lib/python/debugpy/server/api.py", line 141, in debug
File "/home/joebeazelman/.vscode/extensions/ms-python.python-2023.1.10091012/pythonFiles/lib/python/debugpy/server/api.py", line 297, in connect
File "/home/joebeazelman/.vscode/extensions/ms-python.python-2023.1.10091012/pythonFiles/lib/python/debugpy/server/api.py", line 45, in _settrace
File "/home/joebeazelman/.vscode/extensions/ms-python.python-2023.1.10091012/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydevd.py", line 2821, in settrace
File "/home/joebeazelman/.vscode/extensions/ms-python.python-2023.1.10091012/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydevd.py", line 2902, in _locked_settrace
File "/home/joebeazelman/.vscode/extensions/ms-python.python-2023.1.10091012/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydevd.py", line 1421, in connect
File "/home/joebeazelman/.vscode/extensions/ms-python.python-2023.1.10091012/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py", line 493, in start_client
ConnectionRefusedError: [Errno 111] Connection refused
import debugpy; print(debugpy.version)
1.6.5

debugpy.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions