Skip to content

Fix duplicate dmix ipc_key collisions in asound.conf#1095

Open
stamateviorel wants to merge 1 commit into
micro-nova:mainfrom
stamateviorel:fix/asound-unique-dmix-ipc-keys
Open

Fix duplicate dmix ipc_key collisions in asound.conf#1095
stamateviorel wants to merge 1 commit into
micro-nova:mainfrom
stamateviorel:fix/asound-unique-dmix-ipc-keys

Conversation

@stamateviorel

Copy link
Copy Markdown

What does this change intend to accomplish?

All twelve loopback dmix devices in asound.conf share ipc_key 1028. dmix instances with the same ipc_key collide on one shared-memory segment, so opening a loopback playback device intermittently fails with EINVAL / snd_pcm_dmix_open: unable to open slave depending on open order and which zones are active. The player on that source then crash-loops: on our production unit the LMS player flapped 189 times/day until we made the keys unique. The log signature is identical to #957 (lb4c ... unable to open slave ... EINVAL), so I believe this is that issue's root cause. The patch gives every loopback dmix a unique ipc_key and pins the 8ch dmixer slave rate to 48000 so its format can't drift from the loopbacks.

Running in production on a stock 0.4.10 unit since 2026-06-08 with zero loopback open failures since (previously several per day).

Checklist

  • Have you tested your changes and ensured they work? (in production on a real AmpliPi since 2026-06-08)
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • If applicable, have you updated the CHANGELOG?
  • Does your submission pass linting & tests? (config-only change; happy to fix anything CI flags)

All twelve loopback dmix devices shared ipc_key 1028. dmix instances with
the same ipc_key collide on one shared-memory segment, so opening a
loopback playback device intermittently fails with EINVAL ('unable to
open slave') depending on open order - the same signature as micro-nova#957. The
player then crash-loops; on our production unit the LMS player flapped
189 times/day until the keys were made unique. Also pins the 8ch dmixer
slave rate to 48000 so its format can't drift from the loopbacks.

Running in production on a stock 0.4.10 system since 2026-06-08 with
zero loopback open failures since.

Signed-off-by: Stamate Viorel <stamate.viorel@gmail.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Comment thread config/asound.conf
period_size 1024
buffer_size 4096
channels 8
rate 48000

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is setting this fixed rate required? I know this is the default rate of the device but I'm not sure what the implications of fixing this rate rate.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Not strictly required, and happy to drop it. It's defensive rather than a fix: without an explicit rate, the first client to open the dmix sets the slave rate for every other loopback, so a stream that opens at 44100 would reconfigure the shared buffer and force resampling on everything else. Pinning it to 48000 (the DAC's native rate, which is also dmix's default here) just makes that explicit so no single client can move it.

That said, it's a separate concern from the ipc_key collision this PR is really about. If you'd rather keep the change minimal, I'll pull the rate line out and leave just the unique-key fix.

Comment thread config/asound.conf
pcm.lb1 {
type dmix
ipc_key 1028
ipc_key 1029

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice catch!

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