harden(emulator-stream): bounded input + stall watchdog - #22
Merged
Conversation
From an adversarial review of the M1/M2/M3 core: - Input now uses a bounded channel with try_send (drop latest-wins) instead of an unbounded channel, so gestures during the connect window can't grow memory unboundedly (review finding #2). - The frame loop has a 10s stall watchdog: if the gRPC stream connects but stops emitting (half-open socket), the producer stops instead of hanging the thread + runtime forever (finding #3). - Documented the view_to_device <-> floem letterbox contract (finding #8). Deferred (need API/signal-type or floem changes; coordinate after PR #21): the producer stop-handle/leak fix (#1), pre-decode-once (#4), and floem-side texture eviction / per-frame buffer reuse (#5-#7).
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.
Non-breaking robustness fixes from an adversarial review of the M1/M2/M3 emulator core. Scoped to
emulator_stream.rs— no overlap with PR #21 (different file, no signature changes, noCargo.*).Fixes
unbounded_channel):try_senddrops latest-wins. Prevents unbounded memory growth from gestures sent during the up-to-30s connect window (review finding Feature/integrate react native support #2).timeoutaround the frame recv. If the gRPC stream connects but stops emitting (half-open socket), the producer stops instead of hanging the thread + tokio runtime forever (build(deps): bump the all-dependencies group across 1 directory with 3 updates #3).view_to_device↔ floem letterbox contract (build(deps): bump tree-sitter from 0.22.6 to 0.26.8 in the tree-sitter group across 1 directory #8).Deferred (intentionally not here — would break #21's API use or need floem)
The review also caught false positives (the "256-byte row alignment" blocker —
write_textureaccepts any width; use-after-free claims — wgpu's BindGroup holds the texture Arc), excluded from the fix list.Sole author: dev-josias.