Commit 823ea57
fix(gdb): drain stale debug events before resuming vcpus
When more than one vcpu hits a breakpoint while the VM runs, each sends
a debug event and parks itself in the paused emulation state. The gdb
event loop reports the first and force-pauses the rest, but their
already-queued debug events are never consumed. On the next resume those
stale events remain, so a following `wait_for_stop_reason` dequeues one
and processes it against a vcpu that has since resumed: it marks a
running vcpu as paused, desyncing the pause/resume handshake until the
vcpu threads exit and the event channel disconnects — surfacing as a
fatal `GdbQueueError` ("Remote connection closed" on the client) under a
sustained multi-vcpu breakpoint storm.
Drain the debug-event queue at the start of `resume_all_vcpus`. Every
vcpu is paused there, so none can emit an event and anything queued is
provably stale; dropping it is safe and keeps `vcpu_state` in sync with
the vcpus.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Nikita Kalyazin <nikita.kalyazin@e2b.dev>1 parent 1af7f3e commit 823ea57
1 file changed
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
222 | 231 | | |
223 | 232 | | |
224 | 233 | | |
| |||
0 commit comments