[BUG] Desktop (macOS): main process stalls ~2.9 s while typing with Apple Zhuyin IME — IMK XPC deadlock in utSetupInputMethodMenu (menuWithCompletionHandler ↔ IME selectedRange)

Status Open
Reported on v2.1.293
Maintainer reply None cached
Activity 0 comments · opened Oct 11, 2026

Environment

  • macOS 15.6.1 (24G90), MacBook Pro 16" M3 Pro, 18 GB
  • Claude Desktop 2.31226.1 (Electron 44.4.3), Claude Code 2.1.293, Code tab
  • Input method: Apple Traditional Chinese — Zhuyin (com.apple.inputmethod.TCIM.Zhuyin)
  • Keyboard: both built-in and external (irrelevant, see below)

Symptom

While typing Chinese (Zhuyin) in the Code tab prompt, the whole app freezes for ~2.9 s every few minutes (sometimes a beach ball). The app's own ~/Library/Logs/Claude/main.log records each freeze:

[warn] [event-loop-stall] main process blocked for 2890ms (task ccd:message:system=0ms, total 13, cumulative 33587ms, rss 387MB)
[warn] [event-loop-stall] main process blocked for 2934ms (task none, total 10, cumulative 24906ms, rss 384MB)

33 such stalls between 2026-10-09 15:31 and 2026-10-10 17:33; the ~2.9 s ones all coincide (to the second) with the IME-side timeout below.

What the main thread is doing during the stall

sample of the Claude main process (pid 12816) at 17:33:19 for 20 s, 1 ms interval, covering the 17:33:33 stall. CrBrowserMain spends ~1.9 s of the window here:

__CFRunLoopDoBlocks
__utSetupInputMethodMenuFromDeferredBlock_block_invoke            (HIToolbox)
__utSetupInputMethodMenuFromDeferredBlock_block_invoke.cold.1     (HIToolbox)
utTryToSetupInputMethodMenu                                       (HIToolbox)
GetInputMethodInstanceMenu_IntoMenu_WithCompletionHandler         (HIToolbox)
IMKInputSessionGetMenuIntoMenuWithCompletionHandler               (HIToolbox)
-[IMKClient_Modern menuWithCompletionHandler:]                    (HIToolbox)
-[IMKInputSessionXPCInvocation_Modern invocationAwaitXPCReply]    (HIToolbox)
+[IMKInputSession_Modern withActivity:performActions:]
-[HIRunLoopSemaphore wait:]                                       (HIServices)
__CONSIDER_WHO_REQUESTED_THIS_WAIT_BEFORE_SENDING_BUG_TO_HISERVICES__
-[HIRunLoopSemaphore invokeLoopInModeForDuration:withBlock:]
CFRunLoopRunSpecific → __CFRunLoopServiceMachPort → mach_msg2_trap   (blocked)

i.e. HIToolbox synchronously waits for the input method to return its menu.

What the IME is doing at the same moment (unified log, TCIM_Extension)

17:33:30.675 TCIM_Extension (InputMethodKit) Menu
17:33:30.675 TCIM_Extension (InputMethodKit) Get selected range     ← IME calls back into the client
17:33:33.676 TCIM_Extension IMKServerXPCInvocation (<private>) timed out waiting for response from <private>

So: the app waits for the IME's menu; the IME, while building that menu, synchronously asks the client for its selected range; the client cannot service that inbound IMK request while it is parked in HIRunLoopSemaphore wait: under Chromium's message pump; both sides give up after the 3 s IMK timeout. That is the constant ~2.9 s.

Correlation

  • 25 of the 33 event-loop-stall entries have a TCIM_Extension … timed out waiting for response entry within ±2 s (every one of the ~2.9 s stalls). The remaining 8 are short (0.6–1.6 s) or sleep/wake related.
  • While typing in the Code tab, the app triggers the input-method menu rebuild roughly 35–40 times per minute (a third-party IME logged 92 Menu requests in 2.5 min). CursorUIViewService shows the text input context being activated/deactivated every 1–3 s during typing, which is what drives those rebuilds.
  • Switching to a third-party Zhuyin IME (McBopomofo) whose menu does not call back into the client: 0 stalls, 0 timeouts in the same workload.
  • Ruled out: keyboard (built-in and Bluetooth both reproduce), Karabiner-Elements (quit), external display refresh rate, memory pressure, other background apps.

Repro

  1. macOS 15.x, enable 注音 (Apple Traditional Chinese Zhuyin).
  2. Open a Code tab session, type Chinese continuously in the prompt for a few minutes.
  3. Watch ~/Library/Logs/Claude/main.log for [event-loop-stall] main process blocked for ~2900ms and

log stream --predicate 'process == "TCIM_Extension" AND eventMessage CONTAINS "timed out"'.

Suggested direction

Either avoid re-triggering the input-method menu setup on every text-input-context change in the Code tab, or make sure inbound IMK XPC requests from the IME are serviced while HIToolbox is waiting in HIRunLoopSemaphore (run-loop mode coverage in the message pump). Native Cocoa apps on the same machine do not hit this.

Attachments

Full sample output of the main process (1.2 MB), the IME log excerpt, and the two timestamp lists used for the correlation are available on request.

View original on GitHub ↗