From 0d7e5c7910ce05c1e8ce1237a14f6e4af9f90701 Mon Sep 17 00:00:00 2001 From: blasty Date: Thu, 23 Jul 2026 23:43:37 +0200 Subject: launch: sweep a crashed worker's stale DB locks before starting the supervisor A binary whose worker was hard-killed mid-analysis leaves unpacked .id0/.id1/ .id2/.nam/.til files (no .i64). The supervisor is seeded with the target and opens it on startup, so a wedged DB there crash-loops the whole supervisor ("Failed to open initial binary: Remote end closed connection") and the launcher reports "supervisor exited during startup" -- before the TUI's own open-time recovery can ever run. When the launcher is about to start a fresh supervisor (server is down, so nothing can hold the DB), proactively sweep the target's stale unpacked lock files first (never the packed .i64). Safe because no server == no live session. Verified: after clearing bash's stale locks the supervisor starts and stays up 20/20 checks over 20s with no crash loop and a clean log. --- idatui/launch.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/idatui/launch.py b/idatui/launch.py index b02bf05..1acd99a 100644 --- a/idatui/launch.py +++ b/idatui/launch.py @@ -196,6 +196,15 @@ def main(argv: list[str] | None = None) -> int: # 1) supervisor up (seed it with our target so its initial worker is useful) if not args.no_server: + # If we're about to start a fresh supervisor (it's down), nothing holds + # this binary's DB, so clear any stale unpacked lock files a crashed + # worker left behind. The supervisor is seeded with this target and opens + # it on startup; a wedged DB there crash-loops the whole supervisor + # before the TUI's own recovery can ever run. + if binary is not None and not _server_up(*_server_addr(args.url)): + swept = _sweep_locks(binary) + if swept: + _log(f"cleared {swept} stale lock file(s) from a crashed worker") if not _ensure_server(args.url, binary): return 1 elif not _server_up(*_server_addr(args.url)): -- cgit v1.3.1-sl0p