[Donion] [2.0.33] Crash with working_sound

Bugs which we just recently fixed in our development version and will reach you in the next release.
User avatar
Quezler
Fast Inserter
Fast Inserter
Posts: 130
Joined: Fri Mar 25, 2016 6:37 pm
Contact:

[Donion] [2.0.33] Crash with working_sound

Post by Quezler »

Was trying to configure some electro-y sounds for a new machine im working on, and i noticed when trying to decrease the pauses between each sound (still haven't figured those out btw, i want them to spam/overlap) by trying to increase the probability above 1 but did that one level too high and got this crash:

Code: Select all

  16.261 Error CrashHandler.cpp:641: Received SIGSEGV
Factorio crashed. Generating symbolized stacktrace, please wait ...
src/Util/StacktraceToStream.cpp (52): walkStackAndPrintToStream
src/Util/StacktraceToStream.cpp (60): printStacktraceToStream
src/Util/Logger.cpp (334): writeStacktrace
src/Util/Logger.cpp (379): logStacktrace
src/Util/CrashHandler.cpp (181): writeStackTrace
src/Util/CrashHandler.cpp (644): commonSignalHandler
src/Util/CrashHandler.cpp (652): SignalHandler
0x1b419f4a3
src/Sound/SDL/SoundInstanceSDL.cpp (48): play
src/Sound/EntityWorkingSound.cpp (136): startPlayingActive
src/Sound/EntityWorkingSound.cpp (94): startPlayingActive
src/Sound/EntityWorkingSound.cpp (571): update
src/Sound/EnvironmentSoundPlayer.cpp (249): updateEnvironmentSounds
src/Sound/EnvironmentSoundPlayer.cpp (237): updateSounds
src/Sound/EnvironmentSoundPlayer.cpp (145): update
src/Game.cpp (332): prepareRender
src/MainLoop.cpp (1143): prepare
src/MainLoop.cpp (706): mainLoopStep
src/MainLoop.cpp (412): run
src/Main.cpp (1357): fmain
src/Main.cpp (1379): main
Stack trace logging done
Which seems to happen when you have like probability or random keys on a main sound that has nested sounds:

Code: Select all

crafter_entity.working_sound.main_sounds["foo"] = "bar"
crafter_entity.working_sound.main_sounds.probability = 2
-- crafter_entity.working_sound.main_sounds[1].sound.volume = 2
-- crafter_entity.working_sound.main_sounds[2].sound.volume = 2
Steps to reproduce:
- install this mod (from zip, but its dependencies from the portal)
- /cheat
- place the quality condenser (2nd tab, right of the furnaces)
- place any item in the container (selection box near its edge)
- wait 3 seconds
- crash to desktop
Attachments
energy-condenser-quality-edition_0.0.5.zip
(28.62 MiB) Downloaded 12 times
Donion
Factorio Staff
Factorio Staff
Posts: 347
Joined: Sun Aug 22, 2021 9:18 am
Contact:

Re: [Donion] [2.0.33] Crash with working_sound

Post by Donion »

The issue here is that the working sound is so malformed you end up with an empty sound.

The solution is "don't do that" and define working sound properly. But I will add checks so this abomination won't get through the loading.

Note: probability above or at 1 just makes the sound to loop, you can't overlap them.

Edit: forgot to mention, this:

Code: Select all

crafter_entity.working_sound.main_sounds.probability = 2
is wrong, probability is a property of MainSound, doing this just breaks the main_sounds loading.
I don't even know what this thing:

Code: Select all

crafter_entity.working_sound.main_sounds["foo"] = "bar"
should do ...
User avatar
Quezler
Fast Inserter
Fast Inserter
Posts: 130
Joined: Fri Mar 25, 2016 6:37 pm
Contact:

Re: [Donion] [2.0.33] Crash with working_sound

Post by Quezler »

As i had mentioned i put the probability one level to high, but that was the code i used to get this crash to desktop, and crash to desktops are bad.

The foo bar one was merely there as an extra example to illustrate it wasn't purely probability to blame, but that if it expected nested main sounds that other unexpected keys would crash as well.
Donion
Factorio Staff
Factorio Staff
Posts: 347
Joined: Sun Aug 22, 2021 9:18 am
Contact:

Re: [Donion] [2.0.33] Crash with working_sound

Post by Donion »

Ah, I misunderstood what you meant by one level too high.
I agree, I'm making it not crash as we speak.
Donion
Factorio Staff
Factorio Staff
Posts: 347
Joined: Sun Aug 22, 2021 9:18 am
Contact:

Re: [Donion] [2.0.33] Crash with working_sound

Post by Donion »

This is off topic but .. if you want to have a sound playing multiple times, overlapped, you can just use the same sound to define multiple MainSounds (and possibly use probability to tweak the average number of sounds played and to add more randomness).
Donion
Factorio Staff
Factorio Staff
Posts: 347
Joined: Sun Aug 22, 2021 9:18 am
Contact:

Re: [Donion] [2.0.33] Crash with working_sound

Post by Donion »

In any case, this is fixed for the next release, 2.0.34. Such malformed working sound won't load anymore. Thanks for the report.
Additionally, I added a note in the docs that probability is clamped to the range [0.0, 1.0].
Post Reply

Return to “Resolved for the next release”