Skip to content

remote vscode attach process pid failed #1464

Open

Description

@yaldong

Behaviour

Expected vs. Actual

Steps to reproduce:

  1. create interactive job with singularity compute
  2. open vscode link, the remote environment will be open, and debug python by attach running process id

Please contact Shantnu Tiwari (@shantnu) Suman, if you need to reproduce it

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.7.5
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Global
  • Value of the python.languageServer setting: Default
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)

Attaching to PID: 1576 (elapsed: 1.00s).
Attaching to PID: 1576 (elapsed: 2.00s).
Attaching to PID: 1576 (elapsed: 3.00s).
Attaching to PID: 1576 (elapsed: 4.01s).
Attaching to PID: 1576 (elapsed: 5.01s).
Attaching to PID: 1576 (elapsed: 6.01s).
Attaching to PID: 1576 (elapsed: 7.01s).
Attaching to PID: 1576 (elapsed: 8.01s).
Attaching to PID: 1576 (elapsed: 9.01s).
Attaching to PID: 1576 (elapsed: 10.01s).

The attach to PID is taking longer than expected.
On Linux it's possible to customize the value of
`PYDEVD_GDB_SCAN_SHARED_LIBRARIES` so that fewer libraries.
are scanned when searching for the needed symbols.
i.e.: set in your environment variables (and restart your editor/client
so that it picks up the updated environment variable value):
PYDEVD_GDB_SCAN_SHARED_LIBRARIES=libdl, libltdl, libc, libfreebl3
-- the actual library may be different (the gdb output typically
-- writes the libraries that will be used, so, it should be possible
-- to test other libraries if the above doesn't work).
--- Starting attach to pid: 1576 ---
[New LWP 1581]
[New LWP 1584]
[New LWP 1586]
[New LWP 1588]
[New LWP 1590]
[New LWP 1592]
[New LWP 1595]
[New LWP 1597]
[New LWP 1599]
[New LWP 1601]
[New LWP 1604]
[New LWP 1606]
[New LWP 1607]
[New LWP 1610]
[New LWP 1614]
[New LWP 1615]
[New LWP 1616]
[New LWP 1617]
[New LWP 1620]
[New LWP 1624]
[New LWP 1625]
[New LWP 1626]
[New LWP 1627]
[New LWP 1630]
[New LWP 1633]
[New LWP 1636]
[New LWP 1638]
[New LWP 1639]
[New LWP 1640]
[New LWP 1641]
[New LWP 1642]
[New LWP 1644]
[New LWP 1653]
[New LWP 1654]
[New LWP 1672]
[New LWP 1673]
[New LWP 1674]
[New LWP 1675]
[New LWP 1676]
[New LWP 1677]
[New LWP 1678]
[New LWP 1679]
[New LWP 1680]
[New LWP 1681]
[New LWP 1682]
[New LWP 1683]
[New LWP 1684]
[New LWP 1685]
[New LWP 1693]
[New LWP 1694]
[New LWP 1695]
[New LWP 1696]
[New LWP 1697]
[New LWP 1698]
[New LWP 1699]
[New LWP 1700]
[New LWP 1701]
[New LWP 1702]
[New LWP 1703]
[New LWP 1704]
[New LWP 1705]
[New LWP 1706]
[New LWP 1707]
[New LWP 1711]
[New LWP 1713]
[New LWP 1716]
[New LWP 1717]
[New LWP 1719]
[New LWP 1721]
[New LWP 1723]
[New LWP 1725]
[New LWP 1727]
[New LWP 1730]
[New LWP 1737]
[New LWP 1739]
[New LWP 1748]
[New LWP 1761]
[New LWP 1763]
[New LWP 1766]
[New LWP 1772]
[New LWP 1773]
[New LWP 1774]
[New LWP 1775]
[New LWP 1776]
[New LWP 1778]
[New LWP 1779]
[New LWP 1780]
[New LWP 1781]
[New LWP 1782]
[New LWP 1783]
[New LWP 1784]
[New LWP 1785]
[New LWP 1786]
[New LWP 1787]
[New LWP 1788]
[New LWP 1789]
[New LWP 1790]
[New LWP 1791]
[New LWP 1792]
[New LWP 1794]
[New LWP 1799]
[New LWP 1800]
[New LWP 1802]
[New LWP 1812]
[New LWP 1813]
[New LWP 1814]
[New LWP 1815]
[New LWP 1816]
[New LWP 1817]
[New LWP 1818]
[New LWP 1819]
[New LWP 1820]
[New LWP 1821]
[New LWP 1822]
[New LWP 1823]
[New LWP 1824]
[New LWP 1825]
[New LWP 1826]
[New LWP 1827]
[New LWP 1828]
[New LWP 1829]
[New LWP 1830]
[New LWP 1831]
[New LWP 1832]
[New LWP 1833]
[New LWP 1834]
[New LWP 1840]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

warning: Loadable section ".note.gnu.property" outside of ELF segments
0x00007fa37385ffcb in select () from /lib/x86_64-linux-gnu/libc.so.6
The target architecture is set automatically (currently i386:x86-64)
Attach to PID failed.
$1 = (void *) 0x0
No symbol "DoAttach" in current context.
[Inferior 1 (process 1576) detached]
E+00009.876: Code injection into PID=1576 failed:
             
             Traceback (most recent call last):
               File "/home/aiscuser/.vscode-server/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/../debugpy/server/cli.py", line 391, in attach_to_pid
                 add_code_to_python_process.run_python_code(
               File "/home/aiscuser/.vscode-server/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydevd_attach_to_process/add_code_to_python_process.py", line 471, in run_python_code_linux
                 subprocess.check_call(' '.join(cmd), shell=True, env=env)
               File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
                 raise CalledProcessError(retcode, cmd)
             subprocess.CalledProcessError: Command 'gdb --nw --nh --nx --pid 1576 --batch --eval-command='set scheduler-locking off' --eval-command='set architecture auto' --eval-command='call (void*)dlopen("/home/aiscuser/.vscode-server/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_linux_amd64.so", 2)' --eval-command='sharedlibrary attach_linux_amd64' --eval-command='call (int)DoAttach(0, "import codecs;import json;import sys;decode = lambda s: codecs.utf_8_decode(bytearray(s))[0] if s is not None else None;script_dir = decode([47, 104, 111, 109, 101, 47, 97, 105, 115, 99, 117, 115, 101, 114, 47, 46, 118, 115, 99, 111, 100, 101, 45, 115, 101, 114, 118, 101, 114, 47, 101, 120, 116, 101, 110, 115, 105, 111, 110, 115, 47, 109, 115, 45, 112, 121, 116, 104, 111, 110, 46, 112, 121, 116, 104, 111, 110, 45, 50, 48, 50, 51, 46, 50, 48, 46, 48, 47, 112, 121, 116, 104, 111, 110, 70, 105, 108, 101, 115, 47, 108, 105, 98, 47, 112, 121, 116, 104, 111, 110, 47, 100, 101, 98, 117, 103, 112, 121, 47, 97, 100, 97, 112, 116, 101, 114, 47, 46, 46, 47, 46, 46, 47, 100, 101, 98, 117, 103, 112, 121, 47, 46, 46, 47, 100, 101, 98, 117, 103, 112, 121, 47, 115, 101, 114, 118, 101, 114]);setup = json.loads(decode([123, 34, 109, 111, 100, 101, 34, 58, 32, 34, 99, 111, 110, 110, 101, 99, 116, 34, 44, 32, 34, 97, 100, 100, 114, 101, 115, 115, 34, 58, 32, 91, 34, 49, 50, 55, 46, 48, 46, 48, 46, 49, 34, 44, 32, 52, 49, 51, 57, 57, 93, 44, 32, 34, 119, 97, 105, 116, 95, 102, 111, 114, 95, 99, 108, 105, 101, 110, 116, 34, 58, 32, 102, 97, 108, 115, 101, 44, 32, 34, 108, 111, 103, 95, 116, 111, 34, 58, 32, 110, 117, 108, 108, 44, 32, 34, 97, 100, 97, 112, 116, 101, 114, 95, 97, 99, 99, 101, 115, 115, 95, 116, 111, 107, 101, 110, 34, 58, 32, 34, 57, 55, 98, 98, 100, 55, 97, 48, 51, 53, 52, 99, 99, 97, 52, 57, 102, 56, 49, 55, 52, 98, 52, 54, 49, 101, 49, 56, 49, 49, 50, 98, 98, 56, 97, 56, 99, 54, 56, 100, 99, 54, 49, 50, 97, 99, 52, 52, 100, 98, 99, 102, 101, 99, 101, 49, 48, 48, 101, 55, 102, 48, 56, 50, 34, 125]));sys.path.insert(0, script_dir);import attach_pid_injected;del sys.path[0];attach_pid_injected.attach(setup);", 0)'' returned non-zero exit status 1.
             
             Stack where logged:
               File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
                 return _run_code(code, main_globals, None,
               File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
                 exec(code, run_globals)
               File "/home/aiscuser/.vscode-server/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/__main__.py", line 39, in <module>
                 cli.main()
               File "/home/aiscuser/.vscode-server/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/../debugpy/server/cli.py", line 430, in main
                 run()
               File "/home/aiscuser/.vscode-server/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/../debugpy/server/cli.py", line 398, in attach_to_pid
                 log.reraise_exception("Code injection into PID={0} failed:", pid)
               File "/home/aiscuser/.vscode-server/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/../debugpy/common/log.py", line 222, in reraise_exception
                 _exception(format_string, *args, **kwargs)
             

Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/aiscuser/.vscode-server/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/__main__.py", line 39, in <module>
    cli.main()
  File "/home/aiscuser/.vscode-server/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/../debugpy/server/cli.py", line 430, in main
    run()
  File "/home/aiscuser/.vscode-server/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/../debugpy/server/cli.py", line 398, in attach_to_pid
    log.reraise_exception("Code injection into PID={0} failed:", pid)
  File "/home/aiscuser/.vscode-server/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/../debugpy/server/cli.py", line 391, in attach_to_pid
    add_code_to_python_process.run_python_code(
  File "/home/aiscuser/.vscode-server/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydevd_attach_to_process/add_code_to_python_process.py", line 471, in run_python_code_linux
    subprocess.check_call(' '.join(cmd), shell=True, env=env)
  File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'gdb --nw --nh --nx --pid 1576 --batch --eval-command='set scheduler-locking off' --eval-command='set architecture auto' --eval-command='call (void*)dlopen("/home/aiscuser/.vscode-server/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_linux_amd64.so", 2)' --eval-command='sharedlibrary attach_linux_amd64' --eval-command='call (int)DoAttach(0, "import codecs;import json;import sys;decode = lambda s: codecs.utf_8_decode(bytearray(s))[0] if s is not None else None;script_dir = decode([47, 104, 111, 109, 101, 47, 97, 105, 115, 99, 117, 115, 101, 114, 47, 46, 118, 115, 99, 111, 100, 101, 45, 115, 101, 114, 118, 101, 114, 47, 101, 120, 116, 101, 110, 115, 105, 111, 110, 115, 47, 109, 115, 45, 112, 121, 116, 104, 111, 110, 46, 112, 121, 116, 104, 111, 110, 45, 50, 48, 50, 51, 46, 50, 48, 46, 48, 47, 112, 121, 116, 104, 111, 110, 70, 105, 108, 101, 115, 47, 108, 105, 98, 47, 112, 121, 116, 104, 111, 110, 47, 100, 101, 98, 117, 103, 112, 121, 47, 97, 100, 97, 112, 116, 101, 114, 47, 46, 46, 47, 46, 46, 47, 100, 101, 98, 117, 103, 112, 121, 47, 46, 46, 47, 100, 101, 98, 117, 103, 112, 121, 47, 115, 101, 114, 118, 101, 114]);setup = json.loads(decode([123, 34, 109, 111, 100, 101, 34, 58, 32, 34, 99, 111, 110, 110, 101, 99, 116, 34, 44, 32, 34, 97, 100, 100, 114, 101, 115, 115, 34, 58, 32, 91, 34, 49, 50, 55, 46, 48, 46, 48, 46, 49, 34, 44, 32, 52, 49, 51, 57, 57, 93, 44, 32, 34, 119, 97, 105, 116, 95, 102, 111, 114, 95, 99, 108, 105, 101, 110, 116, 34, 58, 32, 102, 97, 108, 115, 101, 44, 32, 34, 108, 111, 103, 95, 116, 111, 34, 58, 32, 110, 117, 108, 108, 44, 32, 34, 97, 100, 97, 112, 116, 101, 114, 95, 97, 99, 99, 101, 115, 115, 95, 116, 111, 107, 101, 110, 34, 58, 32, 34, 57, 55, 98, 98, 100, 55, 97, 48, 51, 53, 52, 99, 99, 97, 52, 57, 102, 56, 49, 55, 52, 98, 52, 54, 49, 101, 49, 56, 49, 49, 50, 98, 98, 56, 97, 56, 99, 54, 56, 100, 99, 54, 49, 50, 97, 99, 52, 52, 100, 98, 99, 102, 101, 99, 101, 49, 48, 48, 101, 55, 102, 48, 56, 50, 34, 125]));sys.path.insert(0, script_dir);import attach_pid_injected;del sys.path[0];attach_pid_injected.attach(setup);", 0)'' returned non-zero exit status 1.
PYDEVD_GDB_SCAN_SHARED_LIBRARIES not set (scanning all libraries for needed symbols).
Running: gdb --nw --nh --nx --pid 1576 --batch --eval-command='set scheduler-locking off' --eval-command='set architecture auto' --eval-command='call (void*)dlopen("/home/aiscuser/.vscode-server/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_linux_amd64.so", 2)' --eval-command='sharedlibrary attach_linux_amd64' --eval-command='call (int)DoAttach(0, "import codecs;import json;import sys;decode = lambda s: codecs.utf_8_decode(bytearray(s))[0] if s is not None else None;script_dir = decode([47, 104, 111, 109, 101, 47, 97, 105, 115, 99, 117, 115, 101, 114, 47, 46, 118, 115, 99, 111, 100, 101, 45, 115, 101, 114, 118, 101, 114, 47, 101, 120, 116, 101, 110, 115, 105, 111, 110, 115, 47, 109, 115, 45, 112, 121, 116, 104, 111, 110, 46, 112, 121, 116, 104, 111, 110, 45, 50, 48, 50, 51, 46, 50, 48, 46, 48, 47, 112, 121, 116, 104, 111, 110, 70, 105, 108, 101, 115, 47, 108, 105, 98, 47, 112, 121, 116, 104, 111, 110, 47, 100, 101, 98, 117, 103, 112, 121, 47, 97, 100, 97, 112, 116, 101, 114, 47, 46, 46, 47, 46, 46, 47, 100, 101, 98, 117, 103, 112, 121, 47, 46, 46, 47, 100, 101, 98, 117, 103, 112, 121, 47, 115, 101, 114, 118, 101, 114]);setup = json.loads(decode([123, 34, 109, 111, 100, 101, 34, 58, 32, 34, 99, 111, 110, 110, 101, 99, 116, 34, 44, 32, 34, 97, 100, 100, 114, 101, 115, 115, 34, 58, 32, 91, 34, 49, 50, 55, 46, 48, 46, 48, 46, 49, 34, 44, 32, 52, 49, 51, 57, 57, 93, 44, 32, 34, 119, 97, 105, 116, 95, 102, 111, 114, 95, 99, 108, 105, 101, 110, 116, 34, 58, 32, 102, 97, 108, 115, 101, 44, 32, 34, 108, 111, 103, 95, 116, 111, 34, 58, 32, 110, 117, 108, 108, 44, 32, 34, 97, 100, 97, 112, 116, 101, 114, 95, 97, 99, 99, 101, 115, 115, 95, 116, 111, 107, 101, 110, 34, 58, 32, 34, 57, 55, 98, 98, 100, 55, 97, 48, 51, 53, 52, 99, 99, 97, 52, 57, 102, 56, 49, 55, 52, 98, 52, 54, 49, 101, 49, 56, 49, 49, 50, 98, 98, 56, 97, 56, 99, 54, 56, 100, 99, 54, 49, 50, 97, 99, 52, 52, 100, 98, 99, 102, 101, 99, 101, 49, 48, 48, 101, 55, 102, 48, 56, 50, 34, 125]));sys.path.insert(0, script_dir);import attach_pid_injected;del sys.path[0];attach_pid_injected.attach(setup);", 0)'

User Settings

Multiroot scenario, following user settings may not apply:

languageServer: "Pylance"

testing
• pytestEnabled: true

Activity

  1. int19h commented on Dec 4, 2023

    @int19h
    Contributor

    Possibly related to #1464

  2. dunalduck0 commented on Feb 25, 2025

    @dunalduck0

    I am blocked by this same error as well. Is there anyone investigating it?

    This is the configuration.

    {
        // 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": "Attach to Process ID",
                "type": "debugpy",
                "request": "attach",
                "processId": "${command:pickProcess}",
                "justMyCode": false,
                "logToFile": true
            },
    

    And here is the (very long) error.

    --- Starting attach to pid: 310692 ---
    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.
    Could not attach to process.  If your uid matches the uid of the target
    process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
    again as the root user.  For more details, see /etc/sysctl.d/10-ptrace.conf
    ptrace: Inappropriate ioctl for device.
    Target 'None' cannot support this command.
    The target architecture is set to "auto" (currently "i386").
    No symbol table is loaded.  Use the "file" command.
    No symbol table is loaded.  Use the "file" command.
    E+00000.238: Code injection into PID=310692 failed:
                 
                 Traceback (most recent call last):
                   File "/home/meiyang/.vscode-server/extensions/ms-python.debugpy-2025.0.1-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/../debugpy/server/cli.py", line 461, in attach_to_pid
                     add_code_to_python_process.run_python_code(
                   File "/home/meiyang/.vscode-server/extensions/ms-python.debugpy-2025.0.1-linux-x64/bundled/libs/debugpy/_vendored/pydevd/pydevd_attach_to_process/add_code_to_python_process.py", line 480, in run_python_code_linux
                     subprocess.check_call(" ".join(cmd), shell=True, env=env)
                   File "/home/meiyang/.local/share/uv/python/cpython-3.12.9-linux-x86_64-gnu/lib/python3.12/subprocess.py", line 415, in check_call
                     raise CalledProcessError(retcode, cmd)
                 subprocess.CalledProcessError: Command 'gdb --nw --nh --nx --pid 310692 --batch --eval-command='set scheduler-locking off' --eval-command='set architecture auto' --eval-command='call (void*)dlopen("/home/meiyang/.vscode-server/extensions/ms-python.debugpy-2025.0.1-linux-x64/bundled/libs/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_linux_amd64.so", 2)' --eval-command='sharedlibrary attach_linux_amd64' --eval-command='call (int)DoAttach(0, "import codecs;import json;import sys;decode = lambda s: codecs.utf_8_decode(bytearray(s))[0] if s is not None else None;script_dir = decode([47, 104, 111, 109, 101, 47, 109, 101, 105, 121, 97, 110, 103, 47, 46, 118, 115, 99, 111, 100, 101, 45, 115, 101, 114, 118, 101, 114, 47, 101, 120, 116, 101, 110, 115, 105, 111, 110, 115, 47, 109, 115, 45, 112, 121, 116, 104, 111, 110, 46, 100, 101, 98, 117, 103, 112, 121, 45, 50, 48, 50, 53, 46, 48, 46, 49, 45, 108, 105, 110, 117, 120, 45, 120, 54, 52, 47, 98, 117, 110, 100, 108, 101, 100, 47, 108, 105, 98, 115, 47, 100, 101, 98, 117, 103, 112, 121, 47, 97, 100, 97, 112, 116, 101, 114, 47, 46, 46, 47, 46, 46, 47, 100, 101, 98, 117, 103, 112, 121, 47, 46, 46, 47, 100, 101, 98, 117, 103, 112, 121, 47, 115, 101, 114, 118, 101, 114]);setup = json.loads(decode([123, 34, 109, 111, 100, 101, 34, 58, 32, 34, 99, 111, 110, 110, 101, 99, 116, 34, 44, 32, 34, 97, 100, 100, 114, 101, 115, 115, 34, 58, 32, 91, 34, 49, 50, 55, 46, 48, 46, 48, 46, 49, 34, 44, 32, 52, 57, 50, 54, 53, 93, 44, 32, 34, 119, 97, 105, 116, 95, 102, 111, 114, 95, 99, 108, 105, 101, 110, 116, 34, 58, 32, 102, 97, 108, 115, 101, 44, 32, 34, 108, 111, 103, 95, 116, 111, 34, 58, 32, 110, 117, 108, 108, 44, 32, 34, 97, 100, 97, 112, 116, 101, 114, 95, 97, 99, 99, 101, 115, 115, 95, 116, 111, 107, 101, 110, 34, 58, 32, 34, 97, 99, 53, 52, 52, 101, 100, 101, 57, 49, 48, 50, 97, 54, 100, 48, 99, 51, 48, 100, 56, 48, 52, 100, 101, 57, 97, 53, 53, 49, 99, 48, 55, 53, 49, 101, 55, 98, 50, 55, 52, 57, 56, 99, 98, 51, 100, 100, 54, 54, 99, 98, 102, 52, 52, 97, 100, 57, 48, 52, 49, 57, 99, 101, 34, 125]));sys.path.insert(0, script_dir);import attach_pid_injected;del sys.path[0];attach_pid_injected.attach(setup);", 0)'' returned non-zero exit status 1.
                 
                 Stack where logged:
                   File "<frozen runpy>", line 198, in _run_module_as_main
                   File "<frozen runpy>", line 88, in _run_code
                   File "/home/meiyang/.vscode-server/extensions/ms-python.debugpy-2025.0.1-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/__main__.py", line 71, in <module>
                     cli.main()
                   File "/home/meiyang/.vscode-server/extensions/ms-python.debugpy-2025.0.1-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/../debugpy/server/cli.py", line 501, in main
                     run()
                   File "/home/meiyang/.vscode-server/extensions/ms-python.debugpy-2025.0.1-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/../debugpy/server/cli.py", line 468, in attach_to_pid
                     log.reraise_exception("Code injection into PID={0} failed:", pid)
                   File "/home/meiyang/.vscode-server/extensions/ms-python.debugpy-2025.0.1-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/../debugpy/common/log.py", line 222, in reraise_exception
                     _exception(format_string, *args, **kwargs)
                 
    
    Traceback (most recent call last):
      File "<frozen runpy>", line 198, in _run_module_as_main
      File "<frozen runpy>", line 88, in _run_code
      File "/home/meiyang/.vscode-server/extensions/ms-python.debugpy-2025.0.1-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/__main__.py", line 71, in <module>
        cli.main()
      File "/home/meiyang/.vscode-server/extensions/ms-python.debugpy-2025.0.1-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/../debugpy/server/cli.py", line 501, in main
        run()
      File "/home/meiyang/.vscode-server/extensions/ms-python.debugpy-2025.0.1-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/../debugpy/server/cli.py", line 468, in attach_to_pid
        log.reraise_exception("Code injection into PID={0} failed:", pid)
      File "/home/meiyang/.vscode-server/extensions/ms-python.debugpy-2025.0.1-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/../debugpy/server/cli.py", line 461, in attach_to_pid
        add_code_to_python_process.run_python_code(
      File "/home/meiyang/.vscode-server/extensions/ms-python.debugpy-2025.0.1-linux-x64/bundled/libs/debugpy/_vendored/pydevd/pydevd_attach_to_process/add_code_to_python_process.py", line 480, in run_python_code_linux
        subprocess.check_call(" ".join(cmd), shell=True, env=env)
      File "/home/meiyang/.local/share/uv/python/cpython-3.12.9-linux-x86_64-gnu/lib/python3.12/subprocess.py", line 415, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command 'gdb --nw --nh --nx --pid 310692 --batch --eval-command='set scheduler-locking off' --eval-command='set architecture auto' --eval-command='call (void*)dlopen("/home/meiyang/.vscode-server/extensions/ms-python.debugpy-2025.0.1-linux-x64/bundled/libs/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_linux_amd64.so", 2)' --eval-command='sharedlibrary attach_linux_amd64' --eval-command='call (int)DoAttach(0, "import codecs;import json;import sys;decode = lambda s: codecs.utf_8_decode(bytearray(s))[0] if s is not None else None;script_dir = decode([47, 104, 111, 109, 101, 47, 109, 101, 105, 121, 97, 110, 103, 47, 46, 118, 115, 99, 111, 100, 101, 45, 115, 101, 114, 118, 101, 114, 47, 101, 120, 116, 101, 110, 115, 105, 111, 110, 115, 47, 109, 115, 45, 112, 121, 116, 104, 111, 110, 46, 100, 101, 98, 117, 103, 112, 121, 45, 50, 48, 50, 53, 46, 48, 46, 49, 45, 108, 105, 110, 117, 120, 45, 120, 54, 52, 47, 98, 117, 110, 100, 108, 101, 100, 47, 108, 105, 98, 115, 47, 100, 101, 98, 117, 103, 112, 121, 47, 97, 100, 97, 112, 116, 101, 114, 47, 46, 46, 47, 46, 46, 47, 100, 101, 98, 117, 103, 112, 121, 47, 46, 46, 47, 100, 101, 98, 117, 103, 112, 121, 47, 115, 101, 114, 118, 101, 114]);setup = json.loads(decode([123, 34, 109, 111, 100, 101, 34, 58, 32, 34, 99, 111, 110, 110, 101, 99, 116, 34, 44, 32, 34, 97, 100, 100, 114, 101, 115, 115, 34, 58, 32, 91, 34, 49, 50, 55, 46, 48, 46, 48, 46, 49, 34, 44, 32, 52, 57, 50, 54, 53, 93, 44, 32, 34, 119, 97, 105, 116, 95, 102, 111, 114, 95, 99, 108, 105, 101, 110, 116, 34, 58, 32, 102, 97, 108, 115, 101, 44, 32, 34, 108, 111, 103, 95, 116, 111, 34, 58, 32, 110, 117, 108, 108, 44, 32, 34, 97, 100, 97, 112, 116, 101, 114, 95, 97, 99, 99, 101, 115, 115, 95, 116, 111, 107, 101, 110, 34, 58, 32, 34, 97, 99, 53, 52, 52, 101, 100, 101, 57, 49, 48, 50, 97, 54, 100, 48, 99, 51, 48, 100, 56, 48, 52, 100, 101, 57, 97, 53, 53, 49, 99, 48, 55, 53, 49, 101, 55, 98, 50, 55, 52, 57, 56, 99, 98, 51, 100, 100, 54, 54, 99, 98, 102, 52, 52, 97, 100, 57, 48, 52, 49, 57, 99, 101, 34, 125]));sys.path.insert(0, script_dir);import attach_pid_injected;del sys.path[0];attach_pid_injected.attach(setup);", 0)'' returned non-zero exit status 1.
    PYDEVD_GDB_SCAN_SHARED_LIBRARIES not set (scanning all libraries for needed symbols).
    Running: gdb --nw --nh --nx --pid 310692 --batch --eval-command='set scheduler-locking off' --eval-command='set architecture auto' --eval-command='call (void*)dlopen("/home/meiyang/.vscode-server/extensions/ms-python.debugpy-2025.0.1-linux-x64/bundled/libs/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_linux_amd64.so", 2)' --eval-command='sharedlibrary attach_linux_amd64' --eval-command='call (int)DoAttach(0, "import codecs;import json;import sys;decode = lambda s: codecs.utf_8_decode(bytearray(s))[0] if s is not None else None;script_dir = decode([47, 104, 111, 109, 101, 47, 109, 101, 105, 121, 97, 110, 103, 47, 46, 118, 115, 99, 111, 100, 101, 45, 115, 101, 114, 118, 101, 114, 47, 101, 120, 116, 101, 110, 115, 105, 111, 110, 115, 47, 109, 115, 45, 112, 121, 116, 104, 111, 110, 46, 100, 101, 98, 117, 103, 112, 121, 45, 50, 48, 50, 53, 46, 48, 46, 49, 45, 108, 105, 110, 117, 120, 45, 120, 54, 52, 47, 98, 117, 110, 100, 108, 101, 100, 47, 108, 105, 98, 115, 47, 100, 101, 98, 117, 103, 112, 121, 47, 97, 100, 97, 112, 116, 101, 114, 47, 46, 46, 47, 46, 46, 47, 100, 101, 98, 117, 103, 112, 121, 47, 46, 46, 47, 100, 101, 98, 117, 103, 112, 121, 47, 115, 101, 114, 118, 101, 114]);setup = json.loads(decode([123, 34, 109, 111, 100, 101, 34, 58, 32, 34, 99, 111, 110, 110, 101, 99, 116, 34, 44, 32, 34, 97, 100, 100, 114, 101, 115, 115, 34, 58, 32, 91, 34, 49, 50, 55, 46, 48, 46, 48, 46, 49, 34, 44, 32, 52, 57, 50, 54, 53, 93, 44, 32, 34, 119, 97, 105, 116, 95, 102, 111, 114, 95, 99, 108, 105, 101, 110, 116, 34, 58, 32, 102, 97, 108, 115, 101, 44, 32, 34, 108, 111, 103, 95, 116, 111, 34, 58, 32, 110, 117, 108, 108, 44, 32, 34, 97, 100, 97, 112, 116, 101, 114, 95, 97, 99, 99, 101, 115, 115, 95, 116, 111, 107, 101, 110, 34, 58, 32, 34, 97, 99, 53, 52, 52, 101, 100, 101, 57, 49, 48, 50, 97, 54, 100, 48, 99, 51, 48, 100, 56, 48, 52, 100, 101, 57, 97, 53, 53, 49, 99, 48, 55, 53, 49, 101, 55, 98, 50, 55, 52, 57, 56, 99, 98, 51, 100, 100, 54, 54, 99, 98, 102, 52, 52, 97, 100, 57, 48, 52, 49, 57, 99, 101, 34, 125]));sys.path.insert(0, script_dir);import attach_pid_injected;del sys.path[0];attach_pid_injected.attach(setup);", 0)
    
  3. rchiodo commented on Feb 25, 2025

    @rchiodo
    Contributor

    Sorry, but this isn't being investigated. Sounds like gdb can't attach to the process for some reason. You might try searching for similar errors for gdb.

  4. rchiodo commented on Feb 25, 2025

    @rchiodo
    Contributor

    Alternatively, if you have access to the source you're debugging, you can inject debugpy yourself. See the API docs:
    https://github.com/microsoft/debugpy/wiki/API-Reference

  5. dunalduck0 commented on Feb 25, 2025

    @dunalduck0

    I came across this comment #1196 (comment). And the problem went away when I did this:
    sudo sysctl kernel.yama.ptrace_scope=0

  6. extenxionflow commented on Feb 7, 2026

    @extenxionflow

    Kush

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions