MantisBT - VCMI
View Issue Details
0001149VCMIMechanics - Adventure Mappublic2012-11-15 18:112014-05-30 17:41
Ivan 
Ivan 
normalcrashsometimes
closedfixed 
x86_64Ubuntu Linux12.04 (precise)
 
0.91 
0001149: Crash(es) on visiting Shipwreck survivor
Sometimes visiting shipwreck survivor causes crash.

First time it was somewhere in CArtifactInstance::canBePutAt()

Second time - no crash.

Now I got it twice into CSerializer::getVectorItemFromId() -
assert(oInfo.vector->size() > id) at CConnection.h:304 failed
There is one surivor on Arrogance as well as on VCMI_Tests (below row of towns).
Stacktrace for last crash:
4 CSerializer::getVectorItemFromId<CArtifactInstance> Connection.h 304
5 CISer<CConnection>::loadPointer<CArtifactInstance*> Connection.h 828
6 LoadPointer<CConnection, CArtifactInstance*>::invoke Connection.h 158
7 CISer<CConnection>::load<CArtifactInstance*> Connection.h 766
8 CISer<CConnection>::operator>><CArtifactInstance*> Connection.h 733
9 CISer<CConnection>::operator&<CArtifactInstance*> Connection.h 740
10 ConstTransitivePtr<CArtifactInstance>::serialize<CISer<CConnection> > ConstTransitivePtr.h 72
11 CISer<CConnection>::loadSerializableBySerializeCall<ConstTransitivePtr<CArtifactInstance> > Connection.h 791
12 CISer<CConnection>::loadSerializable<ConstTransitivePtr<CArtifactInstance> > Connection.h 798
13 LoadSerializable<CConnection, ConstTransitivePtr<CArtifactInstance> >::invoke Connection.h 182
14 CISer<CConnection>::load<ConstTransitivePtr<CArtifactInstance> > Connection.h 766
15 CISer<CConnection>::operator>><ConstTransitivePtr<CArtifactInstance> > Connection.h 733
16 CISer<CConnection>::operator&<ConstTransitivePtr<CArtifactInstance> > Connection.h 740
17 PutArtifact::serialize<CISer<CConnection> > NetPacks.h 969
18 CPointerLoader<CISer<CConnection>, PutArtifact>::loadPtr Connection.h 687
19 CISer<CConnection>::loadPointerHlp<CPack*> Connection.h 875
20 CISer<CConnection>::loadPointer<CPack*> Connection.h 858
21 LoadPointer<CConnection, CPack*>::invoke Connection.h 158
22 CISer<CConnection>::load<CPack*> Connection.h 766
23 CISer<CConnection>::operator>><CPack*> Connection.h 733
24 CConnection::retreivePack Connection.cpp 239
25 CClient::run Client.cpp 143
No tags attached.
related to 0001051closed Warmonger Connection.h:302: Assertion `oInfo.vector->size() > id' failed. 
related to 0001154closed Ivan Random crash when AI tries to recruit hero 
parent of 0001158closed Ivan Crash when AI tries to pick artifact 2 
parent of 0001157closed Ivan Crash when AI tries to pick artifact 
Issue History
2012-11-15 18:11IvanNew Issue
2012-11-15 18:12IvanRelationship addedrelated to 0001051
2012-11-15 18:13WarmongerNote Added: 0003212
2012-11-15 18:15WarmongerNote Edited: 0003212bug_revision_view_page.php?bugnote_id=3212#r2040
2012-11-15 18:32WarmongerAssigned To => Warmonger
2012-11-15 18:32WarmongerStatusnew => assigned
2012-11-15 18:52WarmongerNote Added: 0003215
2012-12-01 08:39WarmongerRelationship addedrelated to 0001154
2012-12-04 19:20beegeeNote Added: 0003228
2012-12-04 19:22beegeeNote Edited: 0003228bug_revision_view_page.php?bugnote_id=3228#r2051
2012-12-04 19:26beegeeNote Edited: 0003228bug_revision_view_page.php?bugnote_id=3228#r2052
2012-12-04 19:35beegeeNote Edited: 0003228bug_revision_view_page.php?bugnote_id=3228#r2053
2012-12-05 07:00WarmongerNote Added: 0003229
2012-12-05 10:13IvanNote Added: 0003230
2012-12-05 10:24IvanNote Edited: 0003230bug_revision_view_page.php?bugnote_id=3230#r2055
2012-12-05 10:52IvanNote Added: 0003231
2012-12-05 17:16beegeeNote Added: 0003232
2012-12-05 17:50WarmongerRelationship addedrelated to 0001157
2012-12-21 09:32WarmongerRelationship addedparent of 0001158
2012-12-21 09:33WarmongerRelationship deletedrelated to 0001157
2012-12-21 09:33WarmongerRelationship addedparent of 0001157
2012-12-21 09:33WarmongerNote Added: 0003265
2012-12-21 09:34WarmongerStatusassigned => resolved
2012-12-21 09:34WarmongerFixed in Version => 0.91
2012-12-21 09:34WarmongerResolutionopen => fixed
2012-12-21 09:34WarmongerAssigned ToWarmonger => Ivan
2014-05-30 17:41beegeeStatusresolved => closed

Notes
(0003212)
Warmonger   
2012-11-15 18:13   
(edited on: 2012-11-15 18:15)
I recently noticed random crashes related to artifact location, this may be one of them. Possibly there is a bug in loading artifacts from config.

This is certainly not related to 0001051, as the other issue is about Quest serialization.

(0003215)
Warmonger   
2012-11-15 18:52   
It looks like addNewArtifactInstance() (among others) is present in both CMap class and CMapService. Beegee, could you please explain what I look at?
(0003228)
beegee   
2012-12-04 19:20   
(edited on: 2012-12-04 19:35)
@Warmonger:
Oops. Those methods belong to CMap only. I'll fix it with my next commit.

When visiting a shipwreck survivor it comes always to a deadlock situation. No crash occured in server nor client. With rev3007 even everything is fine. So it shouldn't has to do anything with faulty map loading. IMO only rev 3012 can has to do sth. with that bug. This revision fixed 0001148 which involved some changes to the moveHero method of CCGameHandler of vcmiserver.

When I stop execution during the deadlock the thread situation in vcmiclient is as follows: (thread numbers are not thread IDs!)
Thread 1: CMT (listen to "main" events)
Thread 2: Console thread
Thread 3: CClient / waits for result of vcmiserver (this client has started the server)
Thread 4 / 5: SDL stuff
Thread 6: bool CPlayerInterface::moveHero( const CGHeroInstance *h, CGPath path )
These lines:
while(stillMoveHero.data != STOP_MOVE && stillMoveHero.data != CONTINUE_MOVE)
                    stillMoveHero.cond.wait(un);

Thread 7:
- void CPlayerInterface::heroMoved(const TryMoveHero & details)
-- void CPlayerInterface::waitWhileDialog
These lines:
while(showingDialog->data)
        showingDialog->cond.wait(un);

This part of VCMI seems to be really tricky and complicated. Changes on vcmiserver/vcmiclient communication needs sadly much testing. Perhaps some sort of unit testing could help here, but definitely not so easy to implement.

(0003229)
Warmonger   
2012-12-05 07:00   
Maybe these are just two separate issues. I will start another report then.
(0003230)
Ivan   
2012-12-05 10:13   
(edited on: 2012-12-05 10:24)
deadlock in moveHero + showing dialog is quite old and was supposed to be fixed multiple times already - I doubt that it connected with rev 3012.

Moreover - I got crash with similar or identical trace using "all spells
+ spellbook" cheat - clearly unrelated to moveHero on server.

EDIT: I can confirm deadlock but this is definitely a different bug.

(0003231)
Ivan   
2012-12-05 10:52   
Ok, deadlock is fixed and so far I can't reproduce original bug.

BTW - first Warmonger's comment regarding "random crashes" was done before my moveHero changes and stacktrace is too specific to artifacts - not sure if original bug is fixed.
(0003232)
beegee   
2012-12-05 17:16   
Yeah, deadlock is fixed.
(0003265)
Warmonger   
2012-12-21 09:33   
All the issues seem fixed.