[Donion] [1.1.62] No audio and game freeze on quit with new default sound on linux

This subforum contains all the issues which we already resolved.
Danacus
Inserter
Inserter
Posts: 29
Joined: Sun Sep 18, 2016 5:25 pm
Contact:

Re: [Donion] [1.1.62] No audio and game freeze on quit with new default sound on linux

Post by Danacus »

I've also encountered this issue on Fedora 36 (pipewire 0.3.56, with support for pulse and alsa). I've tried changing settings, but so far I can't find any consistent patterns. Sometimes it works, sometimes it doesn't work, although I have only been able to replicate this bug on default (SDL), not on Allegro.
Danacus
Inserter
Inserter
Posts: 29
Joined: Sun Sep 18, 2016 5:25 pm
Contact:

Re: [Donion] [1.1.62] No audio and game freeze on quit with new default sound on linux

Post by Danacus »

Donion wrote: ↑Mon Aug 08, 2022 8:08 am
sitting.duc wrote: ↑Mon Aug 08, 2022 7:44 am
Hi, could you please try one other thing: running 1.1.65 with default (sdl) audio backend and post the log? There is a little bit more logging than in 1.1.62 and it might help me troubleshoot this further. I appreciate your tests and reports very much!
Hi, I was also able to replicate this bug just now after rebooting my system. Here's the log: https://rentry.co/4pc6h.
Danacus
Inserter
Inserter
Posts: 29
Joined: Sun Sep 18, 2016 5:25 pm
Contact:

Re: [Donion] [1.1.62] No audio and game freeze on quit with new default sound on linux

Post by Danacus »

I found a pattern that might be interesting (sound is on default/SDL in all cases):

When I first run ./factorio (with no environment variables), the bug occurs.

If I then run SDL_AUDIODRIVER=pulse ./factorio, it is fixed.

Now running ./factorio, without the environment variable also works, as if it somehow remembered the last setting.

Then I run SDL_AUDIODRIVER=alsa ./factorio or SDL_AUDIODRIVER=dsp ./factorio, these don't work and factorio tells me it was unable to initialize audio. This is all fine I guess.

But if I then try running ./factorio, without the environment variable, the bug is back. As if it magically "forgot" the SDL_AUDIODRIVER=pulse setting causing it to fail.

That said I have been able to get the bug with SDL_AUDIODRIVER=pulse ./factorio once before, so this doesn't fix everything. I will see if I can replicate that too.

Edit: to clarify, I never exported SDL_AUDIODRIVER, so it does not get stored in the shell session.

Edit2: I can replicate the bug using SDL_AUDIODRIVER=pulse if I suspend and resume my system.

Edit3: In order to fix the problem after resuming from suspend, I need to take the following steps:
  • Set SDL_AUDIODRIVER to something like alsa or dsp to push the game/SDL out of it's remebered configuration
  • Set SDL_AUDIODRIVER back to pulse to fix it
  • Now it works again without needing to set SDL_AUDIODRIVER
Last edited by Danacus on Mon Aug 08, 2022 8:55 am, edited 1 time in total.
Donion
Factorio Staff
Factorio Staff
Posts: 304
Joined: Sun Aug 22, 2021 9:18 am
Contact:

Re: [Donion] [1.1.62] No audio and game freeze on quit with new default sound on linux

Post by Donion »

Danacus wrote: ↑Mon Aug 08, 2022 8:44 am I found a pattern that might be interesting (sound is on default/SDL in all cases):
Interesting indeed, I think I now have more questions :), but thank you for your reports.
Danacus
Inserter
Inserter
Posts: 29
Joined: Sun Sep 18, 2016 5:25 pm
Contact:

Re: [Donion] [1.1.62] No audio and game freeze on quit with new default sound on linux

Post by Danacus »

Donion wrote: ↑Mon Aug 08, 2022 8:51 am
Danacus wrote: ↑Mon Aug 08, 2022 8:44 am I found a pattern that might be interesting (sound is on default/SDL in all cases):
Interesting indeed, I think I now have more questions :), but thank you for your reports.
I was hoping this could help you replicate the issue while debugging. My best guess right now is that setting SDL_AUDIODRIVER and running the game somehow changes some kind of state somewhere. Could be factorio, SDL or even PipeWire.
Donion
Factorio Staff
Factorio Staff
Posts: 304
Joined: Sun Aug 22, 2021 9:18 am
Contact:

