openhuman icon indicating copy to clipboard operation
openhuman copied to clipboard

MacBook Air在运行app时,计算机持续发烫

Open Tian0118 opened this issue 5 months ago • 1 comments

MacBook Air Apple M5 16GB+512, 是否有其他人有类似的情况:一旦关闭当前app一切正常,但是开启当前app后,电脑就会持续发烫,关闭后一切又恢复正常。期待回复谢谢

Tian0118 avatar Jun 09 '26 01:06 Tian0118

TL;DR (中文): 初步定位:App 默认的全屏动态背景(WebGL "mesh gradient")会持续以约 30fps 不停渲染 —— 即使窗口切到后台/失去焦点、或者你没有任何操作时也不会停,这会让 GPU/CPU 一直工作、机器持续发烫。已在分支上提交修复:窗口失焦/被遮挡/最小化,或系统开启「减少动态效果」时暂停该动画,回到前台再恢复。其它逐帧动画(吉祥物、悬浮球)只在特定页面出现,不是默认常驻。临时验证方法:把 设置 → 主题背景改成 “solid”,如果发热明显缓解,基本就能确认是这个背景动画。

Investigation — sustained CPU/GPU while the app is open

Heat tracks with the app simply being open (not with any particular action), so I searched for always-on, per-frame work that runs on the default screen regardless of user activity. Ranked suspects:

1. (Primary) Animated WebGL "mesh gradient" background renders continuously — even when the window is backgrounded/unfocused

  • app/src/components/AppBackground.tsx:20 — backdrop = theme.backdrop?.kind ?? 'mesh' → mesh is the default backdrop.
  • app/src/App.tsx:318 — <AppBackground /> is mounted at the app root, so it renders on every screen.
  • app/src/components/MeshGradient.tsx wraps the Stripe-style Gradient (app/src/lib/meshGradient.js). Its animate loop reschedules requestAnimationFrame as long as conf.playing is true (meshGradient.js:472-473) and renders roughly every other frame (~30fps) whenever the document isn't hidden (meshGradient.js:613).
  • The component never pauses when the OS window loses focus or is occluded. On macOS a background/occluded window is usually still visibilityState === 'visible' (only truly minimizing/hiding flips document.hidden), so the shader keeps rendering at ~30fps with the app merely sitting open in the background → continuous GPU/CPU → the machine runs hot. Nothing throttles it, and prefers-reduced-motion isn't honored anywhere in the app.

Fix (branch perf/3524-idle-cpu): pause the gradient whenever the window is hidden, unfocused/occluded (visibilitychange + window focus/blur), or the user prefers reduced motion; resume on focus. It reads the lib's own conf.playing flag so it never double-schedules the rAF loop. Regression test added in MeshGradient.test.tsx (pause-on-blur / resume-on-focus). This removes the sustained load in the common "app open in the background / idle" case and for reduced-motion users, and is a small, localized change (no edits to the vendored gradient lib).

2. (Secondary, page-scoped — not the default cause) Per-frame rAF animations on specific screens

Worth a follow-up to also gate on visibility/focus + reduced-motion, but these only run while their screen is visible:

  • Mascot clock app/src/features/human/Mascot/useMascotClock.ts:14-18 drives a 60fps React setState per frame; mounted on the Human page and Accounts via useHumanMascot/Ghosty (features/human/Mascot/Ghosty.tsx:276).
  • app/src/components/RotatingTetrahedronCanvas.tsx — continuous WebGL rotation in the overlay/companion window (overlay/OverlayApp.tsx:721).

Ruled out as the default cause

  • Screen intelligence / screen capture is default-off (config/schema/accessibility.rs:39-41, default_enabled() = false; 0.2 fps even when enabled).
  • Heartbeat/subconscious loops are minute-cadence (config/schema/heartbeat_cron.rs, min 5 min), not per-frame.
  • Voice/audio always-on capture is opt-in.
  • The dotted-canvas overlay (index.css:211) is a static CSS radial-gradient, not animated.

Please confirm (helps validate the fix)

With the app open and idle, does Activity Monitor show the OpenHuman renderer/GPU-helper using steady CPU%? And does switching Settings → theme backdrop → "solid" (which disables the mesh) make the machine run cooler? If yes, that confirms suspect #1.

M3gA-Mind avatar Jul 15 '26 13:07 M3gA-Mind