Skip to content

coreaudiod pinned at ~9% CPU: notification sound leaks BuiltInSpeakerDevice audio stream (regression of #24668) #35242

Closed as not planned

Description

@mrm007

Summary

coreaudiod gets pinned at ~9% CPU indefinitely after opencode plays a completion/notification sound. The one-shot sound opens a BuiltInSpeakerDevice audio-output stream that is never torn down, so macOS keeps the Core Audio output engine running (and holds a PreventUserIdleSystemSleep power assertion) for the entire lifetime of the opencode process. CPU drops to 0% the instant opencode exits.

This is the same class of leak as the closed #24668 (logo charge-hum audio leak), reproducing on the current release — appears to be a regression / incomplete fix.

Environment

  • opencode: 1.17.13 (latest; matches npm [email protected] and release v1.17.13)
  • macOS: 15.7.5 (24G624), Apple Silicon (arm64)

Steps to reproduce

  1. Run an opencode session with the completion/notification sound enabled.
  2. Trigger a notification (e.g. let an assistant response complete so the "ding" plays).
  3. Observe coreaudiod CPU with top/ps.

Expected

The notification sound is a fire-and-forget one-shot. After it finishes, opencode should release the audio output stream so coreaudiod returns to idle (~0%).

Actual

opencode keeps the output stream open for the whole session. coreaudiod sits at ~9% CPU continuously and drops to 0% only when opencode exits. Every subsequent notification re-opens a fresh leaked stream.

Evidence

Persistent power assertion owned by the opencode PID (survives long after the sound ended):

$ pmset -g assertions | grep -A2 BuiltInSpeakerDevice
pid 10974(coreaudiod): [...] PreventUserIdleSystemSleep named:
  "com.apple.audio.BuiltInSpeakerDevice.context.preventuseridlesleep"
  Created for PID: 15075.        <-- opencode session PID
  Resources: audio-out BuiltInSpeakerDevice

opencode PID holds the CoreAudio output component open:

$ lsof -p 15075 | grep CoreAudio
opencode. 15075 ... /System/Library/Components/CoreAudio.component/Contents/MacOS/CoreAudio

coreaudiod CPU while the (idle, silent) stream is held:

$ ps -o pid,%cpu -p $(pgrep coreaudiod)
  PID  %CPU
10974   9.3

Watched a fresh stream appear ~40s after a notification played, confirming each sound re-triggers the leak. Over a long-lived session (27-day uptime here), leaked streams accumulated and coreaudiod had burned ~31 CPU-hours.

Workaround

Disabling the completion/notification sound stops the leak entirely (no sound played → no output stream opened → coreaudiod stays at 0%).

Related

Activity

  1. github-actions commented on Sep 2, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

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