Open ghost opened 7 years ago
Hello, thanks for the bug report!
Unfortunately I can't reproduce it - does it happen only in the "Scenario" mode, or also in custom games? Do you get any kind of output related to the issue?
Here is what I get for the dwarven campaign (this one didn't last long, I just had the time to build the hall). I skipped the repeated lines.
libpng warning: iCCP: known incorrect sRGB profile libpng warning: Interlace handling should be turned on when using png_read_image libpng warning: iCCP: known incorrect sRGB profile Mouse viewport pointer is NULL. [...] Mouse viewport pointer is NULL. zsh: segmentation fault ./stratagus -d ../../Wyrmsun
Tried the Erala campaign. this one didn't last long either, (it crashed before I could create a hall) :
libpng warning: iCCP: known incorrect sRGB profile libpng warning: Interlace handling should be turned on when using png_read_image libpng warning: iCCP: known incorrect sRGB profile zsh: segmentation fault ./stratagus -d ../../Wyrmsun
I think the libpng warnings appear during the loading screen so there's probably no information on the segfault here. This is strange because just before, I tried the erala campaign and I managed to build a small economy and train my five eralas. The output was like this :
BUG: RangeTargetFinder::FillBadGood.Compute out of range. size: 26, pos: -2, x: 11, xx: 0, y: -1, yy: 0BUG: RangeTargetFinder::FillBadGood.Compute out of range. size: 26, pos: -7, x: 6, xx: 0, y: -1, yy: 0BUG: RangeTargetFinder::FillBadGood.Compute out of range. size: 26, pos: -2, x: 11, xx: 0, y: -1, yy: 0BUG: RangeTargetFinder::FillBadGood.Compute out of range. size: 26, pos: -7, x: 6, xx: 0, y: -1, yy: 0BUG: RangeTargetFinder::FillBadGood.Compute out of range. size: 26, pos: -4, x: 9, xx: 0, y: -1, yy: 0BUG: RangeTargetFinder::FillBadGood.Compute out of range. size: 26, pos: -2, x: 11, xx: 0, y: -1, yy: 0BUG: RangeTargetFinder::FillBadGood.Compute out of range. size: 26, pos: -7, x: 6, xx: 0, y: -1, yy: 0BUG: RangeTargetFinder::FillBadGood.Compute out of range. size: 26, pos: -16, x: 10, xx: 0, y: -2, yy: 0BUG: RangeTargetFinder::FillBadGood.Compute out of range. size: 26, pos: -3zsh: segmentation fault ./stratagus -d ../../Wyrmsun
(I've cut it, it seemed repetitive and my terminal hisotyr couldn't display it all anyway)
I've tried clicking on "grand strategy game" in the main menu. The game segfaults immediately.
With a custom game I was able to go very far, advance through ages and build an army. But the game crashed as I was destroying the enemy.
Thanks :) I think it could be a memory issue. That would fit both with it happening much earlier in Scenario maps (which are four times larger than usual custom game maps), and with it occurring at an advanced time in a custom game. I have something in mind to reduce memory usage, which I'm trying right now.
I've made an update to the map template system now which reduced memory usage, but not by as much as I'd hoped. If memory usage is indeed the problem, then it will likely take more than that.
Finishing the phasing out of the dynamic skin color and hair color systems (which didn't live up to expectation anyhow) would likely help significantly, so I'll look into that.
I was going to answer that wyrmsun's got a weird resource consumption, with it taking a long time to start and pushing one CPU at 100% when starting, but actually, it seems that you've fixed that out ! it still pushes one CPU at 100% when starting a game, but phase now seems to be much shorter than before. At the beginning of a match there's still a bit of lag (like the game "pausing" for a second, a couple of times), but it's not that annoying.
Anyway, thanks for your fix, now I can finally discover the game ! ;)
Actually, I just tried the Erala campaign, it still segfaults later in the game.
I've now removed the skin color conversion system, which was slated for being phased out; it was only used by the gnomes, and it wasn't working as well as expected, since the automatic recolors turned out perceptibly less well than manual ones. After overhauling the code and replacing the automatic color conversion for the gnomes with manual recolors, thankfully that has resulted in a MAJOR improvement in memory usage. Testing here, the game has gone from using c. 550 MB after being started, to about 255 MB. After starting a scenario, previously about 850-900 MB were needed, now it's around 430 MB.
This change may very well fix the issue you were facing, let me know if the crashes are gone now :)
Regarding the pausing, in which map did it happen? If it was in a larger map (like the scenario mode ones), it could be due to many workers looking for resources at the same time when the game starts. If it happens later in the game, it could be another pathfinding-related issue.
Well I've recompiled and tried the dwarven campaign again twice, and it segfaulted again after a few seconds of gameplay. Are you sure memory usage is the culprit there ? I have 12 GiB of RAM and I never went above the 30% mark during my tests.
No, I just thought of it being as memory issue as a possibility... but I have some good news! I managed to reproduce a crash here, which is now fixed: https://github.com/Andrettin/Wyrmsun/commit/3f9bc998fb3d48c26c3605208a106e699563689b
I'm not sure if that's the crash you were having, though, since it was a bug introduced with the new religion system, which was implemented about a week ago, rather than a month.
I've tried the dwarven campaign again, I went quite far (I was able to build a small city and train an army) but the game segfaulted again after a series of "Mouse viewport pointer is NULL." on the console.
In the Erala campaign I was able to expand, reach my population limit, and destroy the south (Karlings ?) enemy before the game crashed.
Hmm =/ I wonder what the problem can be, in that case... the output doesn't tell enough to know the cause of the crash. If you could run a debug build, that would be very helpful, and then more descriptive output would come out.
How do I run a debug build ?
You would need to compile a debug build (that is, having the -DDEBUG option set to ON). Doing that might be a bit complicated if you haven't done it before, though.
Another thing you could try is using the following command line options: "-a -p"
This will enable asserts and extended debug output printing.
I've compiled a debug build and now the dwarven campaign crashes at startup. The last lines displayed on the terminal are:
/mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/stratagus/script.cpp:233: LuaLoadFile: Loading '../../Wyrmsun/scripts/civilizations/troll/ui.lua' /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/ui/script_ui.cpp:607: CclDefinePanelContents: Redefinition of Panel 'panel-general-contents' /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/ui/script_ui.cpp:607: CclDefinePanelContents: Redefinition of Panel 'panel-building-contents' /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/ui/script_ui.cpp:607: CclDefinePanelContents: Redefinition of Panel 'panel-center-contents' /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/ui/script_ui.cpp:607: CclDefinePanelContents: Redefinition of Panel 'panel-resimrove-contents' /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/ui/script_ui.cpp:607: CclDefinePanelContents: Redefinition of Panel 'panel-all-unit-contents' /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/ui/script_ui.cpp:607: CclDefinePanelContents: Redefinition of Panel 'panel-attack-unit-contents' /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/stratagus/script.cpp:233: LuaLoadFile: Loading '../../Wyrmsun/scripts/civilizations/dwarf/ui.lua' /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/unit/upgrade.cpp:225: Get: upgrade not found: /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/unit/upgrade.cpp:225: Get: upgrade not found: upgrade-tribe /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/unit/upgrade.cpp:1158: UpgradeIdByIdent: fix this upgrade-tribe /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/unit/upgrade.cpp:225: Get: upgrade not found: /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/unit/upgrade.cpp:225: Get: upgrade not found: upgrade-tribe /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/unit/upgrade.cpp:1158: UpgradeIdByIdent: fix this upgrade-tribe /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/unit/upgrade.cpp:225: Get: upgrade not found: /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/unit/upgrade.cpp:225: Get: upgrade not found: upgrade-tribe /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/unit/upgrade.cpp:1158: UpgradeIdByIdent: fix this upgrade-tribe /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/unit/upgrade.cpp:225: Get: upgrade not found: /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/unit/upgrade.cpp:225: Get: upgrade not found: upgrade-tribe /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/unit/upgrade.cpp:1158: UpgradeIdByIdent: fix this upgrade-tribe /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/unit/upgrade.cpp:225: Get: upgrade not found: /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/unit/upgrade.cpp:225: Get: upgrade not found: upgrade-tribe /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/unit/upgrade.cpp:1158: UpgradeIdByIdent: fix this upgrade-tribe /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/unit/upgrade.cpp:225: Get: upgrade not found: /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/unit/upgrade.cpp:225: Get: upgrade not found: upgrade-tribe /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/unit/upgrade.cpp:1158: UpgradeIdByIdent: fix this upgrade-tribe /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/unit/upgrade.cpp:225: Get: upgrade not found: /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/unit/upgrade.cpp:225: Get: upgrade not found: upgrade-tribe /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/unit/upgrade.cpp:1158: UpgradeIdByIdent: fix this upgrade-tribe /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/unit/upgrade.cpp:225: Get: upgrade not found: /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/unit/upgrade.cpp:225: Get: upgrade not found: upgrade-tribe /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/unit/upgrade.cpp:1158: UpgradeIdByIdent: fix this upgrade-tribe /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/unit/upgrade.cpp:225: Get: upgrade not found: Assertion failed at /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/video/graphic.cpp:1268: New: (w == 0 || g->Width == w) && (g->Height == h || h == 0)
zsh: abort ./stratagus -a -p -d ../../Wyrmsun
Thank you! :) That error was due to a slight error in the round_shield.png size (it should be 14x14, but was 13x13). It's fixed now with the latest commit.
That was likely not the cause of the other crashes you were having before, but now the dwarven scenario should start normally.
Trying again, crashes after a few seconds of gameplay:
/mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/action/action_build.cpp:387: HelpBuild: 0: Worker [100] is helping build: Mead Hall [1233] Assertion failed at /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/sound/sound_server.cpp:241: MixSampleToStereo32: !(index & 1)
Thanks! Unfortunately I cannot reproduce that.
@KroArtem Maybe that's linked to the sound issue you had reported?
It might be a Linux-specific issue, since it doesn't seem to be happening on Windows. Maybe it's due to this part of the code:
#ifdef USE_WIN32
if (SDL_CondWaitTimeout(Audio.Cond, Audio.Lock, 1000) == 0) {
#else
if (SDL_CondWaitTimeout(Audio.Cond, Audio.Lock, 100) == 0) {
#endif
Alternatively, it could somehow be due to an OAML issue with Linux...
I've made that part of the code work the same on Linux as it does on Windows now, with the latest Wyrmgus commit. Does that fix the issue?
it doesn't :
Assertion failed at /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/sound/sound_server.cpp:241: MixSampleToStereo32: !(index & 1)
A few questions:
This is the error I get when the game crashes while the sounds are deactivated :
Assertion failed at /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/unit/unit_find.cpp:1292: Compute: x >= 0 && y >= 0
Thank you! This should fix that issue with unit_find.cpp: https://github.com/Andrettin/Wyrmgus/commit/07b433f6fda6d22606aa18395720e46e241dd359
By the way, how should I credit you in the game's "Testing" section? As "libregametester"?
Wow I didn't even know testers were going to be credited, but if you want, yeah, "libregametester" would do it.
Have you found what was wrong with the sounds ?
Done :)
About the sounds, unfortunately not yet. What I've done now is to make a bit more output be produced when that error occurs, so that more about it can be known (since I can't reproduce it here): https://github.com/Andrettin/Wyrmgus/commit/cb09ef9343641a3a54c9c797c06563ef4e04694e
Edit: that ALSA problem and the sound server related crash are probably not related actually
Well actually I got that problem again when running the game with music. The music had noises while playing, doing some sort of a very "pop" noise every fraction of a second (or maybe it was just not playing for a fraction of a second, making it sound like this). Every time this happens a
ALSA lib pcm.c:8306:(snd_pcm_recover) underrun occurred
is displayed on the console. It already happened before, but this time it was happening every half or quarter of a second, resulting in some really screwed up music (mixed with a "pppppppppppppppppppp" noise), and a flood of the previous message on the console.
The game crashed after a few seconds with the following message:
Sound effect error; Index: 235, Voice: -1, Origin: "" Assertion failed at /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/sound/sound_server.cpp:244: MixSampleToStereo32: !(index & 1)
I launched the game again and there was no sound problem, so this seems to happen randomly. I'll investigate again.
Ok, I've run the game without music and without sound again. It crashed late in the game with the following message:
Assertion failed at /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/unit/unit.cpp:553: Release: Orders.size() == 1
I'll continue my investigations on the music/sound the evening or tomorrow.
Well I had
Assertion failed at /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/sound/sound_server.cpp:244: MixSampleToStereo32: !(index & 1)
again without any occurrence of
ALSA lib pcm.c:8306:(snd_pcm_recover) underrun occurred
so I guess those issues are independent.
I'm starting to think this might be related to my special audio setup.
I have an external audio card plugged to my computer via USB. To force the operating system to use this card, I had to prevent any other card from being loaded and considered the default, by creating two files in /etc/modprobe.d/ .
In /etc/modprobe.d/alsa-base-blacklist.conf I have:
blacklist snd_hda_intel
In /etc/modprobe.d/alsa-base.conf I have:
install sound-slot-0 modprobe snd-card-0 install sound-slot-1 modprobe snd-card-1 install sound-slot-2 modprobe snd-card-2
options snd_hda_intel enable=1 index=-1 options snd_hda_intel enable=1 index=-2 options snd_usb_audio enable=1 index=-3
(I think only the first one matters, the second one might be some residual configuration that didn't work, actually)
Anyway, the operating system knows only one card at boot, it's the USB one. I'll try Wyrmsun without that USB card, see if it changes anything.
Hmm, that could be the issue. Another player reported sound crashes before, though, but that may be unrelated (and they seemed much less frequent with him).
The Release: Orders.size() == 1 issue may not be what is causing a crash in normal games (despite triggering the assert when the -a command line option is enabled), as the orders are just cleared afterwards. Though it is something strange, as "dead" unit that is being freed from memory should have exactly one "still" order.
Ok now with sounds I get crashes without any debug message.
Without sound it still crashes later in the game with the Release: Orders.size() message.
Hmm =/ Doesn't the debug build give you a stack trace?
Sound effect error; Index: 235, Voice: -1, Origin: "" Assertion failed at /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/sound/sound_server.cpp:244: MixSampleToStereo32: !(index & 1)
Sometimes I get this, sometimes I get no error message at the end of the output. But this kind of crash only seems to happen when there's sound, without sound it's the Release: Orders.size() crash.
@Andrettin, I'm not sure it's related, I had problems on two different PCs with integrated audio, no "special audio setup".
I couldn't reproduce the Orders.size() issue, so I made the game produce a bit more output when that happens: https://github.com/Andrettin/Wyrmgus/commit/0da99965d013c9aa9866de0c982abb3291372c20
@KroArtem It seems like the bug is persisting with him even when not using the special audio setup, so it could be the same issue... maybe.
I've updated to the latest OAML now with Akien's help, as I've posted in the other issue; hopefully that will do something (though that seems unlikely, as the error seems to have to do with sound effects instead).
Ok, I've tested again without the external audio card and without the blacklist file, I can confirm the problem persists and is not related to the sound card. I can also confirm the crash doesn't happen when the music is playing but the sounds effects are not, so it's probably related to the sound effect code.
I've played the dwarven campaign again, with music and no sound effects, went quite far and built a big army until the game crashed:
Unit to be released has more than 1 order; Unit Type: "unit-dwarven-dead-body", Orders: 2, First Order Type: 11. Assertion failed at /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/unit/unit.cpp:558: Release: Orders.size() == 1
I also experienced some huge slowdown at a moment, I think it was because of two AIs fighting each other. The lags I experience do not seem related to the number of units I have or to the pathfinder. I think the game lags whenever a fight is happening (at least in solo mode).
Thank you! That was quite helpful, I believe I was able to fix the release issue now with the latest commit to Wyrmgus: https://github.com/Andrettin/Wyrmgus/commit/514273cdf41fadc9d7d3c9e9c38c1a97155f6a88
I also made a change that may help with the slowdown. It happens because of too many AI units trying to get to an enemy, but not finding a path (because another AI unit is on their way).
I have to go now, but when I'm back I'll look into making more output be produced about the sound issue.
Ok, played the dwarven campaign without sound, went quite far, lost the quest but continued anyway, and during a big fight it crashed with :
Assertion failed at /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/stratagus/player.cpp:1792: RemoveUnit: this->Units[unit.PlayerSlot] == &unit
Thanks!
Hmm, strange, it seems like a unit is being removed twice from the player's Units array. I've made it so more output is produced for that, so that we get a better grasp of why it is happening.
I had added a bit more of output for the sound error yesterday, and today I've added more as well.
dwarven campaign, with sounds:
Sound effect error; Index: 235, Voice: -1, Origin: "", Sample Length: 2335, Sample Filename: "../../Wyrmsun/sounds/ui/placement_success.wav" Assertion failed at /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/sound/sound_server.cpp:244: MixSampleToStereo32: !(index & 1)
Yeah generally it happens when I try to build the mead hall. But I don't think it's the only case.
without sound, a crash during the dwarven campaing:
/mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/stratagus/player.cpp:1184: Save: FIXME: must save unit-stats? [...] /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/stratagus/player.cpp:1184: Save: FIXME: must save unit-stats? Assertion failed at /mnt/ac/games2test/amd64/wyrmsun/wyrmsun-git/Wyrmgus/src/unit/unit_save.cpp:345: SaveUnit: unit.Resource.Active == 0
(the first two lines appeared like 30 times)
Which Lua version did you use to compile? It might be an error somehow related to the sound's definition.
Apparently I've got several luad versions on my system, I don't know which one the compiler picks:
# aptitude versions ~iliblua
Paquet liblua5.1-0 :
i 5.1.5-8.1+b2 testing,unstable 990
Paquet liblua5.1-0-dev :
i 5.1.5-8.1+b2 testing,unstable 990
Paquet liblua5.1-0:i386 :
i A 5.1.5-8.1+b2 testing,unstable 990
[...]
Paquet liblua5.2-0 :
i 5.2.4-1.1+b1 testing,unstable 990
Paquet liblua5.2-dev :
i 5.2.4-1.1+b1 testing,unstable 990
Paquet liblua5.3-0 :
i 5.3.3-1 testing,unstable 990
Paquet liblua5.3-dev :
i 5.3.3-1 testing,unstable 990
Paquet liblua50 :
i 5.0.3-8+b1 testing,unstable 990
Paquet liblua50-dev :
i 5.0.3-8+b1 testing,unstable 990
Paquet liblualib50 :
i 5.0.3-8+b1 testing,unstable 990
The 5.1-0 ones should work (and be picked correctly by the game). The package I use for the Linux releases is "liblua5.1-devel".
I wonder what the "+b2" is there, though. Either way, the Lua package looks correct, and seems unlikely to me to be the source of the issue.
the numbers that come after the hyphen are the debian package version number, it shouldn't matter
Ah, okay, so the Lua package is most likely working fine for the game.
By the way, if you play the game without the "-a" command line option, and without sounds, does it still crash?
is it normal to get this when restarting the campaign ? o_O http://pix.toile-libre.org/upload/original/1487686811.png "end mission" -> "restart mission"
Edit: ok I guess the map is regenerated differently when restarting
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.