Skip to content

[Bug]: Input stops reaching the renderer after an app switch until reload; no unresponsive event #56084

Backlog

Description

@benjaminfrombe

Preflight Checklist

Electron Version

45.5.0

What operating system(s) are you using?

macOS

Operating System Version

macOS Tahoe 26.x

What arch are you using?

arm64 (including Apple Silicon)

Last Known Working Electron version

Unknown; first observed on this build.

Does the issue also appear in Chromium / Google Chrome?

I don't know how to test

Expected Behavior

After switching away from an Electron app and back (Cmd+Tab), the window keeps accepting mouse and keyboard input.

Actual Behavior

Intermittently, after an app switch, the window is visible and focused but the page never receives any input again. Mouse and keyboard are dead for the renderer until the page is reloaded; Cmd+R (Page.reload) fully recovers it. The renderer stays healthy throughout: JS keeps running, rAF and timers fire, Runtime.evaluate answers in 2-20 ms, and the compositor keeps producing frames. No unresponsive or responsive event is emitted during the wedge. Observed 3 times in 3 days in a packaged production app (Electron 45.5.0, macOS arm64), each time starting at the app-switch transition. App switches happen dozens of times per day and mostly do not wedge, so the trigger is intermittent.

Testcase Gist URL

Not available. We tried to reproduce it standalone against stock Electron 45.5.0 with synthetic CGEvent input (Cmd modifier events, session-wide and pid-targeted) racing app deactivation/reactivation at offsets 0-300 ms, including app.hide() variants: about 275 iterations, zero wedges. The trigger is therefore not yet reproducible outside the production app; the evidence below comes from traces captured inside it.

Additional Information

App-level mitigation (canary input event plus reload watchdog) is proposed in getpaseo/paseo#11198; it has unit tests but has not yet been validated against a live wedge. A PR proposing detection of this state in Electron is #56085; it is validated by code analysis and patch-apply checks only, not by a local build or test run (no Chromium build environment was available; upstream CI has not run yet at the time of this writing).

In-depth investigation

Trace evidence. We captured Chrome about:tracing traces (input category, browser process) at wedge time in the real app, plus a focus/visibility/input watcher log. Three captures: 2026-11-25T19:13:42Z (healthy reference: ForwardMouseEvent/ForwardKeyboardEvent -> InputEventSentBlocking -> renderer-side caret work ~60 ms later), 2026-11-26T17:28:26Z (wedge; renderer pid 33014, browser pid 32642; 9.4 s trace window), 2026-11-27T14:36:11Z (wedge; renderer pid 19085, browser pid 18703; 9.1 s window). In both wedge traces, three probe events injected via CDP at +0.9/+3.4/+5.9 s (MouseMove, RawKeyDown, KeyUp) all show the same signature on the browser side, RenderWidgetHostImpl::ForwardMouseEvent / ForwardKeyboardEvent -> InputRouterImpl::FilterAndSendWebInputEvent -> InputEventSentBlocking, with zero renderer-side input events of any kind (no HitTest, no EventDispatch, no caret activity) and zero InputEventAck events in the window. The renderer main thread pumps tasks normally the whole time (TimerFire, IntersectionObserver, rAF continue to the end of the trace; thread samples show all threads idle, no blocked stacks). InputEventSentBlocking is traced immediately before the mojo WidgetInputHandler DispatchEvent call, so the browser side believes the events were sent while the renderer never processes them. The trace windows (~9 s) are shorter than the 15 s hang-monitor delay, so they cannot show hang-monitor activity either way; the watcher log shows the wedge persisting for minutes with no recovery and no unresponsive event.

Transition timeline (watcher log, local time). 26 Nov: 18:26:43.981 focus=false, 18:26:43.982 synthesized Meta keydown delivered to the page 1 ms after deactivation, 18:26:54.150 focus=true, 18:27:22 first failed input probe, wedge declared 18:28:26. 27 Nov: 15:35:24.508 focus=false, 15:35:24.509 synthesized Meta keydown delivered 1 ms after deactivation, 15:35:54.943 focus=true, 15:35:57.945 first failed probe (3 s after refocus), wedge declared 15:36:11. In both cases the last input the page ever received was that Meta keydown at the deactivation transition. App switches on this machine are driven by Karabiner-Elements (synthesized Cmd+Tab via a virtual HID device). At one non-wedging switch (27 Nov 17:45:42.811) the log shows focus=false and visibility=hidden in the same millisecond, then 2 ms later TWO Meta keydowns 2 ms apart, one carrying an event timestamp five seconds stale: a queued event flushed to the renderer during the hide transition. The same stale-flush signature appears on 25 Nov. So the browser input pipeline can queue synthesized events across seconds and flush them exactly at the hide transition; the wedge onsets in the window opened by that transition. The Meta-at-transition event accompanies every switch (also non-wedging ones), so it is a constant companion, not a proven sufficient trigger.

Code analysis (Chromium 156.0.8078.109, and current main; components/input/render_input_router.cc). The input ack hang monitor escalates to RendererUnresponsive only when its PingMainThread probe times out. OnPingAck (the main thread answered) just calls RestartInputEventAckTimeoutIfNecessary and the cycle repeats. In this wedge the renderer main thread is fully alive, so the ping always succeeds and the monitor loops monitoring -> pinging -> ping ack -> restart forever while dispatched input events are never received or acked. It conflates "renderer main thread responsive" with "input events being acked", so for a wedged input path with a healthy renderer it never emits anything and the blocking events stay in flight until a reload. Where exactly the events are lost we cannot prove from the captures: the browser posts the mojo DispatchEvent and the renderer shows no sign of receiving the events while pumping tasks normally, so the loss is most likely in the renderer-side input handling (a queue or gate stuck across the hide/show transition) or in the mojo dispatch state for the widget; the traces lack the ipc/mojom and renderer-side input categories that would distinguish these. We can capture those categories on the next occurrence if useful.

