etternagame / etterna

Advanced cross-platform rhythm game focused on keyboard play
https://etternaonline.com/
MIT License
474 stars 132 forks source link

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

Open bluebandit21 opened 4 months ago

bluebandit21 commented 4 months ago

Is there an existing issue for this?

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 https://github.com/etternagame/etterna/blob/9a0b9fb94ea0c1f4d24b707bd00fad24d94d22ec/src/arch/Sound/ALSA9Helpers.cpp#L359-L369

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 commented 4 months ago

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.

bluebandit21 commented 4 months ago

See: https://discord.com/channels/339597420239519755/339597420239519755/1206772757287804929, https://discord.com/channels/339597420239519755/339597420239519755/1206765186103382047 for context.

ghost commented 3 months ago

happens on my end too.

Vezxe commented 2 months ago

I experience it too

StarbotArc commented 2 months ago

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 commented 2 months ago

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.