-
Notifications
You must be signed in to change notification settings - Fork 17
Description
Environment
- dap v0.4.1
- debugpy 1.8.18
- Python 3.11.9
- Linux 6.8.0-106-generic x86_64
Description
When a breakpoint takes a long time to reach (program doing heavy computation for minutes), the debug adapter disconnects with EOF. The program itself continues running fine — only the debug adapter connection is lost.
Steps to reproduce
# slow_app.py
import time
import hashlib
def expensive_work():
results = []
for i in range(120): # ~2 minutes of computation
data = str(i).encode()
for _ in range(200_000):
data = hashlib.sha256(data).digest()
results.append(data)
print(f"cycle {i}/120", flush=True)
return results # breakpoint target
if __name__ == "__main__":
result = expensive_work()
print(f"Done, got {len(result)} results")Two failure modes observed:
Mode 1: dap debug --break (single command)
dap debug slow_app.py --break slow_app.py:14 --session repro
# After ~60s:
# Error: reading response: read length: read unix @->~/.dap-cli/repro.sock: i/o timeoutMode 2: --stop-on-entry + continue
dap debug slow_app.py --stop-on-entry --session repro
# Returns immediately, stopped at entry ✓
dap continue --break slow_app.py:14 --session repro
# After ~60s:
# Error: debug adapter disconnected unexpectedly: EOFExpected behavior
dap continue blocks until the breakpoint is hit (however long that takes) and returns the auto-context.
Actual behavior
The debug adapter connection drops after ~60 seconds of continuous computation, even though the program is still running correctly.
Real-world context
This was discovered while trying to debug a PyQt6 app doing GPU inference (torch + CUDA) on 6 video streams. The program needs ~5 minutes of processing to reach the breakpoint at cycle 95. The same program runs perfectly without dap.
Possible cause
There may be a hardcoded timeout in the daemon ↔ adapter communication that doesn't account for long periods without DAP protocol messages (the program is computing, not hitting breakpoints or producing debug events).