Skip to content

盒盖待机一段时间后系统卡顿 #970

Closed

Description

@freerpa

Summary | 摘要

Steps to Reproduce | 如何重现

1.盒盖待机(一晚上后出现这种情况,目前连续3天出现了)
2.活动管理器杀掉Mos就恢复流畅度,重启Mos就可以正常使用
3.内存和CPU都没有大规模占据情况

Expected Behavior | 期望结果

正常流畅运行

Actual Behavior | 实际结果

系统整体卡顿严重

Environment | 环境信息

  • Mos version | Mos 版本:4.2.1
  • macOS version | macOS 版本:26.5.1
  • Mac model / chip | 机型 / 芯片:M5
  • Mouse / trackpad model | 鼠标 / 触控板型号:小米鼠标3
  • Connection type | 连接方式: Bluetooth / USB receiver / USB-C / Other :Bluetooth
  • Affected application | 受影响应用: Whole system / App name :ALL
  • Accessibility permission granted | 是否已授予辅助功能权限: Yes / No :Yes
  • Other input, mouse, keyboard, or window-management tools | 其他输入、鼠标、键盘或窗口管理工具:No

Mos Settings Involved | 涉及的 Mos 设置

  • Smooth scrolling | 平滑滚动
  • Reverse scrolling | 反转滚动方向
  • Per-app settings | 按应用配置
  • Button bindings | 按钮绑定
  • Open app/script/file action | 打开 App、脚本或文件动作
  • Logi device integration | Logi 设备集成
  • Updates / Sparkle | 应用更新

Logs, Screenshots, or Recordings | 日志、截图或录屏

无

Additional Context | 额外说明

