fix: make MCP panic logging non-panicking - #66
Open
mukeshbhandarkar wants to merge 1 commit into
Open
mukeshbhandarkar wants to merge 1 commit into
mukeshbhandarkar wants to merge 1 commit into
Conversation
Signed-off-by: mukeshbhandarkar <shell00035@gmail.com>
mukeshbhandarkar
requested review from
WinterQuant,
johnintuit,
murari316 and
sandeep-mewara
as code owners
August 22, 2026 03:24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the recursive panic path described in section 1 of #65.
The MCP panic hook currently logs through
eprintln!. If stderr is unavailable or closed,eprintln!can panic while the process is already handling a panic. That re-enters the panic hook and can turn a recoverable panic into a hard abort.This change makes stderr logging best-effort by writing through a locked stderr handle and ignoring write failures.
Changes
mcp_logstderr writes non-panicking/dev/fullto simulate stderr write failureScope
This PR intentionally addresses only the panic-hook recursion from #65.
It does not address the separate OOM, segfault, worker lifecycle, or core-dump-location observations from that issue.
Validation
Passed locally:
cargo fmt --all -- --checkgit diff --checkThe targeted runtime test was attempted locally, but the build was blocked before reaching the MCP test by unrelated native dependency build failures in
usearch/simsimdand thenlbug.The regression test is included so CI can exercise the panic path in the repository's supported build environment.