Never clear IDA residue out from under a live server - #231
Open
subwire wants to merge 1 commit into
Open
Conversation
The clear was gated on "no live server is registered for this project".
That trusts the registry, and the registry is not a reliable witness: a
running server can be missing from it. Caught in the act on a benchmark
run --
$ decompiler list --json
{ "servers": [] }
$ ps auxww | grep declib
... --server-id 25c68aada6 --project-dir .../re_project
... --server-id 4407c27e6c --project-dir /tmp/re_analyst_crackme04.Xxx3tb
... --server-id 58d279d42a --project-dir /tmp/re_32_compare_declib.sEQYhU
... --server-id 957351bdd1 --project-dir /tmp/re_analyst_crackme04.Xxx3tb
Four healthy servers, zero in the registry. With that gate, the next load
onto one of those project dirs deletes the unpacked database of a server
still using it -- turning a registry glitch into real corruption. It fired:
the load that printed "cleared stale IDA database residue (5 file(s))"
was clearing files belonging to a live server, and reproduces on demand.
Ownership is now established from the process table, which cannot
silently lose a live process, instead of from the registry. Verified both
directions: with a live owner the files survive (and the second load fails
honestly, because IDA cannot open a database another process holds);
with no owner the residue is still cleared, so the original fix is intact.
Falls back to "assume owned" if psutil is unavailable -- refusing to clear
costs a reload, clearing wrongly costs the database.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Targets
recover-stale-ida-database(#226) directly — this is a safety fix for that PR, found while benchmarking it. Merge into #226 before #226 lands, or land them together.The hole
#226 gates the clear on "no live server is registered for this project". That trusts the registry — and the registry is not a reliable witness. Caught in the act:
Four healthy servers, zero in the registry. Two of them share a project dir.
With the registry-based gate, the next
loadonto one of those dirs deletes the unpacked database of a server that is still using it — turning a registry glitch into actual corruption. This is not hypothetical: the load that printedcleared stale IDA database residue from a previous crash (5 file(s))was deleting a live server's files, and it reproduces on demand.Fix
Establish ownership from the process table, which cannot silently lose a live process, rather than from the registry.
Verified both directions:
So #226's actual purpose is intact — genuine crash residue is still removed.
If
psutilis unavailable the check assumes the project is owned and skips: refusing to clear costs a reload, clearing wrongly costs the database.Note
The empty-registry condition itself is a separate bug and is not fixed here — this only makes the clear safe in its presence. Worth tracking on its own; it is also why
loadappears to "hang" for the full--timeoutwhile the server it is waiting for is up and healthy.🤖 Generated with Claude Code