Skip to content

fix(CavaService): prevent 100% CPU EOF spin loop by using temp file#2471

Open
Angerion wants to merge 1 commit into
AvengeMedia:masterfrom
Angerion:fix-cava-eof-loop
Open

fix(CavaService): prevent 100% CPU EOF spin loop by using temp file#2471
Angerion wants to merge 1 commit into
AvengeMedia:masterfrom
Angerion:fix-cava-eof-loop

Conversation

@Angerion
Copy link
Copy Markdown

Fix CavaService 100% CPU EOF spin loop

Description

This pull request resolves a critical performance issue in CavaService.qml where the visualizer process would hit an EOF on stdin and spin infinitely at 100% CPU usage.

When Quickshell.Io.Process executes the command cat <<'CAVACONF' | cava -p /dev/stdin, cat finishes writing the config quickly and exits, causing a broken pipe/EOF on cava's standard input. cava spins in a tight loop attempting to read from the closed stream, consuming 100% CPU and flooding the shell with thousands of zeroed visualizer frames per second. This in turn drives the compositor and Qt quickshell usage to ~80% CPU and heavily overheats integrated GPUs.

Changes

  • Updated the shell command in CavaService.qml to write the configuration to a temporary file (/tmp/dms-cava.conf) instead of relying on a stdin pipe.
  • cava is now invoked with exec cava -p /tmp/dms-cava.conf < /dev/null, completely decoupling its stdin from the configuration stream and eliminating the EOF spin loop bug.

Testing

  • Verified that cava now correctly idles around ~8% CPU instead of locking a core at 100%.
  • Verified cava continues to produce audio visualization frames properly using the temporary configuration file.

Copilot AI review requested due to automatic review settings May 22, 2026 15:16
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates how the Cava process is started by writing the generated config to a temporary file and then launching cava pointing at that file.

Changes:

  • Switch Cava config delivery from a stdin heredoc pipe to writing /tmp/dms-cava.conf.
  • Start cava via exec cava -p /tmp/dms-cava.conf and detach stdin (< /dev/null).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


running: root.cavaAvailable && root.refCount > 0
command: ["sh", "-c", `cat <<'CAVACONF' | cava -p /dev/stdin
command: ["sh", "-c", `cat <<'CAVACONF' > /tmp/dms-cava.conf
Comment on lines +55 to +56
CAVACONF
exec cava -p /tmp/dms-cava.conf < /dev/null`]

running: root.cavaAvailable && root.refCount > 0
command: ["sh", "-c", `cat <<'CAVACONF' | cava -p /dev/stdin
command: ["sh", "-c", `cat <<'CAVACONF' > /tmp/dms-cava.conf
Comment on lines +55 to +56
CAVACONF
exec cava -p /tmp/dms-cava.conf < /dev/null`]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants