microsoft / microsoft/vscode-python-debugger
Bug: Debug Attach stopped working in 2025.18.0
Ninguém assumiu esta issue ainda.
- Linguagem predominante
- TypeScript
- Estrelas
- 181
- Forks
- 126
- Merge médio
- 2d 3h
- PRs com merge (30d)
- 3
Descrição
Debug attach mode stopped working in 2025.18.0. When I downgrade to 2025.16.0, it works again.
Reproducer:
Launch configuration:
{
"name": "Python Debugger: Attach using Process Id",
"type": "debugpy",
"request": "attach",
"processId": "${command:pickProcess}"
}
In my SLES 15-SP4 (Linux) machine:
> python3
Python 3.12.0 (main, Oct 18 2023, 17:19:09) [GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
Ctrl click to launch VS Code Native REPL
>>> import os
>>> os.getpid()
<pid of python process will be shown>
Start the debugging with the launch configuration from above and use the pid from the os.getpid(). Then observe that it will just try to attach for a minute, then give up with the following error:
This is the content in the debug console:
Attach to PID failed.
--- Starting attach to pid: 141427 ---
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.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
0x00007fa0655600a6 in select () from /lib64/libc.so.6
The target architecture is set to "auto" (currently "i386:x86-64").
$1 = (void *) 0x0
No symbol "DoAttach" in current context.
[Inferior 1 (process 141427) detached]
E+00000.426: Code injection into PID=141427 failed:
Traceback (most recent call last):
File "/disk2/tsonono/.vscode-server/extensions/ms-python.debugpy-2025.18.0/bundled/libs/debugpy/adapter/../../debugpy/../debugpy/server/cli.py", line 468, in attach_to_pid
add_code_to_python_process.run_python_code(
File "/disk2/tsonono/.vscode-server/extensions/ms-python.debugpy-2025.18.0/bundled/libs/debugpy/_vendored/pydevd/pydevd_attach_to_process/add_code_to_python_process.py", line 483, in run_python_code_linux
subprocess.check_call(" ".join(cmd), shell=True, env=env)
File "/usr/itm/python/3.12.0/lib/python3.12/subprocess.py", line 413, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'gdb --nw --nh --nx --pid 141427 --batch --eval-command='set scheduler-locking off' --eval-command='set architecture auto' --eval-command='call (void*)dlopen("/disk2/tsonono/.vscode-server/extensions/ms-python.debugpy-2025.18.0/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, 100, 105, 115, 107, 50, 47, 116, 115, 111, 110, 111, 110, 111, 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, 49, 56, 46, 48, 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, 52, 52, 56, 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, 97, 53, 101, 51, 51, 100, 52, 53, 50, 48, 56, 50, 51, 48, 49, 54, 53, 54, 48, 55, 57, 52, 52, 48, 57, 54, 57, 98, 48, 51, 52, 52, 102, 99, 99, 50, 56, 97, 54, 98, 57, 53, 55, 49, 55, 50, 50, 99, 54, 97, 99, 100, 48, 53, 48, 49, 54, 102, 102, 50, 99, 54, 102, 102, 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 "/disk2/tsonono/.vscode-server/extensions/ms-python.debugpy-2025.18.0/bundled/libs/debugpy/adapter/../../debugpy/__main__.py", line 71, in <module>
cli.main()
File "/disk2/tsonono/.vscode-server/extensions/ms-python.debugpy-2025.18.0/bundled/libs/debugpy/adapter/../../debugpy/../debugpy/server/cli.py", line 508, in main
run()
File "/disk2/tsonono/.vscode-server/extensions/ms-python.debugpy-2025.18.0/bundled/libs/debugpy/adapter/../../debugpy/../debugpy/server/cli.py", line 475, in attach_to_pid
log.reraise_exception("Code injection into PID={0} failed:", pid)
File "/disk2/tsonono/.vscode-server/extensions/ms-python.debugpy-2025.18.0/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 "/disk2/tsonono/.vscode-server/extensions/ms-python.debugpy-2025.18.0/bundled/libs/debugpy/adapter/../../debugpy/__main__.py", line 71, in <module>
cli.main()
File "/disk2/tsonono/.vscode-server/extensions/ms-python.debugpy-2025.18.0/bundled/libs/debugpy/adapter/../../debugpy/../debugpy/server/cli.py", line 508, in main
run()
File "/disk2/tsonono/.vscode-server/extensions/ms-python.debugpy-2025.18.0/bundled/libs/debugpy/adapter/../../debugpy/../debugpy/server/cli.py", line 475, in attach_to_pid
log.reraise_exception("Code injection into PID={0} failed:", pid)
File "/disk2/tsonono/.vscode-server/extensions/ms-python.debugpy-2025.18.0/bundled/libs/debugpy/adapter/../../debugpy/../debugpy/server/cli.py", line 468, in attach_to_pid
add_code_to_python_process.run_python_code(
File "/disk2/tsonono/.vscode-server/extensions/ms-python.debugpy-2025.18.0/bundled/libs/debugpy/_vendored/pydevd/pydevd_attach_to_process/add_code_to_python_process.py", line 483, in run_python_code_linux
subprocess.check_call(" ".join(cmd), shell=True, env=env)
File "/usr/itm/python/3.12.0/lib/python3.12/subprocess.py", line 413, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'gdb --nw --nh --nx --pid 141427 --batch --eval-command='set scheduler-locking off' --eval-command='set architecture auto' --eval-command='call (void*)dlopen("/disk2/tsonono/.vscode-server/extensions/ms-python.debugpy-2025.18.0/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, 100, 105, 115, 107, 50, 47, 116, 115, 111, 110, 111, 110, 111, 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, 49, 56, 46, 48, 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, 52, 52, 56, 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, 97, 53, 101, 51, 51, 100, 52, 53, 50, 48, 56, 50, 51, 48, 49, 54, 53, 54, 48, 55, 57, 52, 52, 48, 57, 54, 57, 98, 48, 51, 52, 52, 102, 99, 99, 50, 56, 97, 54, 98, 57, 53, 55, 49, 55, 50, 50, 99, 54, 97, 99, 100, 48, 53, 48, 49, 54, 102, 102, 50, 99, 54, 102, 102, 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 141427 --batch --eval-command='set scheduler-locking off' --eval-command='set architecture auto' --eval-command='call (void*)dlopen("/disk2/tsonono/.vscode-server/extensions/ms-python.debugpy-2025.18.0/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, 100, 105, 115, 107, 50, 47, 116, 115, 111, 110, 111, 110, 111, 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, 49, 56, 46, 48, 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, 52, 52, 56, 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, 97, 53, 101, 51, 51, 100, 52, 53, 50, 48, 56, 50, 51, 48, 49, 54, 53, 54, 48, 55, 57, 52, 52, 48, 57, 54, 57, 98, 48, 51, 52, 52, 102, 99, 99, 50, 56, 97, 54, 98, 57, 53, 55, 49, 55, 50, 50, 99, 54, 97, 99, 100, 48, 53, 48, 49, 54, 102, 102, 50, 99, 54, 102, 102, 34, 125]));sys.path.insert(0, script_dir);import attach_pid_injected;del sys.path[0];attach_pid_injected.attach(setup);", 0)'
The gdb version on my host if 14.2, if that's of any relevance, as the debugger is seemingly using the host's gdb based on the output in the debug console.
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Direção de pesquisa
Reproduza a falha de attach usando a configuração de inicialização fornecida, um processo Python 3.12, o ambiente SLES 15-SP4 e host gdb. Leia debugpy/server/cli.py, pydevd_attach_to_process/add_code_to_python_process.py e o traceback relacionado a attach_linux_amd64.so; considera-se concluído quando o attach por PID funciona em 2025.18.0 sem o erro de injeção relatado.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- linux, python, vscode
- Domínio
- devtools, operating-systems
- Tipo de issue
- Bug
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Status de atividade
- Estagnada
- Clareza
- Precisa de esclarecimento
- Facilidade para iniciantes
- 30/100