Crash during battle

I had a crash yesterday during a battle. It was a stack of Dread Knights attacking my stack of Jabberwocks (Courtyard mod). Not sure what the reason was.

Console:
Battle AI best: vampireLord -> courtyard:gildedHomunculus at 137 from 138, affects 1 units: 206 0 0 0
Battle AI best: dreadKnight -> courtyard:monstrousJabberwock at 3 from 4, affects 1 units: 600 10680 0 0
Error: signal 11 :
./vcmiserver(+0x119ec2) [0x55d09f855ec2]
/lib/x86_64-linux-gnu/libc.so.6(+0x46210) [0x7fbf39a3c210]
/home/siegfried/prj/vcmi/build/bin/libvcmi.so(_ZNK16CBonusSystemNode10getParentsERSt3setIPKS_St4lessIS2_ESaIS2_EE+0x34) [0x7fbf3a7a6a34]
/home/siegfried/prj/vcmi/build/bin/libvcmi.so(_ZNK16CBonusSystemNode16getAllBonusesRecER9BonusList+0x81) [0x7fbf3a7ad3d1]
/home/siegfried/prj/vcmi/build/bin/libvcmi.so(ZNK16CBonusSystemNode27getAllBonusesWithoutCachingERK9CSelectorS2_PKS+0xae) [0x7fbf3a7ad6ce]
/home/siegfried/prj/vcmi/build/bin/libvcmi.so(_ZNK16CBonusSystemNode13getAllBonusesERK9CSelectorS2_PKS_RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x4d) [0x7fbf3a7b124d]
./vcmiserver(+0x73305) [0x55d09f7af305]
./vcmiserver(+0x5edd4) [0x55d09f79add4]
./vcmiserver(+0x127b2c) [0x55d09f863b2c]
/usr/lib/x86_64-linux-gnu/libboost_thread.so.1.71.0(+0x1143b) [0x7fbf39f6943b]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x9609) [0x7fbf39f3e609]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x43) [0x7fbf39b18293]
Speicherzugriffsfehler (Speicherabzug geschrieben)

Log:
ERROR global [7fbf366a6700] - Error: signal 11 :
ERROR global [7fbf366a6700] - ./vcmiserver(+0x119ec2) [0x55d09f855ec2]
ERROR global [7fbf366a6700] - /lib/x86_64-linux-gnu/libc.so.6(+0x46210) [0x7fbf39a3c210]
ERROR global [7fbf366a6700] - /home/siegfried/prj/vcmi/build/bin/libvcmi.so(_ZNK16CBonusSystemNode10getParentsERSt3setIPKS_St4lessIS2_ESaIS2_EE+0x34) [0x7fbf3a7a6a34]
ERROR global [7fbf366a6700] - /home/siegfried/prj/vcmi/build/bin/libvcmi.so(_ZNK16CBonusSystemNode16getAllBonusesRecER9BonusList+0x81) [0x7fbf3a7ad3d1]
ERROR global [7fbf366a6700] - /home/siegfried/prj/vcmi/build/bin/libvcmi.so(ZNK16CBonusSystemNode27getAllBonusesWithoutCachingERK9CSelectorS2_PKS+0xae) [0x7fbf3a7ad6ce]
ERROR global [7fbf366a6700] - /home/siegfried/prj/vcmi/build/bin/libvcmi.so(_ZNK16CBonusSystemNode13getAllBonusesERK9CSelectorS2_PKS_RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x4d) [0x7fbf3a7b124d]
ERROR global [7fbf366a6700] - ./vcmiserver(+0x73305) [0x55d09f7af305]
ERROR global [7fbf366a6700] - ./vcmiserver(+0x5edd4) [0x55d09f79add4]
ERROR global [7fbf366a6700] - ./vcmiserver(+0x127b2c) [0x55d09f863b2c]
ERROR global [7fbf366a6700] - /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.71.0(+0x1143b) [0x7fbf39f6943b]
ERROR global [7fbf366a6700] - /lib/x86_64-linux-gnu/libpthread.so.0(+0x9609) [0x7fbf39f3e609]
ERROR global [7fbf366a6700] - /lib/x86_64-linux-gnu/libc.so.6(clone+0

Seems to be a crash in the server.

VCMI is full of memory leaks and non-repeatable crashes…

Interesting. Bonuses again. Linux has a separate server process, right?

Right. Separate server process. And i got another one:

Console:
/home/siegfried/prj/vcmi/build/bin/libvcmi.so(ZNK9BonusList10getBonusesERS_RK9CSelectorS3+0x12) [0x7f937fb69732]
/home/siegfried/prj/vcmi/build/bin/libvcmi.so(_ZN16CBonusSystemNode13removeBonusesERK9CSelector+0x4d) [0x7f937fb73ddd]
/home/siegfried/prj/vcmi/build/bin/libvcmi.so(_ZN16CBonusSystemNode22removeBonusesRecursiveERK9CSelector+0x13) [0x7f937fb73f13]
/home/siegfried/prj/vcmi/build/bin/libvcmi.so(_ZN12BattleAttack7applyGsEP10CGameState+0xa5) [0x7f937fbba7f5]
/home/siegfried/prj/vcmi/build/bin/libvcmi.so(+0x6e9924) [0x7f937fb06924]
/home/siegfried/prj/vcmi/build/bin/libvcmi.so(_ZN10CGameState5applyEP5CPack+0xfb) [0x7f937faf2c7b]
./vcmiserver(+0x7d646) [0x5578bf313646]
./vcmiserver(+0x97511) [0x5578bf32d511]
./vcmiserver(+0x9b2a9) [0x5578bf3312a9]
./vcmiserver(+0x159e5c) [0x5578bf3efe5c]
./vcmiserver(+0xa055d) [0x5578bf33655d]
./vcmiserver(+0x81f3d) [0x5578bf317f3d]
./vcmiserver(+0x11983a) [0x5578bf3af83a]
./vcmiserver(+0x127b2c) [0x5578bf3bdb2c]
/usr/lib/x86_64-linux-gnu/libboost_thread.so.1.71.0(+0x1143b) [0x7f937f32743b]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x9609) [0x7f937f2fc609]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x43) [0x7f937eed6293]
Speicherzugriffsfehler (Speicherabzug geschrieben)