Re: [Donion] [1.1.62] No audio and game freeze on quit with new default sound on linux

Post by Donion »

Danacus wrote: ↑Mon Aug 08, 2022 8:58 am I was hoping this could help you replicate the issue while debugging. My best guess right now is that setting SDL_AUDIODRIVER and running the game somehow changes some kind of state somewhere. Could be factorio, SDL or even PipeWire.
That's the thing, so far I was unable to replicate the issue on any distro/configuration I've got my hands on.
But yes, once I can replicate it, your information will help.
Danacus
Inserter
Inserter
Posts: 29
Joined: Sun Sep 18, 2016 5:25 pm
Contact:

Re: [Donion] [1.1.62] No audio and game freeze on quit with new default sound on linux

Post by Danacus »

I wanted to try one last thing: removing configuration files for PulseAudio/PipeWire. So I renamed the configuration directories, such that it would use default configuration. After restarting PipeWire and WirePlumber, I couldn't replicate the bug anymore.

So I restarted my computer, opened my web browser and started factorio. The bug was back. However, this was the last time I was able to replicate the bug. My steps to replicate the bug no longer worked. I tried different things, such as opening the web browser before launching factorio, or launching factorio as the only program connected to PipeWire. Each time it worked just fine, with or without SDL_AUDIODRIVER=pulse, no matter how much I tried to replicate the bug.

I decided to restore my configuration files, expecting to be able to replicate the bug again, but I can't, I still just works fine. I suspended and rebooted my system several times, but I can't replicate it anymore. It's like it magically fixed itself somehow. But there are still other people encountering this issue.

What makes this even weirder is that I recently switched to Fedora (with my old configuration files from my previous Arch Linux installation copied over). So it was basically a clean install.

I'm sorry that I am only able to give you more questions instead of answers :)

I'll let you know if the bug occurs again at some point.
Donion
Factorio Staff
Factorio Staff
Posts: 304
Joined: Sun Aug 22, 2021 9:18 am
Contact:

Re: [Donion] [1.1.62] No audio and game freeze on quit with new default sound on linux

Post by Donion »

Danacus wrote: ↑Mon Aug 08, 2022 9:50 am I'm sorry that I am only able to give you more questions instead of answers :)

I'll let you know if the bug occurs again at some point.
:) No worries, thanks.
sitting.duc
Burner Inserter
Burner Inserter
Posts: 6
Joined: Fri Jul 12, 2019 11:23 pm
Contact:

Re: [Donion] [1.1.62] No audio and game freeze on quit with new default sound on linux

Post by sitting.duc »

Donion wrote: ↑Mon Aug 08, 2022 8:08 am
sitting.duc wrote: ↑Mon Aug 08, 2022 7:44 am
Hi, could you please try one other thing: running 1.1.65 with default (sdl) audio backend and post the log? There is a little bit more logging than in 1.1.62 and it might help me troubleshoot this further. I appreciate your tests and reports very much!
Hello, my original log from https://pastebin.com/cGPxKfPd was from 1.1.65, is the detail you want in there?
Donion
Factorio Staff
Factorio Staff
Posts: 304
Joined: Sun Aug 22, 2021 9:18 am
Contact:

Re: [Donion] [1.1.62] No audio and game freeze on quit with new default sound on linux

Post by Donion »

sitting.duc wrote: ↑Mon Aug 08, 2022 12:12 pm
Donion wrote: ↑Mon Aug 08, 2022 8:08 am
sitting.duc wrote: ↑Mon Aug 08, 2022 7:44 am
Hi, could you please try one other thing: running 1.1.65 with default (sdl) audio backend and post the log? There is a little bit more logging than in 1.1.62 and it might help me troubleshoot this further. I appreciate your tests and reports very much!
Hello, my original log from https://pastebin.com/cGPxKfPd was from 1.1.65, is the detail you want in there?
Ah, right. Yes, that's what I wanted to see, although it doesn't provide more information, the audio is seemingly initialized properly, but obviously it isn't.
Do you by any chance have multiple audio devices? What does

Code: Select all

inxi -A
show? When you run SDL backend and Allegro backend, do they both show up in pavucontrol under the same output device?
Donion
Factorio Staff
Factorio Staff
Posts: 304
Joined: Sun Aug 22, 2021 9:18 am
Contact:

Re: [1.1.62] game freeze on quit after starting with new default sound - wasreverting audio to allegro on linux

Post by Donion »

Fiorra wrote: ↑Wed Jul 27, 2022 9:05 pm I got a different take on these symptoms: I'm playing along as usual, when suddenly the audio goes silent. I saved my game, tried to restart, and then I got the same hang: "Quitting: user-quit." is the last line, double ctrl-c to quit.

A while earlier, there was a message on stderr
ALSA lib pcm.c:8568:(snd_pcm_recover) underrun occurred
I was able to reproduce this on my machine (Manjaro with PulseAudio and pulseaudio-alsa) on version 1.1.65 by forcing the ALSA driver with

Code: Select all

SDL_AUDIODRIVER=alsa
and by loading the CPU heavily (either by loading a large map with a debug build or by mucking up my GPU settings).
I also saw the underrun ocurring before the audio stops, but I also saw it stopped without the underrun so it's just a symptom of the issue, not a cause.
When using the pulseaudio driver, it works fine.
Danacus
Inserter
Inserter
Posts: 29
Joined: Sun Sep 18, 2016 5:25 pm
Contact:

Re: [Donion] [1.1.62] No audio and game freeze on quit with new default sound on linux

Post by Danacus »

The issue occurred again today. The game starts without sound on pulse backend (I know it can't be using alsa backend, because libasound_module_pcm_pipewire.so is not supported by factorio on alsa backend, it only looks for libasound_module_pcm_pulse.so, which I don't have, but that's another issue I guess. Point being, if it was using the alsa backend it would tell me it failed).

I restarted my game a few times, and the bug consistently kept reoccurring. I do have multiple audio devices. inxi -A only shows HD Audio and HDMI Audio, but there is also EasyEffects Sink, an audio sink from a program that adds effects to sound such as EQ. I killed that program and then factorio did work properly, but I don't think EasyEffects is actually at fault. I restarted EasyEffects and restarted factorio. It still just worked. I can even switch factorio between EasyEffects Sink and HD Audio without issues. It might be related, but I'm not sure.
sitting.duc
Burner Inserter
Burner Inserter
Posts: 6
Joined: Fri Jul 12, 2019 11:23 pm
Contact:

Re: [Donion] [1.1.62] No audio and game freeze on quit with new default sound on linux

Post by sitting.duc »

Donion wrote: ↑Mon Aug 08, 2022 12:26 pm
sitting.duc wrote: ↑Mon Aug 08, 2022 12:12 pm
Hello, my original log from https://pastebin.com/cGPxKfPd was from 1.1.65, is the detail you want in there?
Ah, right. Yes, that's what I wanted to see, although it doesn't provide more information, the audio is seemingly initialized properly, but obviously it isn't.
Do you by any chance have multiple audio devices? What does

Code: Select all

inxi -A
show? When you run SDL backend and Allegro backend, do they both show up in pavucontrol under the same output device?
Yes, I have multiple sound drivers. Off the top of my head I can't tell which of these is actually my sound card. (laptop etc)

Code: Select all

gsharp@sunrise:~$ inxi -A
Audio:     Card-1 Intel 8 Series/C220 Series High Definition Audio Controller driver: snd_hda_intel
           Card-2 Intel Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller driver: snd_hda_intel
           Card-3 NVIDIA GK104 HDMI Audio Controller driver: snd_hda_intel
           Sound: Advanced Linux Sound Architecture v: k4.15.0-189-generic
Pavucontrol, with Factorio config.ini set to Allegro,
Image
Configuration pane says "GK104 HDMI Audio Controller" is profile = Off. "Built-in Audio" is profile = Off. "Built-in Audio" is profile = "Analog Stereo Duplex".
Output Devices pane has one entry, "Built-in Audio Analog Stereo", Speakers. It has a little volume meter that does respond to Factorio.
Playback pane shows "System Sounds" and "Factorio: Allegro Voice" and the little volume meter does respond to Factorio too.

Yeah, this appreciates the picture. :D


Image

With config.ini line commented out and Factorio using SDL, there is no sound output, and the little volume meter is not responding.
Danacus
Inserter
Inserter
Posts: 29
Joined: Sun Sep 18, 2016 5:25 pm
Contact:

Re: [Donion] [1.1.62] No audio and game freeze on quit with new default sound on linux

Post by Danacus »

This might be completely unrelated, and this audio issue might be making me go insane, but I was trying to install a mod for NieR Automata and it was crashing. The crash seemed to be related to audio too:

Code: Select all

08/11/2022 16:38:05.573: [  WASAPI  ] SK_WASAPI_GetAudioSessionControl (...) Failed During Enumerator Setup : SK_WASAPI_GetAudioSessionControl (...): Failed on Line 222 of C:\Users\amcol\source\repos\SpecialK\src\sound.cpp -- (HRESULT: 80004001) -- "Not implemented."
I couldn't get it to work (except under the most ridiculous circumstances https://github.com/SpecialKO/SpecialK/issues/22), so I gave up and decided to return to playing factorio.

But then I noticed sound wasn't working. So I closed my music player and opened pavucontrol. Then I started factorio again and sound was working again.

So then, out of curiousity, I wanted to know if the audio-related crash in NieR Automata with the SpecialK mod was somehow fixed as well. And it was magically fixed.

The point of this whole story is that:
- This issue might be related to other programs, not just factorio
- The error messages from SpecialK might be useful, although that's probably quite unlikely.
- I might have more ways to reproduce/debug this issue
- I might be going insane and seeing patterns that don't exist

Edit: there does seem to be a connection between those issues. I started my computer today: neither game works, both get their audio bug. I open pavucontrol, and just like that they both work.
romy
Manual Inserter
Manual Inserter
Posts: 2
Joined: Fri Mar 17, 2017 6:40 pm
Contact:

Re: [Donion] [1.1.62] No audio and game freeze on quit with new default sound on linux

Post by romy »

Hello, I have a similar issue:
* Xubuntu 20.04
* pulseaudio
* audio-backend=default or sdl
* steam
*

Code: Select all

inxi -A
Audio:     Device-1: NVIDIA TU106 High Definition Audio driver: snd_hda_intel 
           Device-2: Advanced Micro Devices [AMD] Starship/Matisse HD Audio driver: snd_hda_intel 
           Sound Server: ALSA v: k5.4.0-124-generic 
This happens since today update to 1.1.68, as I am on steam stable channel, I suppose it was in 1.1.61 previously.

Game freeze on quit, but also in game when I move near some factory (by moving player, or satellite view).

Changing `audio-backend=allegro` seems to fix the issue (not tested on long running game).
Ubuntu 16.04 x86_64 - Steam
valgrind
Manual Inserter
Manual Inserter
Posts: 3
Joined: Mon Jul 25, 2022 7:33 am
Contact:

Re: [Donion] [1.1.62] No audio and game freeze on quit with new default sound on linux

Post by valgrind »

Added launch option --audio-driver=allegro in Steam did the trick for me.

Ubuntu 20.04.1
LordBlackwood
Manual Inserter
Manual Inserter
Posts: 4
Joined: Thu Jun 04, 2020 9:45 am
Contact:

[1.1.68] bluetooth headphones only have sound if connected prior to game launch (macOS)

Post by LordBlackwood »

If i connect my AirPods prior to launching Factorio, everything works fine and i can hear the game audio over the headphones.
But if i launch factorio while they are not connected, and then connect them when the game is already running, there is no sound.
This only affects Factorio, since audio from all other applications still works fine over the AirPods.
Local audio (i.e., via the built-in speakers) still works fine regardless of when i connect or disconnect the headphones, it's only the bluetooth audio that doesn't work if the AirPods aren't already connected on launch.

Specifying the

Code: Select all

--audio-driver=allegro
launch option fixes this.

Possibly related to:
- viewtopic.php?f=182&t=102981 (though that bug report mentions getting an error message on launch, which i am not)
- viewtopic.php?f=182&t=102982 (though that report mentions the game freezing when changing the audio system, which i was not able to reproduce)
(Furthermore, both of the above-linked reports are Linux-specific and seem to be related to the presence (or lack thereof) of specific linux audio drivers and packages, which of course does not apply to macOS.)
Attachments
factorio-current.log
(107.17 KiB) Downloaded 82 times
Donion
Factorio Staff
Factorio Staff
Posts: 304
Joined: Sun Aug 22, 2021 9:18 am
Contact:

Re: [Donion] [1.1.62] No audio and game freeze on quit with new default sound on linux

Post by Donion »

With version 1.1.71, the SDL and its audio backend has been updated to a newer version. Some of you have already tested it (or a similar build) and it solved your issues. I cannot guarantee that it solves all issues everywhere but I'm moving this thread to Resolved. I would ask people that still have issues to create a new thread, otherwise this thread could be here forever.
Post Reply

Return to β€œResolved Problems and Bugs”