Repository navigation
Description
Summary
On launch (no recording started), Cap captures display/window thumbnails with SCScreenshotManager. One of those screenshot requests never completed. While it was pending, macOS kept a screen-capture session open for Cap, so the purple screen-recording indicator stayed on and the lock screen showed "Your screen is being observed".
After Cap quit, replayd ran its per-client cleanup (stopAllStreamsWithError), but the stuck screenshot stream was not released. The indicator kept attributing screen capture to so.cap.desktop until I force-restarted replayd.
The hang itself looks like a ScreenCaptureKit/macOS issue, and so does the missing cleanup on exit. On Cap's side, the Tauri app awaits each thumbnail with no timeout. Once a request hangs, nothing on Cap's side can end it.
Environment
- Cap desktop 0.6.0 (Tauri app,
/Applications/Cap.app, bundle idso.cap.desktop) - macOS 27.0 (build 26A428)
- MacBookPro18,3 (Apple Silicon), single built-in display
Steps to reproduce
- Make sure Cap is not running and no screen-recording indicator is shown.
- In Terminal, start watching the indicator and capture sessions:
log stream --style compact --predicate '(process == "ControlCenter" AND category == "sensor-indicators") OR (process == "replayd" AND eventMessage CONTAINS "SLContentStream")' - Launch Cap. Do not start a recording.
- Count
SLContentStream start:againstSLContentStream stop:lines, and watch whetherActive activity attributionsstays at["scr:so.cap.desktop"]. - Quit Cap and check whether the indicator clears.
This reproduced on my first attempt. I have not measured how often it happens.
What I observed
Clean launch at 08:06:18, no recording:
08:06:18.441 SLContentStream start -> 08:06:18.459 stop (ok)
08:06:18.566 SLContentStream start -> 08:06:18.567 stop (ok)
08:06:18.679 SLContentStream start -> 08:06:18.681 stop (ok)
08:06:18.743 SLContentStream start -> never stopped <-- hung
08:06:46.545 SLContentStream start -> 08:06:46.550 stop (ok)
08:07:10.690 SLContentStream start -> 08:07:10.702 stop (ok)
Every start came from +[SCScreenShotSession captureSLContentStreamScreenshot:withCompletionHandler:], so these are screenshot sessions, not recording streams. From 08:06:18.743 on, ControlCenter reported:
Active activity attributions changed to ["scr:so.cap.desktop"]
Quit at 08:07:39:
08:07:39.443 replayd invalidated because the client process (pid 23425) either cancelled the connection or exited
08:07:39.444 replayd -[RPClient stopAllStreamsWithError:stopReason:] stopReason=0
08:08:06.150 ControlCenter Sorted active attributions from SystemStatus update: [[scr] Cap (so.cap.desktop)] <-- Cap is gone, indicator still on
The indicator only cleared after replayd was killed. launchd then restarted it.
Earlier, in normal use (before I knew the cause)
- ControlCenter attributed 2–3 concurrent
scrsessions to Cap for about 17 hours. Cap's own log (~/Library/Logs/so.cap.desktop) shows only two short studio recordings (5–6 s each) in that period, and both pipelines shut down cleanly. - The long-lived sessions started shortly after a sleep/wake. Cap logged
System woke from sleep; scheduling recovery refreshat that point. - Cap exited normally (
Exit cleanup completed elapsed_ms=11). Onescrattribution then stayed for more than 3 hours untilreplaydwas restarted.
My guess is that each thumbnail refresh (for example after wake) can leak one more hung session. I could not confirm this because the detailed logs from that period had already rotated.
Relevant code (tag cap-v0.6.0)
- Thumbnails are captured one by one and each one is awaited with no timeout:
apps/desktop/src-tauri/src/thumbnails/mod.rs#L89-L136 - The capture call is
sc::ScreenshotManager::capture_sample_buf(...).await, at a flat 320x180:
apps/desktop/src-tauri/src/thumbnails/mac.rs#L22-L42 list_*_with_thumbnailsrun this throughblock_in_place+block_on, so a hung request also blocks the command:
apps/desktop/src-tauri/src/recording.rs#L1122-L1157- The GPUI app already records that
capture_sample_bufcan hang for some sizes without an error ("never resolves -- no error, the future hangs"):
apps/desktop-gpui/src/target_thumbnails.rs#L423-L424
In my case the request used the flat 320x180 size that comment treats as safe, and it still hung.
What I don't know
- Which display or window the hung request was for.
replaydlogs the filter as<private>. - Whether this reproduces on macOS 26.x, or only on 27.0.
Possible mitigations
- Put a per-thumbnail timeout around
capture_sample_buf(for example 2 s) and skip that target on timeout. This keeps the picker from blocking. It probably does not clear the indicator, becauseSCScreenshotManagerhas no cancel API and dropping the future leaves the system session open. - For thumbnails, use a short-lived
SCStream(the existingscap_screencapturekit::Capturer): take the first frame, then callstopCaptureexplicitly, including on timeout. Cap then owns the session's lifetime. I have not verified thatstopCapturereleases a stream that never delivered a frame. - The missing cleanup on exit (the screenshot session survives the client's
stopAllStreams) looks like a macOS bug. It is probably worth a Feedback Assistant report to Apple as well.
Workaround for affected users: quit Cap, then reboot, or run killall -9 replayd (launchd restarts it).
Activity
linear commentedon Sep 23, 2026
CAP-821
fix(desktop-gpui): stop waiting forever on a hung thumbnail capture
richiemcilroy commentedon Nov 4, 2026
Thanks for the thorough investigation! The native app in 0.6.2 now times out a hung thumbnail capture instead of waiting on it forever. Could you check whether the indicator still gets stuck on the latest version?
akira63 commentedon Nov 17, 2026
Testing on the latest release: yes, it still gets stuck on 0.6.3, and the 5 s timeout from 0.6.2 does not clear it (which matches your own prediction in the report that mitigation #1 wouldn't release the session).
Re-test on 0.6.3 (latest)
0.6.3,so.cap.desktop) — latest releaseThe timeout is definitely active — Cap's own log shows it firing:
So the future now returns control after 5 s instead of blocking the picker forever, but the underlying capture session is still left registered —
isScreenSharedstays1and the indicator stays attributed to Cap.Timeline of the stuck state
From
00:58:53onwardisScreenSharednever returned to0— it was still1more than 8 hours later, across multiple sleep/wake cycles and a screen lock:Additional user-visible symptom: Apple Watch auto-unlock is disabled
This is the part that made it noticeable. While the flag is stuck, macOS refuses Apple Watch unlock and tells the user the screen is being observed. From
loginwindowat the moment of a failed unlock:("Cannot use Apple Watch to unlock while the screen is being shared.")
The Watch itself was fine — same second,
rapportd/coreauthddiscovered the paired device withAutoUnlockEnabled:So the only thing blocking unlock is the leaked capture session. Users get locked into typing their password with no way to clear it, and the lock screen shows a "your screen is being observed" warning that is, at that point, untrue.
Verified there is no real capture at that time
While the flag was stuck, nothing was capturing:
Only a reboot / logout clears the flag. I did not try
killall -9 replaydbecause it tears down every in-flight capture session on the machine, but I expect it would work as you described.Two notes that may narrow the fix
SCScreenshotManagerone. The leaked object here is a realSCStream(-[SCStream initWithFilter:configuration:delegate:]+-[SCStreamManager registerStream:]), created from the app's capture path — the first stream got a clean-[SCStream dealloc], the second never did. Timeout aroundcapture_sample_buf/SCScreenshotManagerwon't cover it.stopCaptureon the quit path would not help in this case; if a stream can be orphaned while the process is alive, the fix likely needs to cover "stream created, never delivered a frame, never stopped" rather than only the quit path.Happy to attach a sysdiagnose or run the
log streampredicate from your report on this machine if that helps.