Log:
TRACE network [7f937ba64700] - Sending to all clients: 12BattleAttack
TRACE network [7f937ba64700] - Sending a pack of type 12BattleAttack
ERROR global [7f937ba64700] - Error: signal 11 :
ERROR global [7f937ba64700] - ./vcmiserver(+0x119ec2) [0x5578bf3afec2]
ERROR global [7f937ba64700] - /lib/x86_64-linux-gnu/libc.so.6(+0x46210) [0x7f937edfa210]
ERROR global [7f937ba64700] - /home/siegfried/prj/vcmi/build/bin/libvcmi.so(ZNK9BonusList10getBonusesERS_RK9CSelectorS3+0x12) [0x7f937fb69732]
ERROR global [7f937ba64700] - /home/siegfried/prj/vcmi/build/bin/libvcmi.so(_ZN16CBonusSystemNode13removeBonusesERK9CSelector+0x4d) [0x7f937fb73ddd]
ERROR global [7f937ba64700] - /home/siegfried/prj/vcmi/build/bin/libvcmi.so(_ZN16CBonusSystemNode22removeBonusesRecursiveERK9CSelector+0x13) [0x7f937fb73f13]
ERROR global [7f937ba64700] - /home/siegfried/prj/vcmi/build/bin/libvcmi.so(_ZN12BattleAttack7applyGsEP10CGameState+0xa5) [0x7f937fbba7f5]
ERROR global [7f937ba64700] - /home/siegfried/prj/vcmi/build/bin/libvcmi.so(+0x6e9924) [0x7f937fb06924]
ERROR global [7f937ba64700] - /home/sieg

Seems to be bonus system indeed :slight_smile:
If anyone interested: I have now finished a very big map with several factions with random towns, so it is possible to play the new factions. Green player is meant to be played by human, but i made most of the other players playable by human too, for testing purposes. Except player red, which is just meant as decoration and for the story.
Blue: Swamp faction. Should be cove, but any other swamp faction will do too. Necessary: Option to build shipyard.
Tan: Desert faction. I used Pavillon.
Green: Grass faction. Could be Castle or Rampart. Nice: Courtyard.
Orange: Stronghold. No random castles.
Purple: Another grass faction. Cathedral fits nice too.
Teal: Snow faction. Could be tower or any other snow faction. Try Northerners or Bastille.
Pink: Necromancers. No random castles.

The map is big enough for a whole weekend to play. And it is big enough to run into any possible bug :slight_smile: or to test AI bugs or oddities. I think the map is technically finished now. It could benefit from more decorations, especially Freds Objects. But i don’t know how to integrate them into the editor.
C012.h3m (162.1 KB)

There were mods with configured Fred’s objects mods - Macron1’s and mine. But it was long before first map editor releases (some Fred’s objects are in Tide of war mod, HotA mod brings some decorations). The main problem is - the more decorations we can incorporate into vcmi, the more random maps look uglier.

Well, that’s the reason why i prefere hand made maps :slight_smile:

It should be no problem to exclude these objects from ranfom maps though. Just disable mod in launcher.

Mod must be enabled to play custom maps with new objects, so there’s more safer solution - mark new objects as “handler” : “generic”. In such form objects won’t be included in RMG objects pool.

Good hint. Didn’t know that. But just disabling them before playing a random map would do too. These kind of objects are mostly meant for hand made maps, where a map designer places them so that they look good. For random maps these objects are mostly useless. :slight_smile:

If you want, you can check old version of Fred’s objects mod. Maybe someday I’ll return to it/

Ah, that’s the vcmi mod. I have this. But i’m not using the vcmi editor. Don’t know how to build that for linux. So i would have to integrate these objects into standard editor (resp. “unleashed” editor).

I’m afraid that VCMI won’t recognize graphics/handlers placed with non-vcmi editor without vcmi mod. Similarly, WoG maps made in WoG editor won’t work in vcmi without vcmi-wog mod.

Hope it is x64 build. Your own, right? Latest develop?
I plan to fix one bonus system issue during battle but it is on client side.

Yes, Linux 64 bit self built. I have current Ubuntu (xfce desktop), and there is no .deb package for it, only for older vcmi builds. So i built it myself.

I built it last saturday. I do a weekly fresh build.

The problems all seem to be a null pointer issue. If that helps :slight_smile:

I just had another crash. This time was the reason the spell casting of an experienced stack of Liches, as i already wrote in Mantis https://bugs.vcmi.eu/my_view_page.php

The quite big stack of Liches where about to attack a small weak stack. Before the attack takes place, they cast death ripple. That death ripple just killed every enemy stack, nothing remained. Then the original attack took place and targeted a dead stack. Crash.

I assume this is a pointer issue too. I think, a stack, that is killed, is removed. The memory is freed. Now the subsequent original attack uses a pointer to a now invalid memory area. So it is not a null pointer but an invalid pointer. Perhaps best would be to not remove killed stacks until end of battle.

But that’s just an assumption.

Ah, and since i’m already on it: There is another crash. I had a hero with Boots of Levitation and was walking over water. During that walk, while over water, i accidentially hit the mouse button. That normally stops the movement. Stopping here crashed the game. This is not such a big issue, because you can avoid it, but nevertheless it is a crash :slight_smile: