Open
Description
Environment data
- debugpy version: 1.8.0, 1.6.7.post1
- OS and version: Ubuntu 22.04
- Python version (& distribution if applicable, e.g. Anaconda): 3.10, 3.11
- Using VS Code or Visual Studio: VSCode, Terminal
Actual behavior
./venv/bin/python -Xfrozen_modules=off -m debugpy --listen localhost:5678 --pid 26251
Attached to the process by pid.
Expected behavior
I'm getting after ./venv/bin/python -Xfrozen_modules=off -m debugpy --listen localhost:5678 --pid 26251:
PYDEVD_GDB_SCAN_SHARED_LIBRARIES not set (scanning all libraries for needed symbols).
Running: gdb --nw --nh --nx --pid 28133 --batch --eval-command='set scheduler-locking off' --eval-command='set architecture auto' --eval-command='call (void*)dlopen("/home/artem/work/testproj/untitledpy/venv/lib/python3.11/site-packages/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, 114, 116, 101, 109, 47, 119, 111, 114, 107, 47, 116, 101, 115, 116, 112, 114, 111, 106, 47, 117, 110, 116, 105, 116, 108, 101, 100, 112, 121, 47, 118, 101, 110, 118, 47, 108, 105, 98, 47, 112, 121, 116, 104, 111, 110, 51, 46, 49, 49, 47, 115, 105, 116, 101, 45, 112, 97, 99, 107, 97, 103, 101, 115, 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, 108, 105, 115, 116, 101, 110, 34, 44, 32, 34, 97, 100, 100, 114, 101, 115, 115, 34, 58, 32, 91, 34, 108, 111, 99, 97, 108, 104, 111, 115, 116, 34, 44, 32, 53, 54, 55, 56, 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, 110, 117, 108, 108, 125]));sys.path.insert(0, script_dir);import attach_pid_injected;del sys.path[0];attach_pid_injected.attach(setup);", 0)'
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
0x00007f8b7a2e578a in clock_nanosleep () from /lib/x86_64-linux-gnu/libc.so.6
The target architecture is set to "auto" (currently "i386:x86-64").
$1 = (void *) 0x10c55a0
[Detaching after vfork from child process 28206]
[Detaching after vfork from child process 28207]
[New Thread 0x7f8b78734640 (LWP 28213)]
[New Thread 0x7f8b77f33640 (LWP 28214)]
[New Thread 0x7f8b77732640 (LWP 28216)]
[New Thread 0x7f8b76f31640 (LWP 28217)]
[New Thread 0x7f8b76730640 (LWP 28218)]
[Thread 0x7f8b76730640 (LWP 28218) exited]
[New Thread 0x7f8b76730640 (LWP 28219)]
[Thread 0x7f8b76730640 (LWP 28219) exited]
[New Thread 0x7f8b76730640 (LWP 28220)]
[Thread 0x7f8b76730640 (LWP 28220) exited]
[New Thread 0x7f8b76730640 (LWP 28221)]
[Thread 0x7f8b76730640 (LWP 28221) exited]
[New Thread 0x7f8b76730640 (LWP 28222)]
[Thread 0x7f8b76730640 (LWP 28222) exited]
[New Thread 0x7f8b76730640 (LWP 28223)]
[Thread 0x7f8b76730640 (LWP 28223) exited]
[New Thread 0x7f8b76730640 (LWP 28224)]
[Thread 0x7f8b76730640 (LWP 28224) exited]
$2 = 0
[Inferior 1 (process 28133) detached]
In the process:
The threading module was not imported by user code in the main thread. The debugger will attempt to work around https://bugs.python.org/issue37416.
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.
The second run leads to this:
PYDEVD_GDB_SCAN_SHARED_LIBRARIES not set (scanning all libraries for needed symbols).
Running: gdb --nw --nh --nx --pid 28133 --batch --eval-command='set scheduler-locking off' --eval-command='set architecture auto' --eval-command='call (void*)dlopen("/home/artem/work/testproj/untitledpy/venv/lib/python3.11/site-packages/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, 114, 116, 101, 109, 47, 119, 111, 114, 107, 47, 116, 101, 115, 116, 112, 114, 111, 106, 47, 117, 110, 116, 105, 116, 108, 101, 100, 112, 121, 47, 118, 101, 110, 118, 47, 108, 105, 98, 47, 112, 121, 116, 104, 111, 110, 51, 46, 49, 49, 47, 115, 105, 116, 101, 45, 112, 97, 99, 107, 97, 103, 101, 115, 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, 108, 105, 115, 116, 101, 110, 34, 44, 32, 34, 97, 100, 100, 114, 101, 115, 115, 34, 58, 32, 91, 34, 108, 111, 99, 97, 108, 104, 111, 115, 116, 34, 44, 32, 53, 54, 55, 56, 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, 110, 117, 108, 108, 125]));sys.path.insert(0, script_dir);import attach_pid_injected;del sys.path[0];attach_pid_injected.attach(setup);", 0)'
[New LWP 28213]
[New LWP 28214]
[New LWP 28216]
[New LWP 28217]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
0x00007f8b7a2e57f8 in clock_nanosleep () from /lib/x86_64-linux-gnu/libc.so.6
The target architecture is set to "auto" (currently "i386:x86-64").
$1 = (void *) 0x10c55a0
[Thread 0x7f8b77732640 (LWP 28216) exited]
[Thread 0x7f8b76f31640 (LWP 28217) exited]
[Thread 0x7f8b78734640 (LWP 28213) exited]
[Thread 0x7f8b77f33640 (LWP 28214) exited]
[Detaching after vfork from child process 28455]
$2 = 0
[Inferior 1 (process 28133) detached]
In the app:
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.
0.02s - Could not connect to 127.0.0.1: 59941
Traceback (most recent call last):
File "/home/artem/work/testproj/untitledpy/venv/lib/python3.11/site-packages/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py", line 493, in start_client
s.connect((host, port))
ConnectionRefusedError: [Errno 111] Connection refused
Could not connect to 127.0.0.1: 59941
Traceback (most recent call last):
File "/home/artem/work/testproj/untitledpy/venv/lib/python3.11/site-packages/debugpy/_vendored/pydevd/pydevd.py", line 3476, in main
debugger.connect(host, port)
File "/home/artem/work/testproj/untitledpy/venv/lib/python3.11/site-packages/debugpy/_vendored/pydevd/pydevd.py", line 1421, in connect
s = start_client(host, port)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/artem/work/testproj/untitledpy/venv/lib/python3.11/site-packages/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py", line 493, in start_client
s.connect((host, port))
ConnectionRefusedError: [Errno 111] Connection refused
Traceback (most recent call last):
File "/home/artem/work/testproj/untitledpy/venv/lib/python3.11/site-packages/debugpy/server/api.py", line 237, in listen
sock, _ = endpoints_listener.accept()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/socket.py", line 293, in accept
fd, addr = self._accept()
^^^^^^^^^^^^^^
TimeoutError: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/artem/work/testproj/untitledpy/venv/lib/python3.11/site-packages/debugpy/server/attach_pid_injected.py", line 75, in attach
debugpy.listen(setup["address"])
File "/home/artem/work/testproj/untitledpy/venv/lib/python3.11/site-packages/debugpy/public_api.py", line 31, in wrapper
return wrapped(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/artem/work/testproj/untitledpy/venv/lib/python3.11/site-packages/debugpy/server/api.py", line 143, in debug
log.reraise_exception("{0}() failed:", func.__name__, level="info")
File "/home/artem/work/testproj/untitledpy/venv/lib/python3.11/site-packages/debugpy/server/api.py", line 141, in debug
return func(address, settrace_kwargs, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/artem/work/testproj/untitledpy/venv/lib/python3.11/site-packages/debugpy/server/api.py", line 251, in listen
raise RuntimeError("timed out waiting for adapter to connect")
RuntimeError: timed out waiting for adapter to connect
E+00100.600: Traceback (most recent call last):
File "/home/artem/work/testproj/untitledpy/venv/lib/python3.11/site-packages/debugpy/server/api.py", line 237, in listen
sock, _ = endpoints_listener.accept()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/socket.py", line 293, in accept
fd, addr = self._accept()
^^^^^^^^^^^^^^
TimeoutError: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/artem/work/testproj/untitledpy/venv/lib/python3.11/site-packages/debugpy/server/attach_pid_injected.py", line 75, in attach
debugpy.listen(setup["address"])
File "/home/artem/work/testproj/untitledpy/venv/lib/python3.11/site-packages/debugpy/public_api.py", line 31, in wrapper
return wrapped(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/artem/work/testproj/untitledpy/venv/lib/python3.11/site-packages/debugpy/server/api.py", line 143, in debug
log.reraise_exception("{0}() failed:", func.__name__, level="info")
File "/home/artem/work/testproj/untitledpy/venv/lib/python3.11/site-packages/debugpy/server/api.py", line 141, in debug
return func(address, settrace_kwargs, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/artem/work/testproj/untitledpy/venv/lib/python3.11/site-packages/debugpy/server/api.py", line 251, in listen
raise RuntimeError("timed out waiting for adapter to connect")
RuntimeError: timed out waiting for adapter to connect
Stack where logged:
File "/home/artem/work/testproj/untitledpy/main.py", line 27, in <module>
time.sleep(1)
File "<string>", line 1, in <module>
File "/home/artem/work/testproj/untitledpy/venv/lib/python3.11/site-packages/debugpy/server/attach_pid_injected.py", line 90, in attach
log.reraise_exception()
File "/home/artem/work/testproj/untitledpy/venv/lib/python3.11/site-packages/debugpy/common/log.py", line 222, in reraise_exception
_exception(format_string, *args, **kwargs)
Traceback (most recent call last):
File "/home/artem/work/testproj/untitledpy/venv/lib/python3.11/site-packages/debugpy/server/api.py", line 237, in listen
sock, _ = endpoints_listener.accept()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/socket.py", line 293, in accept
fd, addr = self._accept()
^^^^^^^^^^^^^^
TimeoutError: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/artem/work/testproj/untitledpy/venv/lib/python3.11/site-packages/debugpy/server/attach_pid_injected.py", line 90, in attach
log.reraise_exception()
File "/home/artem/work/testproj/untitledpy/venv/lib/python3.11/site-packages/debugpy/server/attach_pid_injected.py", line 75, in attach
debugpy.listen(setup["address"])
File "/home/artem/work/testproj/untitledpy/venv/lib/python3.11/site-packages/debugpy/public_api.py", line 31, in wrapper
return wrapped(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/artem/work/testproj/untitledpy/venv/lib/python3.11/site-packages/debugpy/server/api.py", line 143, in debug
log.reraise_exception("{0}() failed:", func.__name__, level="info")
File "/home/artem/work/testproj/untitledpy/venv/lib/python3.11/site-packages/debugpy/server/api.py", line 141, in debug
return func(address, settrace_kwargs, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/artem/work/testproj/untitledpy/venv/lib/python3.11/site-packages/debugpy/server/api.py", line 251, in listen
raise RuntimeError("timed out waiting for adapter to connect")
RuntimeError: timed out waiting for adapter to connect
Steps to reproduce:
- Run python main.py script
- Get the PID
- try to attach to the PID ./venv/bin/python -Xfrozen_modules=off -m debugpy --listen localhost:5678 --pid PID
- try to attach to the PID again
3*. try to start VSCode with attach settings
{
"name": "Python: Attach",
"type": "python",
"request": "attach",
"connect": {
"host": "localhost",
"port": PID
}
}
get an error "connect ECONNREFUSED 127.0.0.1:5678"
Note
With PYDEVD_GDB_SCAN_SHARED_LIBRARIES and PYDEVD_DISABLE_FILE_VALIDATION=1 the same.