VCMI 0.94e -- development version (r3749)

Another development build is ready:

download.vcmi.eu/vcmi_094e.7z

Last week brought us quite a number of fixes, mostly campaign and AI related.

Changelog:
bugs.vcmi.eu/changelog_page.php?version_id=68

I get the feeling that some campaign ends earlier than tested all scenarios. example ROE - Song for the Father of all 3 missions. Game closes without error. Or Roe - long live king - 4 mission and end
And a lot of these.
(bad that no amount of scenarios in the campaign, or to highlight any. I am confused in the number of missions on the mini map.)

and find bag bugs.vcmi.eu/view.php?id=1699

Played an XL map with new town mods.
On third week there was a crash during AI turn.
After restart autosave is not loaded (ended with crash).
So I thinked to myself "AI is not loading from save yet."
Are there plans to at least make AI loading for next release?

It’s true, poor stability

Crash at the end of a mission:

Server_log:

01:47:55 ERROR global [7ffff7fc2740] - const PlayerState* CGameInfoCallback::getPlayer(PlayerColor, bool) const: Cannot find player 7info!
01:47:55 ERROR network [7ffff3352700] - CPack serialized... this should not happen!
01:47:55 TRACE global [7ffff3352700] - Received client message (request 607 by player \00) of type with ID=0 (5CPack).

01:47:55 ERROR global [7ffff3352700] - Message cannot be applied, cannot find applier (unregistered type)!
01:48:02 ERROR global [7ffff3352700] - Received a null package marked as request 155903 from player 0
01:48:02 ERROR global [7ffff3352700] - std::bad_typeid

Backtrace:

Deleted mapHandler and gameState.
Deleted playerInts.
Client stopped.
terminate called after throwing an instance of 'std::bad_typeid'
  what():  std::bad_typeid
Request to patch map data/evil1:2
[Thread 0x7fffde5f8700 (LWP 4932) exited]
Error: accessing unavailable frame 0:1 in CAnimation!
Aborted (core dumped)
Error: server failed to close correctly or crashed!
Check /home/kroartem/.vcmi/server_log.txt for more info
[Thread 0x7fffdf7fd700 (LWP 4915) exited]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffdfffe700 (LWP 4925)]
__fill_a<unsigned char*, int> (__value=<optimized out>, 
    __last=0xb0410 <Address 0xb0410 out of bounds>, 
    __first=0xb040c <Address 0xb040c out of bounds>)
    at /usr/include/c++/4.8/bits/stl_algobase.h:693
693		*__first = __tmp;
(gdb) bt
#0  __fill_a<unsigned char*, int> (__value=<optimized out>, 
    __last=0xb0410 <Address 0xb0410 out of bounds>, 
    __first=0xb040c <Address 0xb040c out of bounds>)
    at /usr/include/c++/4.8/bits/stl_algobase.h:693
#1  fill<unsigned char*, int> (__value=<optimized out>, 
    __last=0xb0410 <Address 0xb0410 out of bounds>, 
    __first=0xb040c <Address 0xb040c out of bounds>)
    at /usr/include/c++/4.8/bits/stl_algobase.h:728
#2  CBitmapFont::renderCharacter (this=this@entry=0x7fffd40010c0, 
    surface=surface@entry=0xd1a0f0, character=..., color=..., 
    posX=@0x7fffdfffdc78: 482, posY=@0x7fffdfffdc7c: 219)
    at /build/buildd/vcmi-0.94+svn3447~ubuntu13.10.1/client/gui/Fonts.cpp:167
#3  0x000000000054e293 in CBitmapFont::renderText (this=0x7fffd40010c0, 
    surface=0xd1a0f0, data=..., color=..., pos=...)
    at /build/buildd/vcmi-0.94+svn3447~ubuntu13.10.1/client/gui/Fonts.cpp:202
#4  0x000000000053f59f in CIntObject::printAtLoc (
    this=this@entry=0x7fffc8c4ac00, text=..., x=x@entry=481, y=y@entry=219, 
    font=font@entry=FONT_BIG, kolor=..., dst=dst@entry=0xd1a0f0)
    at /build/buildd/vcmi-0.94+svn3447~ubuntu13.10.1/client/gui/CIntObject.cpp:133
#5  0x00000000005563ce in CBonusSelection::show (this=0x7fffc8c4ac00, 
    to=0xd1a0f0)
    at /build/buildd/vcmi-0.94+svn3447~ubuntu13.10.1/client/CPreGame.cpp:3347
---Type <return> to continue, or q <return> to quit---
#6  0x000000000055cc10 in CGPreGame::update (this=0xd08740)
    at /build/buildd/vcmi-0.94+svn3447~ubuntu13.10.1/client/CPreGame.cpp:518
#7  0x000000000053d841 in CGuiHandler::run (this=0x95fa00 <GH>)
    at /build/buildd/vcmi-0.94+svn3447~ubuntu13.10.1/client/gui/CGuiHandler.cpp:388
#8  0x00007ffff6d0794a in ?? ()
   from /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.53.0
#9  0x00007ffff6ae6f6e in start_thread (arg=0x7fffdfffe700)
    at pthread_create.c:311
#10 0x00007ffff3fdb9cd in clone ()
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

The bug above should be fixed. It happens randomly after the end of a campaign scenario. Then the server receives a CPack with a type ID of 0. When I debug VCMI it happens more often compared to executing VCMI without the debugger. (most likely it’s a timing, perhaps a memory / not initialized variables issue)

Last weekend I couldn’t really develop because of this bug. I don’t know but the bug wasn’t before revision 3741 or higher.

Those are correct numbers - Long Live the King is 4 missions in size and Song for the Father is just 3 missions long.

If game leaves to main menu then campaign finished correctly, nothing to worry about.
If game closes completely - then this is a crash (maybe that crash report utility fails in some cases?)

Probably it is time to finally implement high scores and implement actual “winning” of a campaign (that checkmark on campaign screen) to indicate what happened after winning a mission.

To properly solve this issue, quite big changes to serializer would be needed, I won’t make them by the next release.
Otherwise, the issue can be avoided on the AI side by not serializing aliasing shared_ptr’s, eg. by replacing them with unique_ptr or keeping them by value as before. I’m not sure whether AI currently really requires the goals to be actually shared (having multiple pointers to the same goal) or if Warmonger will have a time.

Do you the client’s log from that crash?

I wasn’t able to reproduce this issue, and I went through a few campaigns with debugger.
There might be some other factor involved — have you seen this issue on Windows with VC-built VCMI? Which campaign have you tested?

What remains is “remote debugging”.
When running campaign, attach debugger both to client and server. Place breakpoint in CPack::serialize method (NetPacksBase.h line 37), show the full backtrace when it catches. Paste the logs of both client and server.

Will the test assembly 0,94f? and if “yes” so when?

Certainly there’ll be, I have not decided when.
Preferably, when AI saving/loading works properly again.

Ok. That bothers me that there is no bug fixes “AI crash”. I certainly understand that you are and Warmonger very busy.

But they are of not going away.

The problem here is that AI save/load functionalities were broken. AI tends to crash after loading game anyway, so it is hard to debug such issues.
The AI save/load was fixed just recently and saves from next development build should allow debugging AI issues again. Unfortunately, the fix involved changing savegame format, so the old reports cannot be properly rechecked. :frowning:

Are there any AI crashes that are reproducible without using a savegame?