Andrettin / Wyrmsun

Strategy game based on history, mythology and fiction
http://andrettin.github.io/
GNU General Public License v2.0
301 stars 47 forks source link

Wyrmsun always end up segfaulting #151

Open ghost opened 7 years ago

ghost commented 7 years ago

Every time I try to play a solo campaign I never get to the end of the match because wyrmsun or its engine segfaults. It's totally reproducible, the dwarven campaign doesn't last more than a minute or two, and the erala campaign lasts maybe five minutes before segfaulting. I don't know what in the game is causing the segfault.

I'm using the git version (regularly updated, I pull and recompile before every test) on debian testing amd64. I haven't tried the stable release but I've had these problems for month already.

Andrettin commented 7 years ago

It unfortunately can happen (rarely) because of the terrain random generation. But restarting through the options menu would solve it.

ghost commented 7 years ago

Without -a and without sounds I was able to complete the mission and continue to play for a while after it, so apparently it doesn't crash in this case.

Andrettin commented 7 years ago

That's good to hear :) So the crashes you were having initially were probably due to the sounds (or something else that was fixed, but sadly I don't think that's likely). The remaining asserts are probably triggered by non-critical issues, which is some relief at least.

ghost commented 7 years ago

So, I've played scenarios a bit again, and here's the situation:

Andrettin commented 7 years ago

Thank you for the further information :)

It's pretty helpful that we have narrowed the issue down to the sounds, but I still am not sure what could be causing this. Maybe the game is using the wrong sound library version when compiling? Perhaps the reason this sound issue doesn't crop up under Windows is because virtually everybody playing it with Windows aren't compiling the game themselves, but use the executable I compile with the proper libraries.

ghost commented 7 years ago

Here is the output of my last dwarven campaign with sounds enabled : ftp://ftp1.rhizogen.es/ac/bugs/wyrmsun/wyrmsun-output.txt

Andrettin commented 7 years ago

Thank you! That's very interesting - all sounds that are giving an error for you have a project rate of 11025 Hz. I increased the rate of those files to 44100, let's see if that prevents them from giving an error.

ghost commented 7 years ago

Hum now I had four segfaults with the dwarven campaign, sounds activated, without any error on the output. Maybe there was two bugs and the one that generated the error message was fixed, and the other one wasn't ?

Andrettin commented 7 years ago

Yes, that's possible. Do you get any asserts if you run the campaign with -a in the command line?

ghost commented 7 years ago

I don't get anything more with -a when it crashes

Andrettin commented 7 years ago

I managed to reproduce a sound error a few days ago (the one which KroArtem reported in another issue). It happened after a very long time playing a map (over an hour), and the error triggered when the step sound was played. It seems to be an error in the way the original engine set up the sounds, but which became much more probable to happen with Wyrmsun since it adds step sounds (which are played whenever a unit moves a tile). I've committed a potential fix to the issue.

ghost commented 7 years ago

Yesterday I was able to finish the dwarven campaign with sounds enabled, but I wanted to do more testing before considering the issue solved. Here is what I got today when it crashed (dwarven campaign, sounds enabled):

Assertion failed at /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/unit/unit.cpp:408: RefsIncrease: Refs && !Destroyed

ghost commented 7 years ago

(also the game freezes when I try to exit from the menu, I have to kill it from the terminal)

Andrettin commented 7 years ago

The issue seems to be that corpse units sometimes aren't entirely removed from the game after their animation ends. It doesn't seem to be causing crashes without -a enabled, though.

Is the freeze when exiting always happening to you now?

ghost commented 7 years ago

Hum, I got a weird bug, I finished a campaign objective (from the objectives list in the top left corner), got a dialog line from a hero and clicking on "continue" didn't do anything : the game kept running but I couldn't use the GUI. I think it's because one of the heroes died at the same time (probably the one that was talking to me).

Andrettin commented 7 years ago

That's possibly the case, yes; which dialogue/objective was that, in particular?

ghost commented 7 years ago

I don't recall

ghost commented 7 years ago

Can a unit die from bleeding ? I remember I had a hero who was very low on health but I garrisoned him in a tower.

Andrettin commented 7 years ago

Yes, but only if the unit has the "Bleeding" status effect (depicted by a blood drop icon).

ghost commented 7 years ago

ok now there's a crash x)

Assertion failed at /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/unit/unit_save.cpp:352: SaveUnit: unit.Resource.Active == 0

ghost commented 7 years ago

That error keeps happening (sounds enabled):

Sound effect error; Index: 235, Voice: -1, Origin: "", Sample Length: 27648, Sample Filename: "../../Wyrmsun/sounds/misc/burning.wav" Assertion failed at /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/sound/sound_server.cpp:244: MixSampleToStereo32: !(index & 1)

ghost commented 7 years ago

Assertion failed at /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/unit/unit.cpp:408: RefsIncrease: Refs && !Destroyed

it seems it's always the same errors that cause crashes

Andrettin commented 7 years ago

Do those crashes also happen without the -a option being used in the command line?

ghost commented 7 years ago

without -a there doesn't seem to be any problem

Ferk commented 5 years ago

Attached is a savegame file from the 4th quest for Earth that causes a crash about a second after it's loaded: game-crash.sav.gz

I tried playing around with the sound/video settings but none affected it. The log file created is not very helpful either (this is in Windows, I don't know if I can get better logs trying it on Linux). log_of_stratagus_0.log

Andrettin commented 5 years ago

@Ferk Thank you for the bug report, and for providing a save game! This looks like a quest-specific issue. I intend to (finally) transpose all "quests" into "scenarios" for the next release. That is, make them use the big Earth/Nidavellir maps, with potential for side-quests and so on. With that being done, those quest-specific issues should disappear.