VCMI 0.94d -- development version (r3728)

That’s RoE, Song for the Father campaign, mission 2: United front.

Not reproducible for me after 3 tests so please copy this to bugtracker so it won’t be lost. I also noticed one weird detail that may be related - bonus stack may be given to a different heroes. Perhaps client gave it to one hero and server gave it to another?

Nobody of heroes had these elves during battles, but indeed this crash happened when I tried to replace units related to another hero, not those who had elves in inventory.

Another crash during AI’s turn:

Player 5 starting turn
Striving to goal of type WIN
Considering goal WIN
Considering goal CONQUER
Considering goal EXPLORE
Looking for an another place for exploration...
Choosing abstract goal EXPLORE (Îðèñ)
Striving to goal of type EXPLORE (Îðèñ)
Considering goal EXPLORE (Îðèñ)
Considering goal VISIT TILE (20 61 0) (Îðèñ)
Trying to realize VISIT TILE (20 61 0) (Îðèñ) (value 4.000)
Moving hero Îðèñ to tile 20 61 0
Hero Îðèñ moved from 19 62 0 to 20 61 0. Returning 1.
Hero Îðèñ visited tile (20 61 0)
Striving to goal of type EXPLORE (Îðèñ)
Considering goal EXPLORE (Îðèñ)
Considering goal VISIT TILE (21 60 0) (Îðèñ)
Trying to realize VISIT TILE (21 60 0) (Îðèñ) (value 4.000)
Moving hero Îðèñ to tile 21 60 0
Hero Îðèñ moved from 20 61 0 to 21 60 0. Returning 1.
Hero Îðèñ visited tile (21 60 0)
Striving to goal of type EXPLORE (Îðèñ)
Considering goal EXPLORE (Îðèñ)
Considering goal VISIT TILE (22 60 0) (Îðèñ)
Trying to realize VISIT TILE (22 60 0) (Îðèñ) (value 4.000)
Moving hero Îðèñ to tile 22 60 0
Hero Îðèñ moved from 21 60 0 to 22 60 0. Returning 1.
Hero Îðèñ visited tile (22 60 0)
Striving to goal of type EXPLORE (Îðèñ)
Considering goal EXPLORE (Îðèñ)
Looking for an another place for exploration...
Considering goal VISIT TILE (11 73 0) (Îðèñ)
Trying to realize VISIT TILE (11 73 0) (Îðèñ) (value 3.974)
Moving hero Îðèñ to tile 11 73 0
Hero Îðèñ moved from 22 60 0 to 14 66 0. Returning 0.
Striving to goal of type EXPLORE (Îðèñ)
Considering goal EXPLORE (Îðèñ)
Considering goal VISIT TILE (15 67 0) (Îðèñ)
Trying to realize VISIT TILE (15 67 0) (Îðèñ) (value 2.321)
Failed to realize subgoal of type VISIT TILE (15 67 0) (Îðèñ) (greater goal type was EXPLORE (Îðèñ)), I will stop.
The error message was: Cannot visit tile: hero is out of MPs!
Cannot evaluate goal VISIT TILE (38 41 0) (Ñåïòèííà)
Striving to goal of type VISIT TILE (38 41 0) (Ñåïòèííà)
Considering goal VISIT TILE (38 41 0) (Ñåïòèííà)
Considering goal 32767

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffdd5f6700 (LWP 12959)]
0x00007fffdeb2bf2d in VCAI::striveToGoalInternal (
    this=this@entry=0x7fffcdca3518, ultimateGoal=..., 
    onlyAbstract=onlyAbstract@entry=false)
    at /build/buildd/vcmi-0.94+svn3438~ubuntu13.10.1/AI/VCAI/VCAI.cpp:1918
1918	/build/buildd/vcmi-0.94+svn3438~ubuntu13.10.1/AI/VCAI/VCAI.cpp: Нет такого файла или каталога.
(gdb) bt
#0  0x00007fffdeb2bf2d in VCAI::striveToGoalInternal (
    this=this@entry=0x7fffcdca3518, ultimateGoal=..., 
    onlyAbstract=onlyAbstract@entry=false)
    at /build/buildd/vcmi-0.94+svn3438~ubuntu13.10.1/AI/VCAI/VCAI.cpp:1918
#1  0x00007fffdeb2cb39 in VCAI::striveToGoal (this=this@entry=0x7fffcdca3518, 
    ultimateGoal=...)
    at /build/buildd/vcmi-0.94+svn3438~ubuntu13.10.1/AI/VCAI/VCAI.cpp:1891
#2  0x00007fffdeb3cd29 in VCAI::makeTurnInternal (
    this=this@entry=0x7fffcdca3518)
    at /build/buildd/vcmi-0.94+svn3438~ubuntu13.10.1/AI/VCAI/VCAI.cpp:755
#3  0x00007fffdeb3ddfd in VCAI::makeTurn (this=0x7fffcdca3518)
    at /build/buildd/vcmi-0.94+svn3438~ubuntu13.10.1/AI/VCAI/VCAI.cpp:676
#4  0x00007ffff6ddb94a in ?? ()
   from /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.53.0
#5  0x00007ffff6bbaf6e in start_thread (arg=0x7fffdd5f6700)
    at pthread_create.c:311
#6  0x00007ffff40af9cd in clone ()
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

Considering goal 32767 ??

Was this a game loaded from a savegame or a new one?

32767 is -1, which means invalid goal. It does exist, but should never be considered for execution. Need to reproduce it with debugger to tell how this happened.

Also, you may want to use English language version so hero names are displayed properly.
This, or logging system doesn’t work with another languages.

Loaded from a savegame.

Reproduced. Just finish turn in order to reproduce the crash.
Games.tar.gz (705 KB)

I have observed that AI often ends up in the corrupt state after loading the game. It is caused because AI stores goals using shared_ptr’s and serialzier doesn’t provide proper support for them.
Serializing two shared_ptr pointing to the same object won’t properly recreate their shared state and the object will be destructed after destruction of any of the pointers (the other one will be dangling and will cause crash on destruction).

PS.
I plan to release next development build tomorrow evening.

Another crash at the end of a mission. I suppose I had to kill all these dragons in the dungeons, the last one decided not to fight with me and the game crashed.

System message: Game has been saved as Saves/Autosave_2
removing object id=1672; address=140736086914016; name=Ìàëî Gold Dragons

 Threat: Effortless
Error: server failed to close correctly or crashed!
Check /home/kroartem/.vcmi/server_log.txt for more info
Lost connection to server, ending listening thread!
read: End of file
Something wrong, lost connection while game is still ongoing...
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> >'
  what():  read: End of file

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffdd5f6700 (LWP 23527)]
0x00007ffff3febf77 in __GI_raise (sig=sig@entry=6)
    at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
56	../nptl/sysdeps/unix/sysv/linux/raise.c: Нет такого файла или каталога.
(gdb) bt
#0  0x00007ffff3febf77 in __GI_raise (sig=sig@entry=6)
    at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x00007ffff3fef5e8 in __GI_abort () at abort.c:90
#2  0x00007ffff48f76e5 in __gnu_cxx::__verbose_terminate_handler() ()
   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007ffff48f5856 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4  0x00007ffff48f5883 in std::terminate() ()
   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5  0x00007ffff48f5af6 in __cxa_rethrow ()
   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x00000000005bec25 in CClient::run (this=<optimized out>)
    at /build/buildd/vcmi-0.94+svn3440~ubuntu13.10.1/client/Client.cpp:161
#7  0x00007ffff6ddb94a in ?? ()
   from /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.53.0
#8  0x00007ffff6bbaf6e in start_thread (arg=0x7fffdd5f6700)
    at pthread_create.c:311
#9  0x00007ffff40af9cd in clone ()
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113
(gdb) 

RoA, 2 campaign, 1 mission (evil plan)

This is the mission where you need to kill all gold dragons? In this case - bug is already fixed, just wait for new build on launchpad. There was crashbug on defeating creature that is target of “destroy monster” condition.

Oh - and if game crashes with messages like these:

Error: server failed to close correctly or crashed! 
 Check /home/kroartem/.vcmi/server_log.txt for more info 
 Lost connection to server, ending listening thread! 
 read: End of file 
 Something wrong, lost connection while game is still ongoing...

Tail of server log is much more useful than output of gdb (here crash happens on server, not on client)

Thanks, will wait for new build. Actually I was going to post piece of server.log, just forgot about it. :slight_smile: