Repository navigation
fix(server): clean up undisclosed sessions when open fails or is cancelled - #126
xiaozhu1337 wants to merge 3 commits into
Conversation
|
Merged as #136, which takes your two fix commits with your authorship on them. Thank you - this was the one item in the whole backlog whose defect and fix both held up unchanged under review. I reproduced the leak first try against the real tool handler, and the Three changes on top, all explained in #136:
I left out the One note on your ownership suite, which is otherwise good: Your three follow-up findings landed too: markers in #137, bounded retention and deterministic teardown in #139. |
What this changes
Closes #125.
Make all four
open_*tools own their newly created debugger until initialization, mandatory/optional triage, output filtering, and the cancellation check succeed.ExitStackto register rollback alongside each session registration._close_sessionto remove and shut down only that call's undisclosed session.The second commit mechanically extracts schemas, prompt/tool metadata, and presentation helpers to
server_support.py, keeping the session-ownership code separate and both files under 800 lines. Existing model/helper names remain imported byserver.py. A missing-prompt regression check covers the extracted error path. The ownership fix and extraction are separate commits for review.Why
A successful debugger connection followed by an initial
!pebtimeout currently leaves an open session registered without ever returning its ID. Retries therefore accumulate debugger processes/connections the client cannot address. Initialization, optional sections, and output-filter errors have the same ownership gap.This addresses a demonstrated session leak. It does not claim to prove or fully fix a reported Windows nonpaged-pool exhaustion: the exact kernel-side NPFS/CDB allocation mechanism remains unconfirmed. It does not change output-buffer limits, subprocess transport internals, or debugger startup behavior.
No overlap with #124's dump-command cancellation changes in
debug_session.py; both fixes can coexist.How it was verified
Windows, Python 3.12.10, fake debugger sessions through the real MCP tool handler; no live target or resource-exhaustion experiment.
developdue to missing shutdown.git diff --checkpasses; dependencies and lockfile are unchanged.uv sync --group dev uv run pytest src/mcp_windbg/tests -m "not live" -q