Activity

  1. stqfdyr commented on Jul 18, 2026

    @stqfdyr

    我也遇到了,让 codex 定位是 Mos 与当前 macOS 图形/输入合成冲突,导致 WindowServer 在拖动窗口时单核跑满,不是偶然现象,退出 mos 后瞬间不卡顿了!

  2. Caldis commented on Jul 18, 2026

    @Caldis
    Owner

    请看VCR : https://github.com/user-attachments/assets/1ac5b4d0-69a5-4508-9208-5f2cfb6a2479 @Caldis

    感谢反馈, 请问每次休眠唤醒都会触发吗? 另外, 如果不盒盖单纯锁定后重新进入系统也会触发吗? 以及, 如果放着不管, 卡顿是持续发生还是过一阵子会消失?

    我的设备上没有办法复现这个问题, 可能需要你提供一下相关的日志, 可以在 [控制台] app 中搜索 mos 看看是否可以导出一些相关的运行信息

  3. stqfdyr commented on Jul 18, 2026

    @stqfdyr

    @Caldis

    我目前正在尝试让 codex 写一个监控程序,等到卡顿的时候采集日志

  4. stqfdyr commented on Jul 20, 2026

    @stqfdyr

    @Caldis 卡顿再次复现,下面是现场采集并脱敏后的数据。没有采集屏幕、输入内容、文件内容、网络流量、账号信息或硬件序列号。

    结论摘要

    • 复现时间:2026-07-20 20:46–20:47(UTC+8)。持续拖动窗口时,WindowServer 连续接近单核满载;Mos 自身几乎为 0%。
    • 15 个 1 秒样本中,WindowServer 平均 77.1%、最高 100.7%,12 个样本 >=55%;Mos 平均 0.01%、最高 0.1%。平均值包含开始拖动前的 0%、8.5%、10.6% 三个样本。
    • Mos 进程从 2026-07-18 23:27 一直运行到复现,约 45 小时,没有在采集前重启。
    • 卡顿发生前,Mos 的统一日志反复出现显示器 sleep/wake 通知,并报 CVDisplayLinkCreateWithCGDisplays error -6661 due to invalid display count (0)。
    • 同一 20 分钟日志窗口内:kCGSDisplayDidWake 17 次、kCGSDisplayWillSleep 16 次、上述 -6661 错误 26 条(每次失败连续两条)。pmset 同时记录到反复的 Clamshell Sleep / USB2 wake;本次开机以来计数达到 656 次 sleep/wake。
    • system_profiler SPDisplaysDataType 在采集时只返回 Apple M4 GPU,没有返回任何 display 条目。这和 invalid display count (0) 相符,但目前只能认为是关联线索,不是已证明的根因。

    环境

    • Mos 4.2.1(build 20260531.1)
    • macOS 26.5.2(25F84)
    • MacBook Pro Mac16,1 / Apple M4 / 16 GB
    • 鼠标:Dragonfly 3 SE,USB;另有内建触控板
    • 辅助功能权限:已授权
    • AC 供电;低电量模式关闭
    • Mos:平滑滚动、横向/纵向平滑、反向滚动均开启;speed=2.7、step=33.6、duration=4.35、deadZone=1;无按 App 配置

    WindowServer / Mos CPU 原始摘录

    2026/07/20 20:46:58  WindowServer  8.5%   Mos 0.0%
    2026/07/20 20:46:59  WindowServer 10.6%   Mos 0.1%
    2026/07/20 20:47:00  WindowServer 73.2%   Mos 0.1%
    2026/07/20 20:47:01  WindowServer 99.7%   Mos 0.0%
    2026/07/20 20:47:02  WindowServer 95.4%   Mos 0.0%
    2026/07/20 20:47:03  WindowServer 100.7%  Mos 0.0%
    2026/07/20 20:47:04  WindowServer 97.6%   Mos 0.0%
    2026/07/20 20:47:05  WindowServer 94.3%   Mos 0.0%
    2026/07/20 20:47:06  WindowServer 86.0%   Mos 0.0%
    2026/07/20 20:47:07  WindowServer 100.4%  Mos 0.0%
    2026/07/20 20:47:08  WindowServer 96.3%   Mos 0.0%
    2026/07/20 20:47:09  WindowServer 95.8%   Mos 0.0%
    2026/07/20 20:47:10  WindowServer 98.2%   Mos 0.0%
    2026/07/20 20:47:11  WindowServer 99.6%   Mos 0.0%
    

    Mos Console 日志摘录

    2026-07-20 20:39:28.068  CVDisplayLinkCreateWithCGDisplays error -6661 due to invalid display count (0)
    2026-07-20 20:39:28.068  CVDisplayLinkCreateWithCGDisplays error -6661 due to CVDisplayLinkCreateWithCGDisplays failure
    2026-07-20 20:39:28.073  CGSDisplayNotifyProc: got notification kCGSDisplayDidWake
    2026-07-20 20:39:38.042  CGSDisplayNotifyProc: got notification kCGSDisplayWillSleep
    
    2026-07-20 20:40:16.599  CVDisplayLinkCreateWithCGDisplays error -6661 due to invalid display count (0)
    2026-07-20 20:40:16.599  CVDisplayLinkCreateWithCGDisplays error -6661 due to CVDisplayLinkCreateWithCGDisplays failure
    2026-07-20 20:40:16.600  CGSDisplayNotifyProc: got notification kCGSDisplayDidWake
    2026-07-20 20:40:26.549  CGSDisplayNotifyProc: got notification kCGSDisplayWillSleep
    
    2026-07-20 20:40:51.411  CVDisplayLinkCreateWithCGDisplays error -6661 due to invalid display count (0)
    2026-07-20 20:40:51.411  CVDisplayLinkCreateWithCGDisplays error -6661 due to CVDisplayLinkCreateWithCGDisplays failure
    2026-07-20 20:40:51.412  CGSDisplayNotifyProc: got notification kCGSDisplayDidWake
    

    对应的电源日志中,20:38–20:40 连续记录了 Entering Sleep state due to 'Clamshell Sleep'、USB2_wake,最后在 20:40:51 DarkWake to FullWake ... due to UserActivity,时间与上面的 Mos 日志一致。

    Mos 5 秒 sample 摘要

    Mos 主线程绝大多数时间正常阻塞在事件循环,而不是自身 CPU 忙循环;少量采样落在 Mos 的 event tap / 定时检查路径:

    4430  com.apple.main-thread
      4410  __CFRunLoopServiceMachPort -> mach_msg2_trap
        16  NSTimer -> Mos -> SLEventTapIsEnabled
         4  eventTapMessageHandler -> processEventTapData -> Mos
    
    4430  com.apple.NSEventThread
      4430  __CFRunLoopServiceMachPort -> mach_msg2_trap
    

    完整脱敏数据已在本地保留:20 分钟 Mos unified log、15 秒 top 原始采样、5 秒 Mos sample、对应 sleep/wake 电源日志和环境元数据。如果需要其中某一份完整内容,我可以继续贴到本 issue。

    关于你问的复现条件:是否每次休眠唤醒都触发目前还不能确认;只锁屏不合盖尚未单独测试。本次卡顿至少在两轮采样期间持续,没有自行恢复。此前退出 Mos 后窗口拖动立即恢复;这次为了保留现场没有退出或重启 Mos。

  5. stqfdyr commented on Jul 20, 2026

    @stqfdyr

    补充附件:本次复现窗口的完整脱敏日志包(ZIP,5.8 KB 压缩/43 KB 解压):

    mos-issue-evidence-20260720-2045-sanitized-logs.zip

    内含:

    • Mos-unified-log.txt:20 分钟 Mos unified log
    • Mos-sample.txt:5 秒 Mos sample(调用栈)
    • process-samples.txt:15 秒 WindowServer / Mos CPU 采样
    • power-sleep-wake.txt:对应的 sleep/wake 时间线

    已再次遮盖电源日志中的本机 UID 占位符;不包含 raw/ 原始文件、屏幕/输入内容、网络地址、账号资料或硬件标识。ZIP SHA-256:12b10990d7830ed80d350d2b5713d83a42b41211e76b022e5e8d77373faefc07。

  6. Caldis commented on Aug 4, 2026

    @Caldis
    Owner

    已由 #999 修复并合入 master,感谢大家持续补充复现信息、日志和现场数据。

    根因是 Interceptor 销毁时没有调用 CFMachPortInvalidate,导致已禁用的 event tap 注册残留在 WindowServer 中。检查历史后确认,这个生命周期缺口存在已久;后续加入的 sleep/wake 重建和 Button 功能增加了重建频率与每轮 tap 数量,才让问题更快累积并变得明显。

    修复会随后续版本发布。

  7. added a commit that references this issue on Aug 4, 2026
    3ea1c62
  8. Da1sypetals commented on Aug 20, 2026

    @Da1sypetals

    有没有canary版本可以用上这个fix的

  9. Caldis commented on Aug 20, 2026

    @Caldis
    Owner

    我来发个新版

  10. Caldis commented on Aug 20, 2026

    @Caldis
    Owner

    @15615144111 4.3.0-beta 已发布, 包含一个与此症状高度相关的修复: 显示器休眠唤醒后, 滚动引擎可能被绑定在过低的刷新率上导致卡顿, 此前只能重启 Mos 恢复, 现在会在唤醒后几秒内自动纠正 (#991, 感谢 @wiskiiii)。本版还修复了长时间运行的若干资源泄漏问题。欢迎更新到 beta 验证盒盖待机后是否还会出现卡顿: https://github.com/Caldis/Mos/releases/tag/4.3.0-beta-20260820.1

  11. Lum1104 commented on Nov 19, 2026

    @Lum1104

    我也遇到这个问题了,卡的不行找半天,感谢修复!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions