MantisBT

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0002084VCMIAI - Adventure Mappublic2015-02-14 23:532015-04-11 18:08
ReporterPovelitel 
Assigned ToSXX 
PrioritynormalSeveritycrashReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version0.97b 
Target VersionFixed in Version0.97c 
Summary0002084: Crash during AI turn
DescriptionOccurs on the go blue. It seems that the Deemer is attacking creatures and the game crashes.
TagsNo tags attached.
Attached Filesrar file icon Blue Deemer.rar [^] (1,492,673 bytes) 2015-02-14 23:53
txt file icon VCMI_Client_log.txt [^] (501,829 bytes) 2015-02-14 23:53 [Show Content]
txt file icon VCMI_Server_log.txt [^] (212,856 bytes) 2015-02-14 23:54 [Show Content]

- Relationships
related to 0001990closedSXX hero visiting Monolit two way enters the battle if press space 
related to 0002113closedSXX interruption during AI turn 

-  Notes
(0005498)
SXX (administrator)
2015-02-15 01:50

This one is reproducible with current git. Crash occur because AI trying to use hero that just died in battle.

It's likely occur because in this case lost hero handled by the "VCAI::objectRemoved" and not "VCAI::moveHeroToTile" that have appropriate exception for that case.
(0005499)
SXX (administrator)
2015-02-15 02:00

And this is likely happen because AI don't actually expect to be attacked.
This is related to different bug of VCMI where it's behaviour isn't like one in H3. Currently if your hero stay go into the Subterranean Gate and there is moster if you press "space bar" you won't go back, but instead will attack it.

I suppose that AI try to go back, but after being attacked he get "objectRemoved" event and had to react on it. Once reacted it's try to continue movement of hero and this obviously cause crash because hero object is already removed.
(0005501)
SXX (administrator)
2015-02-15 02:20

So here is two things need to be done:
1 - Origin of that problem 0001990 have to be fixed.
2 - And in case hero was removed during objectRemoved callback we need to make sure that this hero was properly removed from VCAI state and it's won't attempt to use it.
(0005503)
SXX (administrator)
2015-02-15 02:40

Also this one really need to be fixed as "objectRemoved" at least used in situation when AI hero is died on "event" with guard. E.g when AI didn't expect to be attacked at all.
(0005504)
SXX (administrator)
2015-02-15 03:52

Ok find out that objectRemoved event occur even if hero died bank, but there is difference:
1 - In "VCAI::moveHeroToTile" there is two calls of "waitTillFree".
2 - When objectRemoved event occur main AI thread wait for that.
3 - As result in 2nd case it's will throw std::runtime_error("Hero was lost!"); error
4 - Though in first case where "startHpos == dst" (e.g when hero attack monster while using subt. gate) there is no check if hero died while thread was waiting.

So dirty solution would be copy paste that check here too or the code need to be rewritten.
(0005539)
Povelitel (updater)
2015-02-18 11:51

The spread of the most bug causing crash on this build. I would have said so. At least for me.
(0005540)
SXX (administrator)
2015-02-18 12:06

Yeah this problem likely appear really often. Though I'll prefer to fix origin of the problem first and only then add cleaner solution for this problem as likely this should never ever happen except it's even (which is rare and even more rarely work for the AI).
(0005573)
SXX (administrator)
2015-02-22 18:11

So first of all I fixed 0001990 and also added additional check in code:
https://github.com/vcmi/vcmi/commit/ea46be03f3fcbe653433506db13bb73ccc30db31 [^]
So this one is resolved, but it's still questionable if that check needed at all.

Initially I think that problem may occur when hero visit event, but this code path only use when hero visit object under him while standing. In same time I find that it may happen if hero staying on creature bank may try to visit it (after get additional reinforcements).

Though this is really hard to test so for now I'll just leave check there.

- Issue History
Date Modified Username Field Change
2015-02-14 23:53 Povelitel New Issue
2015-02-14 23:53 Povelitel Status new => assigned
2015-02-14 23:53 Povelitel Assigned To => Warmonger
2015-02-14 23:53 Povelitel File Added: Blue Deemer.rar
2015-02-14 23:53 Povelitel File Added: VCMI_Client_log.txt
2015-02-14 23:54 Povelitel File Added: VCMI_Server_log.txt
2015-02-15 01:50 SXX Note Added: 0005498
2015-02-15 02:00 SXX Note Added: 0005499
2015-02-15 02:17 SXX Relationship added related to 0001990
2015-02-15 02:20 SXX Note Added: 0005501
2015-02-15 02:40 SXX Note Added: 0005503
2015-02-15 03:52 SXX Note Added: 0005504
2015-02-18 11:51 Povelitel Note Added: 0005539
2015-02-18 12:06 SXX Note Added: 0005540
2015-02-19 04:40 SXX Assigned To Warmonger => SXX
2015-02-22 18:11 SXX Note Added: 0005573
2015-02-22 18:11 SXX Status assigned => resolved
2015-02-22 18:11 SXX Fixed in Version => 0.97c
2015-02-22 18:11 SXX Resolution open => fixed
2015-02-28 09:41 Warmonger Relationship added related to 0002113
2015-04-11 18:08 Povelitel Status resolved => closed

Site | Forums | Wiki | Slack | GitHub


Copyright © 2000 - 2024 MantisBT Team
Hosting provided by DigitalOcean