Skip to content

Desktop (Linux): one renderer main thread burns ~100% of a CPU core from launch onwards, forever — 0.0.205 #18

Backlog

Description

@Aeell

Summary

On Linux, the Freebuff Desktop UI keeps one renderer main thread pinned at roughly a full CPU core from launch, permanently, while the app is completely idle. It reproduces on an empty, fresh thread, so it is not conversation size. On a 4-core/8-thread laptop this is ~1 of 8 hardware threads burned continuously (about 25% of a 4-thread CPU), which is enough to make typing and window switching lag while the machine is otherwise idle.

Happy to run any instrumentation you want; the numbers below are from repeated measurement, not a one-off spike.

Environment

App @codebuff/freebuff-desktop 0.0.205 (latest freebuff-desktop-v* tag at time of writing)
Build commit f1641d8af2a035dfb8a1b107d7f256ce9172276c, built 2026-11-23T08:12:31Z
Runtime Electron/Chromium 130.0.6723.191, Linux x86_64 AppImage
OS Arch Linux, Wayland session (Hyprland), no XWayland for the app (--ozone-platform=wayland)
CPU Intel Core i5-8250U, 4 cores / 8 threads
Flags App launched as shipped from the desktop entry: Freebuff.AppImage --no-sandbox --ozone-platform-hint=auto

Measurements

Renderer process (--type=renderer ... --renderer-client-id=6), sampled per second with /proc/<pid>/stat:

85%  105%  92%  81%  110%  82%  95%  85%  83%  137%      (10 s)
146% 113% 103% 109% 112% 121% 110% 107%                   (8 s, later)

It never reaches zero, from launch onwards, with the window untouched.

Process-wide character of the burn over a 5 s window:

  • user 91% / sys 2% of one core — pure userspace work, no syscall churn
  • ~121 voluntary context switches/s, ~102 non-voluntary
  • 0 bytes/s disk read or write
  • other ~15 renderer threads sit idle in epoll_wait / pthread_cond_timedwait
  • the GPU process holds ~14–23% and the Compositor thread ~12% alongside it

Totals for the whole app: ~1 core of CPU and ~1 GB RSS across 9 processes.

What it is not (ruled out by measurement)

  • Not conversation size. A brand-new, empty thread reproduces it at ~108%.
  • Not occlusion / visibility. document.hidden never appears in the shipped UI bundle (0 hits, single visibilitychange reference), so nothing pauses when the window is covered. Moving the window to an invisible Hyprland workspace (which stops frame callbacks) left the main thread at 76% vs 72% visible — within noise.
  • Not a compositor tuning issue on our side. misc.render_unfocused_fps=1 changed nothing (107% → 110%); Hyprland blur is off. The Compositor thread keeps ~10% regardless because Wayland reports no occlusion.
  • Not rendering/raster. The cost is main-thread user time, not raster threads.

The ~120 wakeups/s is the interesting part: it looks like an ~8 ms cadence loop (JS or style/layout) rather than a 60 Hz rAF, which matches it surviving an invisible workspace.

Where it points

The UI is served locally by the orchestrator (127.0.0.1:<port>) from resources/orchestrator/ui/assets/index-DrKlWxFE.js, so the code is in the shipped bundle. Reading that bundle:

  • it contains exactly one requestAnimationFrame, so this is not simply an uncancelled rAF animation loop;
  • there is no prefers-reduced-motion handling anywhere in the bundle (0 hits), and no user-facing performance/animation preference — uiPrefs in state.json only holds projectSetupCompleted / prompted;
  • there is a document-wide MutationObserver with childList: true, subtree: true and an attributeFilter that includes class and style, registered on both the app container and document.documentElement, next to a ResizeObserver and a rAF-coalesced redraw;
  • that redraw writes inline custom properties back onto elements (--wallpaper-opacity, --wallpaper-blur, data-preset, data-wallpaper, …).

A plausible feedback path is observer callback → inline style/attribute write → observer fires again (or a per-frame layout/measure pass) → loop at the observer's cadence. I have not been able to confirm which branch it is: the packaged build refuses --remote-debugging-port/pipe/address (electron/debug-switches.cjs), and ptrace_scope=1 blocks attaching a profiler to a process we did not spawn, so there is no JS profile from here. The bundle is on a read-only squashfs, so I did not patch it.

Impact and current workaround

Total CPU is unchanged by anything available to the user; the only mitigation that helped responsiveness was dropping scheduling priority, which is not a fix — the core still burns (heat, fan, battery):

Exec=/usr/bin/nice -n 10 /path/Freebuff.AppImage --no-sandbox --ozone-platform-hint=auto %U

Ask

  1. Can you reproduce the same steady one-core burn on 0.0.205, on Linux and/or macOS?
  2. If the loop is the observer/redraw path above, could it be gated — e.g. skip when the measured value is unchanged, and pause when the window is not focused/minimized?
  3. Failing that, would you consider respecting prefers-reduced-motion (or shipping a "reduce effects" preference) so users on low-power hardware can turn the always-on UI work off?

I can test builds, capture stacks, or run a patched bundle if that helps narrow it down.

Activity

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