`set_trace`-releated deadlock when running inside Ansible with explicit listen-and-debug breakpoint
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
Línea de trabajo
Reproduce el problema con el plugin de lookup de Ansible que contiene el bloque listen-and-wait de debugpy y, después, compáralo con el script hello-world proporcionado. Empieza en debugpy/_vendored/pydevd/pydevd.py, alrededor de wait_for_ready_to_run(), y usa el launch.json adjunto para la configuración del cliente. Se considera terminado cuando conectarse durante la ejecución de Ansible ya no deja Variables cargando ni hace que los comandos del depurador excedan el tiempo de espera.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Environment data
- debugpy version: 1.8.1 (run
import debugpy; print(debugpy.__version__)if uncertain) - OS and version: Mac OS X Sonoma 14.2.1 (23C71)
- Python version: Python 3.11.7 that comes with Mac OS X
- Using VS Code version 1.86.1 (likely irrelevant, as I observe the same behavior with Emacs and dape.el)
Actual behavior
Upon attempting to attach the client,
- Variables → Locals keeps spinning inside VS Code
- Debugger is catatonic; every command times out (same when tried out of Emacs)
- Pressing C-c yields the following stack trace (even after waiting for several minutes):
^CTraceback (most recent call last):
File "/Users/quatrava/Dev/ops/xaasible-ops/ansible-deps-cache/python-libs/lib/python/site-packages/debugpy/_vendored/pydevd/pydevd.py", line 3489, in <module>
[ERROR]: User interrupted execution
main()
File "/Users/quatrava/Dev/ops/xaasible-ops/ansible-deps-cache/python-libs/lib/python/site-packages/debugpy/_vendored/pydevd/pydevd.py", line 3482, in main
globals = debugger.run(setup['file'], None, None, is_module)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/quatrava/Dev/ops/xaasible-ops/ansible-deps-cache/python-libs/lib/python/site-packages/debugpy/_vendored/pydevd/pydevd.py", line 2476, in run
self.wait_for_ready_to_run()
File "/Users/quatrava/Dev/ops/xaasible-ops/ansible-deps-cache/python-libs/lib/python/site-packages/debugpy/_vendored/pydevd/pydevd.py", line 838, in wait_for_ready_to_run
self._py_db_command_thread_event.wait(0.1)
File "/usr/local/Cellar/python@3.11/3.11.7/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 629, in wait
signaled = self._cond.wait(timeout)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/python@3.11/3.11.7/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 331, in wait
gotit = waiter.acquire(True, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyboardInterrupt
Expected behavior
Debugger session should proceed as usual, even though some slow JSON-RPCs are expected (i.e. because my test case has large visible variables). Note that that is exactly what happens if instead of running Ansible, I run a hello-world Python script that features the same debugpy stanza to await debugger connect, i.e.
import debugpy; debugpy.listen(5678); debugpy.wait_for_client(); debugpy.breakpoint()
print("hello world")
Steps to reproduce:
- Configure VS Code as per the documentation. My
.vscode/launch.jsonis attached below - Install Ansible
- Create
lookup_plugins/my_python_lookup.pyand add the following code inside:from ansible.plugins.lookup import LookupBase class LookupModule(LookupBase): def run(self, terms, variables=None, **kwargs): import debugpy; debugpy.listen(5678); debugpy.wait_for_client(); debugpy.breakpoint() return ["toto"] - Prepare a trivial Ansible playbook that calls
'{{ lookup("my_python_lookup") }}'somewhere - Run the Ansible playbook
Attachments
.vscode/launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Débogueur Python : Attachement à distance",
"type": "debugpy",
"request": "attach",
"connect": {
"host": "localhost",
"port": 5678
},
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "."
}
]
}
]
}
- Lenguaje dominante
- Python
- Estrellas
- 2.5k
- Forks
- 202
- Merge medio
- 5 d 1 h
- PR fusionados (30 d)
- 1
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/debugpy
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
Document "rules"-option Abiertodocumentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
-
Adapter bootstrap fails with ConnectionRefusedError on WSL2 VirtioProxy or hostAddressLoopback Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
Todos los issues de microsoft/debugpy
Issues similares
-
[Bug] reef-hermes tells me to resume with hermes --resume, which does not work from my shell Abiertoarea: harness bug status: needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Human-Agent-Society/reef#625 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 80/100
learningequality/kolibri#15351 · 2 comentarios ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
Name consistency Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
eellak/triplestore#65 · 1 comentario ·