Skip to content

Mobile: keep the layout worker alive when a layout pass panics - #142

Open
katulevskiy wants to merge 3 commits into
mirror/upstream-mainfrom
mirror/upstream-pr/623
Open

katulevskiy wants to merge 3 commits into
mirror/upstream-mainfrom
mirror/upstream-pr/623

Conversation

@katulevskiy

Copy link
Copy Markdown
Owner

Upstream mirror

Source: zeronsh#623
Original author: @katulevskiy
Original revision: 737f7f480c1eebfcb13fc5fc93204959810687b2

This PR is an isolated Contribution Manager pilot mirror. Its reviews, checks and merge state are separate from upstream. An empty [skip ci] commit suppresses automatic bulk CI; the code tree matches the imported upstream revision.


Summary

  • The layout thread is the only publisher of transcript frames. When a pass panicked, the thread died, the transcript froze for the rest of the view's life, and every later call sent into a dead channel.
  • Each pass now runs under catch_unwind. On a panic the last good frame stays published, the row/height/width caches are reset (open and folded state is kept), and the next input gets a clean pass. This also covers a panicking platform listener callback.
  • UI-facing locks go through one lock helper that recovers from poison. Those mutexes are only held for an Arc clone or swap, so poisoning is unlikely; this is cheap defence in depth.
  • If the layout thread can't be spawned we degrade to an empty view instead of expecting, since the constructor can't return an error across FFI.
  • No exported interface changes, so the UniFFI bindings don't need regenerating. Neither the mobile nor the mobile-dist profile sets panic = "abort", so unwinding works in device builds.

katulevskiy and others added 2 commits September 28, 2026 21:07
The layout thread is the only publisher of frames. A panic in one pass
killed it, so the transcript froze for the life of the view, and every
later call silently sent into a dead channel.

Run each pass under catch_unwind: on a panic the last good frame stays
published, the row/height/width caches (possibly half-updated) are reset
while keeping the user's open/folded state, and the next input gets a
clean pass. This also covers a panicking platform listener callback.

Also stop the UI-facing paths from panicking: recover poisoned mutexes
through one `lock` helper (the guarded data is always replaced or read
whole), and degrade instead of `expect` when the layout thread cannot be
spawned, since the constructor cannot report an error across FFI.

No exported interface changes; UniFFI bindings are unaffected.
@contribution-manager-katulevskiy contribution-manager-katulevskiy Bot added the review:needs-triage Managed by Contribution Manager label Oct 6, 2026
@contribution-manager-katulevskiy

contribution-manager-katulevskiy Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Contribution Manager

needs triage · medium risk · untriaged

Open review workspace · Revision 4aed933e

Next actions:

  • Direction decision needed
  • Scope, risk, and platform triage needed
  • Independent code review needed
  • Required check: core-tests (missing)

This summary is maintained by the review app. Decisions and test evidence are recorded in the workspace; the app does not merge PRs.

@contribution-manager-katulevskiy contribution-manager-katulevskiy Bot added cm:inbox Contribution Manager: waiting for triage and removed review:needs-triage Managed by Contribution Manager labels Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cm:inbox Contribution Manager: waiting for triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant