Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

macOS: target thumbnail screenshot can hang, leaving the screen-recording indicator (and "Your screen is being observed") stuck — even after Cap quits

未关闭
#2,339 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
macos, rust, tauri
领域
cli, desktop

调研方向

The issue is in the thumbnail capture code in apps/desktop/src-tauri/src/thumbnails/mod.rs and mac.rs. The capture_sample_buf call hangs, blocking the command. Start by examining the async flow and the block_in_place usage in recording.rs. Look for how to add a timeout or switch to using SCStream with explicit stopCapture. Test by running the app and monitoring replayd logs to see if a hung session is created and if the fix releases it. 'Done' means the screen-recording indicator clears after the app quits, even after a simulated hang.

由索引模型根据 Issue 内容生成。

描述

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 id so.cap.desktop)
  • macOS 27.0 (build 26A428)
  • MacBookPro18,3 (Apple Silicon), single built-in display

Steps to reproduce

  1. Make sure Cap is not running and no screen-recording indicator is shown.
  2. 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")'
    
  3. Launch Cap. Do not start a recording.
  4. Count SLContentStream start: against SLContentStream stop: lines, and watch whether Active activity attributions stays at ["scr:so.cap.desktop"].
  5. 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 scr sessions 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 refresh at that point.
  • Cap exited normally (Exit cleanup completed elapsed_ms=11). One scr attribution then stayed for more than 3 hours until replayd was 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)

What I don't know

  • Which display or window the hung request was for. replayd logs the filter as <private>.
  • Whether this reproduces on macOS 26.x, or only on 27.0.

Possible mitigations

  1. 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, because SCScreenshotManager has no cancel API and dropping the future leaves the system session open.
  2. For thumbnails, use a short-lived SCStream (the existing scap_screencapturekit::Capturer): take the first frame, then call stopCapture explicitly, including on timeout. Cap then owns the session's lifetime. I have not verified that stopCapture releases a stream that never delivered a frame.
  3. 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).

主要语言
Rust
星标
22.5k
派生
1.9k
平均合并
7 小时 43 分钟
30 天内合并 PR
80

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

CapSoftware/Cap 的其他 Issue

查看 CapSoftware/Cap 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。