Repository navigation
fix(android): recover the editor when its renderer process dies - #839
Merged
Merged
Conversation
XCFramework BuildThis PR's XCFramework is available for testing. Add the following to your .package(url: "https://github.com/wordpress-mobile/GutenbergKit", branch: "pr-build/839")Built from 8ad4c4f |
22 tasks
Unhandled, a WebView renderer death (often out-of-memory) kills the host app. Android can't reuse the WebView afterward, so replace it and load the editor again, failing pending reads. A renderer that dies before the editor loads shows the crash notice instead, avoiding a reload loop. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RenderProcessGoneDetail.didCrash() is API 26, above the library's minSdk of 24, so Android Lint reported a NewApi error. Android only calls the handler from API 26. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017NCdQuj1TpMKFBGz2r4RHx
The editor reports itself loaded on first paint, before images and embeds finish rendering, so content that runs the renderer out of memory after load reloaded forever. A second death after an automatic recovery now shows the crash notice; reloading from it re-arms recovery. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017NCdQuj1TpMKFBGz2r4RHx
An app's WebViews share one renderer, so GutenbergView recovering alone doesn't keep the app alive while a host WebView leaves the death unhandled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017NCdQuj1TpMKFBGz2r4RHx
The listener's KDoc named the error boundary as the only cause and promised a reload notice, but a renderer death now notifies it too and may reload automatically. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017NCdQuj1TpMKFBGz2r4RHx
A dead renderer can't unmount the editor's dialogs to report them closed, so hosts kept navigation disabled and Back was refused on the crash notice. This mirrors iOS, which reports them closed when its web content process terminates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017NCdQuj1TpMKFBGz2r4RHx
dcalhoun
force-pushed
the
fix/android-render-process-gone
branch
from
October 30, 2026 12:10
13f02e3 to
5555d6c
Compare
The @RequiresApi annotation already states the API level. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017NCdQuj1TpMKFBGz2r4RHx
dcalhoun
marked this pull request as ready for review
October 30, 2026 12:35
Contributor
|
@dcalhoun This all looks good to me and passed the testing steps. I'll approve but leave Claude's findings for you to look at.
|
Member
Author
|
I checked both findings, and I don't feel either blocks this PR:
The second could be worth an improvement later, but there is no impacted flow today. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Recover the editor when its renderer process dies.
Close #643. Close CMM-2414. Previously, the host app would crash as GutenbergKit did not handle this specific event for the web view, which could lead to content loss.
onRenderProcessGonecallback to handle the event of the web view dying.isWebViewBlankinstance variable to inform how the editor should recover from the web view dyingTesting instructions
To crash the editor's renderer without Chrome DevTools, forward the app's WebView debug socket. Re-run this after the app restarts; renderer crashes don't require it.
Then crash the renderer with this command (Node 22+):
adb forwardcommand, then crash the renderer. Verify the app stays open and the editor reloads with your edit.trunk. The app closes.AI-generated details
Closes #643.
Problem:
GutenbergViewnever handledonRenderProcessGone, so a WebView renderer death (often out-of-memory) killed the host app. Ontrunk:Fix: Handle the callback and recover in place, matching iOS's reload on web content process termination.
getTitleAndContentreads fail withEditorNotReadyException, and the host getsonEditorUnavailable.LatestContentProvider, once.onEditorLoadedfires on first paint, before images decode, so content that runs the renderer out of memory would otherwise reload forever. Tapping Reload Editor allows one more automatic recovery.Testing: Unit tests cover each behavior. On an emulator, crash the editor's renderer with the
adb forwardandPage.crashcommands from the testing instructions:Not covered:
onRenderProcessGoneunhandled (WordPress-Android handles it nowhere). TheGutenbergViewKDoc now says so.HtmlToBitmapRenderer's off-screen WebView also lacks the handler. It has no production callers yet.🤖 Generated with Claude Code
https://claude.ai/code/session_017NCdQuj1TpMKFBGz2r4RHx