Relation to #53529. That PR made the unresponsive event reliably reach Electron JS and fixed hide/sleep emitting false responsive signals (merged to main, backported to 44-x-y/45-x-y). This report is the remaining gap on the other side of it: escalation requires a hung main thread, which a wedged input path with a live main thread never produces.

Not getpaseo/paseo#741. That freeze was a stale-display GPU issue fixed by a renderer-side change in getpaseo/paseo#745. Our compositor keeps producing frames and the renderer main thread is healthy; the failure is in input delivery, not rendering.

Proposed direction (PR #56085). Bound the ping-ack loop in RenderInputRouter::OnPingAck: if several consecutive monitoring cycles complete with the main thread answering pings while the in-flight event count never decreases, report the stall through the existing delegate_->OnInputEventAckTimeout() path (apps get the unresponsive event and can recover, e.g. by reloading) and reset the lost in-flight accounting so later events can restart the monitoring cycle. The natural long-term home is upstream Chromium; the patch is structured so it can be proposed there and dropped from Electron once it rolls in.

Raw evidence (trace.json captures, watcher logs, thread samples, state snapshots) available on request.

Activity

  1. github-actions commented on Nov 28, 2026

    @github-actions
    Contributor

    Hello @benjaminfrombe. Thanks for taking the time to open an issue and helping to make Electron better!

    This issue was automatically closed because its body does not follow any of this repository's issue templates. Maintainers rely on the sections in those templates to triage issues, and issues that are missing them usually cannot be acted upon.

    To get this issue triaged, please either:

  2. benjaminfrombe commented on Nov 28, 2026

    @benjaminfrombe
    Author

    Upstream PR with the proposed detection: #56085. It bounds the ping-ack loop in RenderInputRouter::OnPingAck() as described in the analysis: three consecutive monitoring cycles with the main thread answering pings while no input event is acked reports the stall through the existing OnInputEventAckTimeout path and resets the lost in-flight accounting. App-level mitigation for our case is in getpaseo/paseo#11198.

  3. changed the title [-][Bug]: Input events forwarded by the browser never reach the renderer after an app switch; the input ack hang monitor loops forever because the renderer main thread stays responsive[/-] [+][Bug]: Input stops reaching the renderer after an app switch until reload; no unresponsive event[/+] on Nov 28, 2026
  4. benjaminfrombe commented on Nov 29, 2026

    @benjaminfrombe
    Author

    Live validation update: we built Electron 45-x-y with this fix locally (full build, 46,467 targets, 0 errors) and ran the relevant unit tests: InputRouterImpl*/RenderInputRouter* filters 52/52 passed, AckTimeout/Unresponsive/InputEventAck filters 12/12 passed. We then shipped the patched framework in a packaged desktop app on macOS and validated it against the real-world trigger from the report: heavy synthetic-input app switching via a keyboard remapper (Karabiner-Elements virtual HID) that previously wedged this app multiple times per day (3 fully captured wedges in 2 days, traces linked above). With the patch compiled in, the app-level mitigation disabled, and the same usage pattern, zero wedges occurred over 11+ hours of continuous use. The input-router stall signature from the captures has not recurred.

  5. benjaminfrombe commented on Nov 30, 2026

    @benjaminfrombe
    Author

    IMPORTANT CORRECTION after extended live testing: this patch fixes a real but DIFFERENT stall mode than the one reported here, and the reported wedge persists on the patched build.

    What we learned:

    • The patch detects a renderer-side stall: the renderer RECEIVED input events but never acks them while the main thread keeps answering pings (in_flight_event_count_ > 0 across ping-ack cycles). That detection works as designed.
    • The wedge in this report is BROWSER-side: after an app switch with synthetic keyboard input, the browser forwards the event (ForwardMouseEvent/ForwardKeyboardEvent, InputEventSentBlocking posted) but the event NEVER ARRIVES in the renderer, so RenderInputRouter never sees it, in_flight_event_count_ stays 0, and the new ping-ack counter correctly resets - no stall is reported, and input stays dead. Two full wedges captured on the patched build (CDP traces, same signature as the original report: all threads idle, compositor ticking, renderer JS responsive via CDP while zero DOM input events arrive).
    • The renderer main thread being healthy while input is dead means the loss happens in the browser-side mojo forwarding (WidgetInputHandler channel) or in the browser input router state, upstream of RenderInputRouter.

    Consequences:

    • The app-level CDP-canary watchdog (fix(desktop): reload renderer when the input pipe wedges after app switches getpaseo/paseo#11198) remains the only working detection + recovery for THIS wedge mode (executeJavaScript works while input is dead).
    • A complete fix for this report likely needs browser-side detection: e.g. detect InputEventSentBlocking without a corresponding renderer-side receipt/ack while the renderer main thread is responsive, and reset the WidgetInputHandler mojo binding (RenderWidgetHostImpl::ResetWidgetInputInterfaces exists) or surface the stall to the embedder.

    Full CDP captures of both post-patch wedges are available (same format as the originals). Happy to provide any additional instrumentation from the browser side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions