[1.1.104][mac-arm] Crash changing audio settings SoundMixerSDL.cpp (31): getFinalVolume

This subforum contains all the issues which we already resolved.
Post Reply
rvb30
Manual Inserter
Manual Inserter
Posts: 2
Joined: Mon Feb 19, 2024 9:24 pm
Contact:

[1.1.104][mac-arm] Crash changing audio settings SoundMixerSDL.cpp (31): getFinalVolume

Post by rvb30 »

Game Version: 1.1.104 (build 62119, mac-amd64)
Save was a heavily modded Space Exploration run, probably not relevant but I can provide it if you want it.

1. What did you do?
Switched from "default device" to my laptop speakers in audio settings, then switched back again. I couldn't hear any game sounds and was attempting to debug/fix that by switching the devices to and fro. (I've had success with this technique in other games when I [dis]connected bluetooth headphones so it was a logical thing to try.

2. What happened?
Game crash, logs seem to suggest a segfault.
```
23209.396 [Audio] Backend:SDL(default); Driver:coreaudio, Device:MacBook Pro Speakers, Depth:16, Channels:2, Frequency:44100
23214.026 [Audio] Backend:SDL(default); Driver:coreaudio, Device:Default device, Depth:16, Channels:2, Frequency:44100
23215.720 Error CrashHandler.cpp:639: Received SIGSEGV
Factorio crashed. Generating symbolized stacktrace, please wait ...
```

3. What did you expect to happen instead? It might be obvious to you, but do it anyway!
The game not crash, and potentially fix my audio issues

4. Does it happen always, once, or sometimes?
One off

5. If you can reproduce the issue provide the exact steps!
Can't reproduce unfortunately, will update the report if it happen again.
Attachments
factorio.log
(446.54 KiB) Downloaded 24 times

heartosis
Burner Inserter
Burner Inserter
Posts: 5
Joined: Sat Oct 01, 2022 3:57 am
Contact:

Re: [Donion] [1.1.104][mac-arm] Crash changing audio settings SoundMixerSDL.cpp (31): getFinalVolume

Post by heartosis »

I had a similar crash on Windows 10, also on 1.1.104, while starting a run with the Ultracube mod and a few others. I was listening to music in Chrome and eventually noticed sound wasn't working in Factorio because I couldn't hear an alarm I'd set up. When I went to switch devices in the settings (from default device to my speaker device), it crashed almost immediately. I don't see how to upload logs on a reply, but I can upload my logs in a new post if that would be helpful. FWIW, the line numbers were slightly different in my stacktrace:

Code: Select all

c:\users\build\appdata\local\temp\factorio-build-axh5wp\src\sound\sdl\soundmixersdl.cpp (29): SoundMixerSDL::getFinalVolume
c:\users\build\appdata\local\temp\factorio-build-axh5wp\src\sound\sdl\soundinstancesdl.cpp (114): SoundInstanceSDL::setVolume
c:\users\build\appdata\local\temp\factorio-build-axh5wp\src\sound\entityworkingsound.cpp (44): EntityWorkingSound::EntityWorkingSound
c:\users\build\appdata\local\temp\factorio-build-axh5wp\src\sound\environmentsoundplayer.cpp (245): EnvironmentSoundPlayer::update
c:\users\build\appdata\local\temp\factorio-build-axh5wp\src\game.cpp (446): Game::prepareRender
c:\users\build\appdata\local\temp\factorio-build-axh5wp\src\mainloop.cpp (1156): MainLoop::prepare
c:\users\build\appdata\local\temp\factorio-build-axh5wp\src\mainloop.cpp (716): MainLoop::mainLoopStep
c:\users\build\appdata\local\temp\factorio-build-axh5wp\src\mainloop.cpp (423): MainLoop::run
c:\users\build\appdata\local\temp\factorio-build-axh5wp\src\main.cpp (1267): wmain
Logs right before crash:

Code: Select all

2899.146 [Audio] Backend:SDL(default); Driver:wasapi, Device:Realtek Digital Output (Realtek(R) Audio), Depth:16, Channels:2, Frequency:44100
2926.316 [Audio] Backend:SDL(default); Driver:wasapi, Device:Speakers (AudioQuest DragonFly Black v1.5), Depth:16, Channels:2, Frequency:44100
2929.605 Error CrashHandler.cpp:639: Received SIGSEGV

Donion
Factorio Staff
Factorio Staff
Posts: 173
Joined: Sun Aug 22, 2021 9:18 am
Contact:

Re: [Donion] [1.1.104][mac-arm] Crash changing audio settings SoundMixerSDL.cpp (31): getFinalVolume

Post by Donion »

Thanks for the reports.
This turned out to be a pretty rare crash. I wasn't able to reproduce it organically but looking at the stack traces I was able to force the situation in a test environment.
It should be fixed in the next release.

rvb30
Manual Inserter
Manual Inserter
Posts: 2
Joined: Mon Feb 19, 2024 9:24 pm
Contact:

Re: [1.1.104][mac-arm] Crash changing audio settings SoundMixerSDL.cpp (31): getFinalVolume

Post by rvb30 »

That's awesome, thank you!

I'll 100% understand if the answer is no, but given that I'm a dev I'm curious if you could give any info on what was actually happening?

Donion
Factorio Staff
Factorio Staff
Posts: 173
Joined: Sun Aug 22, 2021 9:18 am
Contact:

Re: [1.1.104][mac-arm] Crash changing audio settings SoundMixerSDL.cpp (31): getFinalVolume

Post by Donion »

If a sound with its sound type overridden was playing at the time of audio device switch it would stop playing, making its resources available for a different sound to be played after the device switch, but it would still hold a pointer (now invalid) to a mixer. And it could happen that those resources would get allocated to a sound that would immediately try to access that mixer, it would cause the crash. So a classic use-after-free bug.

Post Reply

Return to “Resolved Problems and Bugs”