Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: ALSA does not recover from broken pipe, with bad consequences for logging/drive space #1291

Open
1 task done
bluebandit21 opened this issue Feb 13, 2024 · 6 comments

Comments

@bluebandit21
Copy link
Member

Is there an existing issue for this?

  • I have searched the existing issues

Contact Details

No response

Version Info

Latest available release

What operating system are you seeing the problem on?

Linux (any distro)

Bug Behavior

Reporting for the user tokyostarshashtag0748 on the main Discord server.
(Arch, using pipewire for ALSA)

They encountered sound breaking for them while running the game, and later noticed that the latest log for Etterna was ludicrously large (13 GB!), filled with [2024-02-12 20:20:33][WARN]: ALSA: snd_pcm_wait: Broken pipe

Expected Behavior

Ideally, we'd be able to recover from a broken pipe situation and end up with Etterna having working sound again :)
Failing that, it's probably better to intentionally crash the game after a few repeats of the same error, since having Etterna running without sound isn't helpful, it's unlikely to recover on its own, and a log file of the same error message each frame is not helpful either.

Reproduction Steps

Unknown

Anything else?

The actual error message and consequent logging is happening within

bool
Alsa9Buf::WaitUntilFramesCanBeFilled(int timeout_ms)
{
int err = dsnd_pcm_wait(pcm, timeout_ms);
/* EINTR is normal; don't warn. */
if (err == -EINTR)
return false;
ALSA_ASSERT("snd_pcm_wait");
return err == 1;
}

The ALSA documentation for the snd_pcm_wait command is available at https://www.alsa-project.org/alsa-doc/alsa-lib/group___p_c_m.html#gad4d53d58b996a7cd9a5cbf1710b90375

@bluebandit21
Copy link
Member Author

The "Intentionally crash the game" approach is pretty simple -- see if we get the same error code returned for, idk, 10 sequential calls of the function; crash if so with an appropriate message, resetting that counter if it ever succeeds.

I might try to look into ALSA stuff sometime soon to see if it's relatively simple to fix the broken pipe after it occurs.

Unfortunately I don't have a system on which to test changes/reproduce the bug.

@poco0317 poco0317 changed the title [Bug]: ALSA Can Fail and Generate 13 GB Large Log Files [Bug]: ALSA does not recover from broken pipe, with bad consequences for logging/drive space Feb 13, 2024
@ghost
Copy link

ghost commented Mar 12, 2024

happens on my end too.

@Vezxe
Copy link

Vezxe commented Apr 9, 2024

I experience it too

@StarbotArc
Copy link

StarbotArc commented Apr 14, 2024

I have also experienced it, but I feel like the game shouldn't just crash because of this issue because that will happen while a player is playing the game and will cause more issues. I think really it should tell the user upfront when they aren't playing a file that the audio does not work.

(Also, no, it went beyond 13GB, my hard drive turned 13GB. The file was ~141GB.)

@yeslyko
Copy link

yeslyko commented Apr 14, 2024

If anyone have this issue and don't know how to fix it, go to Etterna\Save\Preferences.ini, find the SoundDevice= line and run this command inside of the terminal aplay -l. Find your main output device and find a line like this one Subdevice #[number]: subdevice #[number]. Into SoundDevice= insert this plughw;0,0 where zeros are the numbers from the line on main output device.

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

No branches or pull requests

5 participants