Skip to content

Fix IDA freezing on live function queries - #54

Merged
danielplohmann merged 2 commits into
mainfrom
fix/ida-live-query-hang
Oct 15, 2026
Merged

danielplohmann merged 2 commits into
mainfrom
fix/ida-live-query-hang

Conversation

@danielplohmann

Copy link
Copy Markdown
Collaborator

With Live Function Queries on, moving to another function (e.g. double clicking one in a list) could freeze IDA 2.1.0 for good.

Cause. A py-spy dump of the hung IDA 9.4 shows the main thread stuck in ida_kernwin.register_timer:

MainThread  register_timer (ida_kernwin.py:330)  interval=20
            run_request (IdaBackend.py:286)
            updateViewWithCurrentFunction / hook_refresh
            refresh_widget (ida_mcrit.py:116)
            _on_cursor_settled (ida_mcrit.py:101)   <- an IDA timer callback

All four mcrit-request-* workers were idle and waiting for work, so no Python lock was involved. The cursor-settle timer's callback started the live query, and run_request registered IDA's result-delivery timer from inside it. That call never returns. It only happened when no delivery timer was running yet, which is why fetching data from a button never hung. Both timers came with #41.

Fix. IdaBackend no longer uses an IDA timer to deliver results. Each worker wakes the main thread through a queued Qt signal (_main_thread_waker, created on the main thread), and _deliver drains the result queue in that slot. The nested-dialog guard and close() work as before. The cursor-settle timer itself is unchanged; its callback now starts a request without registering anything.

Tests

  • The backend fixture's register_timer now raises, so no test can pass by registering an IDA timer. A new regression test starts a request inside a timer callback.
  • A PySide6 test checks that a wake from a worker thread runs the callback on the main thread.
  • The GUI integration's _navigate_to now lets IDA's view hook and settle timer start the refresh after jumpto, instead of calling refresh_widget directly. This is the path that hung, and it was never exercised before.
  • Local: ruff, 336 pytest, metadata and settings sync all pass.

CHANGELOG.md has a Fixed entry, and AGENTS.md now describes the new delivery mechanism.

🤖 Generated with Claude Code

danielplohmann and others added 2 commits October 15, 2026 22:20
With Live Function Queries on, moving to another function froze IDA
for good. A stack dump of the hung IDA 9.4 showed the main thread
inside ida_kernwin.register_timer, called by run_request from the
live query that the cursor-settle timer's callback had started, with
all request workers idle. Registering an IDA timer inside another
timer's callback does not return. It only happened when no delivery
timer was running yet, which is why fetching data from a button never
hung.

Workers now wake the main thread through a queued Qt signal on an
object created there, and the backend drains the result queue in that
slot. No request registers an IDA timer any more; the nested-dialog
guard and close() keep their behaviour.

Tests: the backend fixture's register_timer raises, a regression test
starts a request inside a timer callback, and a PySide6 test checks
that a wake from a worker runs the callback on the main thread. The
GUI integration now lets IDA's view hook and settle timer start the
refresh after jumpto instead of calling refresh_widget directly, which
is the path that hung.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
CI runs IDA without a disassembly view, so the view-hook path never
ran there. Starting the refresh inside a real IDA timer callback
covers the pattern that hung: run_request called from a timer.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@danielplohmann

Copy link
Copy Markdown
Collaborator Author

Checked by hand in IDA 9.4 on Linux: with IdaBackend.py from 31ddbc4 installed over 2.1.0 and Live Function Queries on, double clicking through functions no longer freezes IDA, and the match tables fill in as before. Before the fix, the same steps hung IDA with the main thread in register_timer, as in the stack dump above.

@danielplohmann
danielplohmann merged commit 185b3de into main Oct 15, 2026
13 checks passed
@danielplohmann
danielplohmann deleted the fix/ida-live-query-hang branch October 15, 2026 20:31
r0ny123 pushed a commit to r0ny123/mcrit-plugin that referenced this pull request Oct 15, 2026
Fixes IDA freezing for good on live function queries, introduced in
2.1.0 (familiary#54).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant