Windows 下偶发整窗灰屏且停止出帧
- Dominant language
- TypeScript
- Stars
- 2.7k
- Forks
- 395
- Avg merge
- 21h 48m
- Merged PRs (30d)
- 776
Description
**提交人**: yan
**客户端版本**: 0.1.69
---
## 现象
Cindy 偶发出现整个应用窗口变成一块浅灰色、原有界面内容完全不可见的情况。窗口仍保持原来的尺寸和层级,会遮挡其后的其他窗口;应用进程并未立即退出。
问题通常出现在窗口曾被隐藏、最小化、切换到后台,随后重新显示或跨显示器移动的附近。发生时可能同时有后台任务正在运行,但目前不能稳定复现,也不能确认这是必要条件。
## 复现步骤
目前没有稳定复现步骤,疑似路径如下:
1. 保持 Cindy 运行,并可能有任务在后台执行。
2. 隐藏、最小化 Cindy,或切换到其他应用。
3. 稍后重新显示窗口,或将窗口移动到另一块显示器。
4. 低概率出现整个窗口呈浅灰色、界面不再绘制。
以上步骤是根据现场行为和日志归纳的候选路径,并非每次都能触发。
## 期望行为
窗口从隐藏、最小化或后台状态恢复后,应稳定恢复现有界面和帧输出;后台任务运行及跨显示器移动不应导致窗口内容消失。
## 实际行为
窗口偶发只剩浅灰色原生背景,应用内容完全不可见。等待一段时间,或将 Cindy 切换到另一块显示器再切回,有概率恢复,但不是稳定有效的解决办法。
## 复现频率
偶发,暂时无法稳定复现。最近半个月的本地日志中,精确命中“页面可见但帧管线无输出”诊断一次。
## 已尝试
- 等待窗口自行恢复:有概率有效。
- 将 Cindy 移到另一块显示器后再切回:有概率有效。
- 尚未找到稳定 workaround。
## 脱敏诊断摘要
用户已同意公开以下脱敏摘要:
- 一次现场中,窗口经历较长时间隐藏后出现前台/可见状态变化。
- Renderer watchdog 随后记录:页面被判定为可见,但 `requestAnimationFrame` 探针超过 2 秒没有回调。
- 同一时段普通 timer 仍能执行;没有对应的 Renderer 主线程 `unresponsive`、`render-process-gone`、GPU reset 或 Crashpad dump。
- 现场附近有后台任务运行,主窗口的 `backgroundThrottling` 可能随任务状态动态切换。
- 当前 Windows 主窗口使用无边框 Acrylic。网页合成内容未提交时,会露出浅灰色 BrowserWindow backing,可解释“整窗灰色”的视觉表现。
## 初步代码分析
目前较可疑的是以下生命周期组合:
`hide/minimize → 后台任务动态切换 backgroundThrottling → show/restore → Windows frameless Acrylic`
代码中已经注明:当 `backgroundThrottling=false` 时,Electron 的 `document.visibilityState` 在窗口实际隐藏或最小化时仍可能保持 `visible`。但当前 render watchdog 只依赖 `visibilityState`,没有结合已有的 Main 原生窗口状态广播。因此现有告警能够证明 rAF 未回调,但不能单独区分:
1. 用户眼前真实可见的 Chromium/Viz Surface 停止出帧;
2. 窗口实际仍隐藏,但 Page Visibility 因后台节流设置而产生误判。
此外,watchdog 安装在共享 Renderer 入口,日志没有附带 Renderer PID、webContents ID 或 view 类型,也限制了对具体窗口来源的确认。
建议后续取证时同时记录原生 `isVisible/isMinimized`、当前 `backgroundThrottling`、Renderer/view 身份,并在命中时抓取 Chromium Viz/GPU tracing;可再通过 Acrylic 与非 Acrylic 的 A/B 验证其是触发因素还是仅决定灰色外观。
---
**版本区域**: CN
**OS**: win32 x64 (10.0.26100)
**Harness**: Codex
**Model ID**: ` gpt-5.6-sol `
**界面语言**: zh-CN
Contributor guide
Research direction
Start at the shared Renderer entry and inspect the existing render watchdog, then trace the Main native window state broadcasts and dynamic backgroundThrottling changes. Reproduce or instrument the hide/minimize-to-restore path on Windows, including frameless Acrylic and cross-display moves. Done means distinguishing a real visible-surface frame failure from a visibility-state false positive, with Renderer PID, webContents ID, view type, and relevant window state recorded.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- electron, typescript
- Domain
- desktop, observability, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100