Skip to content

fix: report a wedged input pipe when the renderer is responsive - #56085

Open
benjaminfrombe wants to merge 1 commit into
electron:mainfrom
benjaminfrombe:fix/input-pipe-stall-unresponsive
Open

benjaminfrombe wants to merge 1 commit into
electron:mainfrom
benjaminfrombe:fix/input-pipe-stall-unresponsive

Conversation

@benjaminfrombe

@benjaminfrombe benjaminfrombe commented Nov 28, 2026 •

Copy link
Copy Markdown

Description of Change

Fixes #56084 (full evidence package: traces, timelines, and analysis there).

Validation status, CORRECTED after extended live testing: this patch fixes a real but DIFFERENT stall mode than the one in the linked issue. The patch detects a renderer-side stall (events received but never acked while pings are answered) and that detection works as designed. However, the wedge in the issue is browser-side: the browser forwards input but it never arrives in the renderer, in_flight_event_count_ stays 0, the ping-ack counter correctly resets, and input stays dead. Two full wedges were captured on the patched build with identical signature to the original report. A complete fix for the reported wedge needs browser-side detection (InputEventSentBlocking without renderer receipt while the renderer main thread is responsive) and possibly a WidgetInputHandler binding reset. The app-level CDP-canary watchdog (getpaseo/paseo#11198) remains the only working detection + recovery for the reported wedge mode. See the correction comment on issue #56084.

The input ack hang monitor escalates to RendererUnresponsive only when its PingMainThread probe times out. When the input path is wedged but the renderer main thread is alive, the ping always succeeds, so RenderInputRouter::OnPingAck() restarts the ack timeout and the monitor loops (monitoring -> pinging -> ping ack -> restart) forever while dispatched input events are never received or acked. No unresponsive event is emitted and all input stays dead until the WebContents is reloaded. We captured this in a packaged Electron 45 app on macOS: after an app switch, the browser forwards input (ForwardMouseEvent / ForwardKeyboardEvent, InputEventSentBlocking posted immediately before the mojo DispatchEvent) while the renderer receives nothing, its main thread healthy and pumping tasks, for minutes on end.

This adds a new Chromium patch, fix_report_input_pipe_stall_when_renderer_is_responsive.patch, that bounds the loop: if several consecutive monitoring cycles complete with the main thread answering pings while the in-flight event count never decreases, the input path is wedged rather than the renderer being hung. The patch then reports the stall through the existing delegate_->OnInputEventAckTimeout() path (so apps get the unresponsive event and can recover, e.g. by reloading) and resets the lost in-flight accounting so later events can restart the monitoring cycle. Any input ack resets the stall counter, and the decrement is guarded so a late ack for a dropped event cannot drive the count negative.

The natural long-term home for this detection is upstream Chromium (components/input/render_input_router.cc); this patch is structured so it can be proposed there and dropped from Electron once it rolls in, the same way the refactor_unfilter_unresponsive_events CL was handled.

Checklist

Notes on the unticked items, stated plainly: this is a Chromium-layer patch carried by Electron; I verified it applies cleanly to the pinned Chromium checkout sources (git apply and git am both clean against 160.0.8181.0) and reviewed it against the surrounding code, but I have not built Electron or run npm test locally, so those boxes stay open for CI and reviewers. The scenario (input events lost with a live renderer main thread) cannot be constructed from the JS API in a spec test; a unit test would live upstream in Chromium's render_input_router tests together with the detection itself.

AI usage disclosure per the governance policy: the patch, PR, and the linked issue were prepared with a coding agent under my direction; I reviewed and verified every change.

Release Notes

Notes: Emitted the unresponsive event when input stalls with a live renderer.

@benjaminfrombe
benjaminfrombe requested a review from a team as a code owner November 28, 2026 13:57
@release-clerk

release-clerk Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Suggested release note (advisory)

The Notes: line in this PR passes the style rules. Claude reviewed it for how it reads to app developers and suggests this rewrite:

Notes: Fixed the `unresponsive` event not being emitted when input stalls while the renderer is still responsive.
  • Put the unresponsive event name in backticks so developers can search for it.
  • Reworded "Emitted the ... event" as a fix, since the note described the change like a commit subject rather than what was broken for apps.

This suggestion was generated automatically, so use your best judgment. This comment will update as the PR description is edited.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ This PR contains unsigned commits. This repository enforces commit signatures
for all incoming PRs. To get your PR merged, please sign those commits
(git rebase --exec 'git commit -S --amend --no-edit -n' @{upstream}) and force push them to this branch
(git push --force-with-lease)

For more information on signing commits, see GitHub's documentation on Telling Git about your signing key.

@github-actions github-actions Bot added the needs-signed-commits Currently some or all of the commits in this PR are not signed label Nov 28, 2026
@benjaminfrombe
benjaminfrombe force-pushed the fix/input-pipe-stall-unresponsive branch from bfde196 to c0944c2 Compare November 28, 2026 13:59
@benjaminfrombe
benjaminfrombe force-pushed the fix/input-pipe-stall-unresponsive branch 3 times, most recently from 82d5d36 to befd2e9 Compare November 29, 2026 07:48
@github-actions github-actions Bot removed the needs-signed-commits Currently some or all of the commits in this PR are not signed label Nov 29, 2026
@benjaminfrombe
benjaminfrombe force-pushed the fix/input-pipe-stall-unresponsive branch from befd2e9 to c828382 Compare November 29, 2026 08:03
The input ack hang monitor escalates to RendererUnresponsive only when
its PingMainThread probe times out. When the input path is wedged but
the renderer main thread is alive, the ping always succeeds, so the
monitor loops forever while dispatched input events are never received
or acked. No unresponsive event is emitted and all input stays dead
until the WebContents is reloaded.

Bound the loop: 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 so apps get the unresponsive
event and can recover, and reset the lost in-flight accounting so later
events can restart the monitoring cycle.

Signed-off-by: benjaminfrombe <[email protected]>
@benjaminfrombe
benjaminfrombe force-pushed the fix/input-pipe-stall-unresponsive branch from c828382 to b92c5cf Compare November 29, 2026 08:21

This branch has not been deployed

No deployments
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.

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

1 participant