Skip to content

Alsa buffer underrun then error flood/freeze #448

@andrewbaxter

Description

@andrewbaxter

Describe the bug
I get ALSA lib pcm.c:8568:(snd_pcm_recover) underrun occurred randomly for a while (around 1/sec, but with lots of jitter) then suddenly get flooded with

an error occurred on output stream: A backend-specific error has occurred: ALSA function 'snd_pcm_poll_descriptors' failed with error 'UnknownErrno: Unknown errno'

I can't close the window (window stays, but stops responding), or if I can close the window the program doesn't end and continues flooding the above error.

To Reproduce

use std::{thread, time::Duration};

fn main() -> ! {
    let (_stream, _stream_handle) = rodio::OutputStream::try_default().unwrap();
    loop {
        thread::sleep(Duration::from_millis(500));
    }
}

It happens if I wait a while, but sometimes I can trigger it by switching desktops or windows back and forth.

Expected behavior
No lockup, no audio error messages in general.

Screenshots or pasted code

Hardware and Software:

  • ggez version: 0.16.0
  • OS: Arch, updated a few days ago

I'm using pipewire with the pulse audio bridge.

FWIW, and maybe unrelated, but while my program is running I can't play new music (with mpv, pulse). If I'm playing music at the time I start the program (or for maybe 10-20s after I stop playing music) when I start my program I get these (non-fatal) error messages and the above issue doesn't manifest:

ALSA lib pcm_dmix.c:999:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm_dmix.c:999:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm_dmix.c:999:(snd_pcm_dmix_open) unable to open slave
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
ALSA lib pcm_oss.c:397:(_snd_pcm_oss_open) Cannot open device /dev/dsp
ALSA lib pcm_oss.c:397:(_snd_pcm_oss_open) Cannot open device /dev/dsp

(/dev/dsp doesn't exist on my system unrelated to the above)

moved from ggez/ggez#1110

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions