Skip to content

Replace a hung WebView renderer instead of waiting on it - #47

Merged
514sid merged 1 commit into
mainfrom
hung-webview-renderer
Nov 23, 2026
Merged

514sid merged 1 commit into
mainfrom
hung-webview-renderer

Conversation

@514sid

@514sid 514sid commented Nov 23, 2026

Copy link
Copy Markdown
Owner

A 16-hour soak run on the TV had the WebView renderer stop painting at 04:12. From then on every web_timer load missed its paint and was swapped in after the 5-second timeout, while the renderer grew to 113 MB of RAM plus 418 MB of swap. Free memory and swap ran out, the TV's own services were killed and restarted 230 times, and 83 video cuts held for over a second. lmkd killed the renderer at 06:48 and everything recovered. Short loops on the TV didn't reproduce the hang, so the cause inside Chromium is unknown.

The library now checks the renderer when a page misses the paint timeout. It runs a one-line script in the page: a slow page still answers, a hung renderer doesn't. With no answer within 3 seconds, it terminates the renderer (Android 10 and later), replaces both WebViews since they share it, and reports PlaybackError for the page instead of showing it unpainted. The refresh loop does the same. Paint timeout plus check is 8 seconds, inside the controller's default 10-second readyTimeoutMs, so a hung page isn't reported as started first.

Also in this change:

  • broken_hung_web, a sample page whose script never returns, to hang the renderer on demand. On the TV the renderer was replaced each time and the next page painted at once on the new one.
  • WebStateMachineTest, the first tests for the web player: a slow page still swaps in, a hung renderer is replaced and reported, and the next page plays on the replacements.
  • The soak script records the WebView renderer's RAM plus swap, and the report shows its trend. PSS alone missed the growth, since most of it was in swap.
  • README failure handling describes the check.

A soak run on a TV had the WebView renderer stop painting at 04:12. Every
web page after that timed out and was swapped in unpainted, while the
renderer grew past 500 MB and pushed the TV into swap until lmkd killed it.

When a page misses the paint timeout, run a trivial script in it. A slow
page answers; a hung renderer doesn't, so kill it, give both web slots a
fresh one and report a PlaybackError for the page.

Adds a broken_hung_web sample page that hangs the renderer, the first web
state machine tests, and the renderer's RAM plus swap to the soak script.
@514sid
514sid merged commit 5406d53 into main Nov 23, 2026
1 check passed
@514sid
514sid deleted the hung-webview-renderer branch November 23, 2026 11:21
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