🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: muc.lists.freebsd.hackers
1 messages
1 total messages Started by Fabian Keil Wed, 25 Nov 2026 07:28
Audio device underruns under load
#118
Author: Fabian Keil
Date: Wed, 25 Nov 2026 07:28
64 lines
5798 bytes
On an ElectroBSD amd64 system based on FreeBSD stable/15
I reproducibly get "Audio device underrun detected." messages
from mpv when playing audio files with default priority while
"lots" of data in a short amount of time is written to a ZFS
pool on a geli-encrypted vdev.

When the messages occur, the sound briefly stops.

The system is a Lenovo T520 with an Intel(R) Core(TM)
i5-2520M CPU @ 2.50GHz, /dev/sndstat content is:

| Installed devices:
| pcm0: <Conexant CX20590 (Analog 2.0+HP/2.0)> (play/rec) default
| pcm1: <Intel Cougar Point (HDMI/DP 8ch)> (play)
| pcm2: <Intel Cougar Point (HDMI/DP 8ch)> (play)
| pcm3: <Intel Cougar Point (HDMI/DP 8ch)> (play)
| No devices installed from userspace.

The issue frequently occurs while running poudriere when
packages are installed during the lib-depends phase for
ports with lots of dependencies, even though poudriere is
started with "nice -n 20" and is configured with
PARALLEL_JOBS=3 while kern.smp.cpus is 4.

The issue can also be reproduced by running:
   dd if=/dev/random bs=1m count=1000 of=~/scratch/random.data
while mpv is running.

mplayer and vlc have similar sound issues under load but
don't seem to log anything obvious with default settings
when the problems occur.

Reducing vfs.zfs.zio.taskq_batch_pct to 25 helped a lot,
but did not completely solve the issue.

A more reliable workaround seems to be running:
   rtprio 16 -$(pgrep mpv)
before expecting a write load.

If mpv is started while the system is already loaded the underruns
often occur in the first seconds before the priority is raised, though.

In ElectroBSD, I therefore recently added a kern.boost_multimedia_players
sysctl. It can be set to let the kernel boost the priority for
recognised multimedia players automatically at execution time [0].

Having to boost the priority for multimedia players and having
to modify ZFS settings doesn't strike me as ideal, though, so I'm
still considering this a scheduling issue.

While I already tried various modifications below kern.sched using
both schedulers, I did not find combinations that obviously improved
things further.

Any recommendations?

Fabian

[0]: <https://www.fabiankeil.de/sourcecode/electrobsd/ElectroBSD-15-20261124-Add-a-sysctl-to-boost-the-priority-for-multimedia.diff>


--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads