Repository navigation
fix(recording): keep cursor sampling running through output storage stalls - #2579
Merged
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…ill missing at stop
Member
Author
|
hey @greptileai, please re-review the PR |
This branch was successfully deployed
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.
When the recording volume stops accepting writes for a while (slow SD card, external or network drive), Studio recordings lost all cursor movement, clicks and key presses for the length of the stall. The cursor recorder samples input and writes
cursor.json, the keyboard file and new cursor images on the same thread, so one blocked write pauses sampling.flowchart LR subgraph Before S1["cursor thread: sample every 16 ms"] -- "every 5 s: serialize + write" --> V1[("output volume")] S1 -- "new cursor shape: PNG save" --> V1 end subgraph After S2["cursor thread: sample every 16 ms"] -- "snapshot (at most one waiting)" --> W2["cursor-writer thread"] S2 -- "cursor image" --> W2 W2 --> V2[("output volume")] endRoot cause
flush_cursor_data/flush_keyboard_datarun inline in the sampling loop every 5 s (crates/recording/src/cursor.rs), andrgba_image.saveruns inline when a new cursor shape appears.Change
CursorFileWriterthread (cursor-writer) owns all cursor file writes: periodic snapshots, the final snapshot and cursor PNGs, in FIFO order, so a PNG is on disk before any snapshot that follows it.Results
Synthetic setup: a
DYLD_INSERT_LIBRARIESinterposer blockswrite,pwrite,pwritev,aio_write,fsync, write-modeopenandrenamefor 20 s under the recording directory. The workload is the macOS Studio-with-camera configuration: 3024x1964 and 1280x720 NV12 at 30 fps through the AVFoundation screen and camera muxers, mic and system audio through the Ogg muxer, and the real cursor recorder with incremental outputs. Runs are interleaved pairs against main. "Longest sampling pause" is the largest gap between two iterations of the cursor sampling loop (normally 16 ms plus the work in one iteration).Screen, camera and audio results are the same in both columns in every class; this change only moves cursor file writes. One CPU-load run on this PR had a 5.4 s pause in which every thread in the process (including the tokio timer heartbeat) stopped at once; it is excluded above as a machine-wide stall, not a cursor writer effect.

Confidence Score: 5/5
The PR appears safe to merge; both earlier findings are addressed.Summary
Moves cursor file writes off the sampling thread so storage stalls do not stop input capture.
Reviews (2) · Last reviewed commit: "fix(recording): retry cursor images that..." · Reviewed by Greptile