MantisBT

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001804VCMIRandom Map Generatorpublic2014-06-28 05:302014-09-21 20:26
ReporterWarmonger 
Assigned ToWarmonger 
PriorityhighSeverityblockReproducibilityhave not tried
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version0.95c 
Target Version0.96Fixed in Version0.97 
Summary0001804: Client / server desync
DescriptionTo sum things up:

- Picking any removable object leads to crash at recalculating paths
- Random number generator on random map was out of sync. Now it is, but it doesn't solve the problem.
Steps To ReproduceLaunch a random map, pick any treasure -> crash.

State of hero in town is different on client and server.
Additional InformationGame would crash just when hero left the town. I made a workaround for that.
TagsNo tags attached.
Attached Filesrar file icon Bug1804.rar [^] (46,522 bytes) 2014-07-27 12:12

- Relationships

-  Notes
(0004803)
beegee (developer)
2014-06-28 14:52

Why does this bug occurs now (not with earlier VCMI versions)? What do you mean with too many windows / server window?

Sorry, but can't fix that bug.
(0004809)
Warmonger (administrator)
2014-06-29 05:20

Well, that could be wrong observation.

Still, I have no idea why now RMG gets desync and previously it didn't.
(0004811)
Warmonger (administrator)
2014-06-30 13:41

Most certainly hero in town displays corretly on client, but is not present on server. Even though initalization looks fine.

I don't think I eventually changed anything significant from engine's point of view. Messed a bit with unique/shared pointers, but now they are as they were at the beginning. Not sure what is actual reasoning behind all of them, though and how game (map?) state is synchronized for RMG.
(0004815)
Warmonger (administrator)
2014-07-01 09:31

Now this is WEIRD. Line in CGameHandler.cpp
obj->onHeroLeave(h);

Is called twice in a row, both on server.
(0004857)
Warmonger (administrator)
2014-07-27 09:43
edited on: 2014-07-27 09:45

For current state of code debugging shows crashes happen in Main Thread. Removing adevnture map objectsmay result in two types of crashes:

- CPathfinder::EvaluateAccessibility when hovering over empty area
tinfo->objects seem invalid (null)
- CAdvMapInt::TileHovered when hovering over objects
objAtTile seems invalid (but not null)

However, removing object in thread mscrv110 looks fine both in NetPacksClient and NetPacksLib.

(0004858)
Warmonger (administrator)
2014-07-27 10:37

Okay, it's actually RMG desync:

Client
12:04:39 INFO global [223c] - Seed after init is 1960254332 (before was 1406455476)

Server
12:04:37 INFO global [2140] - Seed after init is 1124503360 (before was 1406455476)
(0004861)
Warmonger (administrator)
2014-07-27 12:12
edited on: 2014-07-27 12:48

It looks like both client and server generators start in sync, but after a while they loose it (at bank generation?). Use diff to see details.

(0004862)
Ivan (developer)
2014-07-27 12:37

What? Different checksums for data files?

Client log:
[413c7ceb] Original game files

Server log:
[99a803a8] Original game files

How is that possible if both client and server are in the same directory? Should be looked into even if it turns out to be unrelated to this issue.



Bank generation - all access to random numbers happens after RMG - during CBank::initObj() which should be synchronous.

Perhaps random generator is already out of sync at this point?
(0004863)
Warmonger (administrator)
2014-07-27 13:21
edited on: 2014-07-27 13:43

Just checked and after "initTowns" seeds match, but banks diverge soon after.

EDIT: debuggin individual objects shows that the seed indeed changes at banks.

(0004867)
Warmonger (administrator)
2014-07-27 16:43
edited on: 2014-07-27 16:54

It was actually caused bu unitialized CGResource::val, which caused divergence. But that's not the only case.

EDIT: Another divergence due to uninitialized CGCreature::character. This is how it goes.

(0004870)
Warmonger (administrator)
2014-07-27 18:28

To sum things up for today: rng is now in sync, but it doesn't stop game from crashing :/
(0004964)
Warmonger (administrator)
2014-09-21 10:12

I enabled prison heroes to get more than 0 exp (not yet commited).

This way they are leveled correctly at server, but at client side they are NULL, which leads to crash.

Explanation to all this is, I believe, as follows:
First map is created on Client side, then it is created on Server side.

All objects are created twice. They have different adresses are are inherently of of sync -> this is fundamental flaw in design.

However, simplest RMG before worked fine, that is objects were synced. Not sure where the difference is.
(0004965)
Ivan (developer)
2014-09-21 19:58

Isn't this one fixed now? Or there are still desync bugs in RMG?
(0004966)
Warmonger (administrator)
2014-09-21 20:26

That's it.
https://github.com/vcmi/vcmi/commit/147ca72f65e1ce10e7682d39e9bf9cc71b582672 [^]

- Issue History
Date Modified Username Field Change
2014-06-28 05:30 Warmonger New Issue
2014-06-28 05:30 Warmonger Status new => assigned
2014-06-28 05:30 Warmonger Assigned To => beegee
2014-06-28 14:51 beegee Assigned To beegee =>
2014-06-28 14:52 beegee Note Added: 0004803
2014-06-29 05:20 Warmonger Note Added: 0004809
2014-06-29 05:26 Warmonger Summary Random map genrator creates new server window => Client / server desync
2014-06-29 05:26 Warmonger Description Updated View Revisions
2014-06-29 05:26 Warmonger Steps to Reproduce Updated View Revisions
2014-06-30 13:41 Warmonger Note Added: 0004811
2014-07-01 09:31 Warmonger Note Added: 0004815
2014-07-15 16:22 Warmonger Note Added: 0004835
2014-07-19 10:40 Warmonger Relationship added related to 0001838
2014-07-25 04:46 Warmonger Status assigned => new
2014-07-27 09:39 Warmonger Note Deleted: 0004835
2014-07-27 09:43 Warmonger Note Added: 0004857
2014-07-27 09:45 Warmonger Note Edited: 0004857 View Revisions
2014-07-27 10:37 Warmonger Note Added: 0004858
2014-07-27 12:12 Warmonger Note Added: 0004861
2014-07-27 12:12 Warmonger File Added: Bug1804.rar
2014-07-27 12:32 Warmonger Note Edited: 0004861 View Revisions
2014-07-27 12:34 Warmonger Note Edited: 0004861 View Revisions
2014-07-27 12:37 Ivan Note Added: 0004862
2014-07-27 12:48 Warmonger Note Edited: 0004861 View Revisions
2014-07-27 13:21 Warmonger Note Added: 0004863
2014-07-27 13:43 Warmonger Note Edited: 0004863 View Revisions
2014-07-27 16:43 Warmonger Note Added: 0004867
2014-07-27 16:54 Warmonger Note Edited: 0004867 View Revisions
2014-07-27 18:28 Warmonger Note Added: 0004870
2014-07-27 18:30 Warmonger Description Updated View Revisions
2014-07-27 18:30 Warmonger Steps to Reproduce Updated View Revisions
2014-07-27 18:30 Warmonger Additional Information Updated View Revisions
2014-09-21 10:12 Warmonger Note Added: 0004964
2014-09-21 10:15 Warmonger Assigned To => Warmonger
2014-09-21 10:15 Warmonger Status new => assigned
2014-09-21 19:58 Ivan Note Added: 0004965
2014-09-21 20:26 Warmonger Note Added: 0004966
2014-09-21 20:26 Warmonger Status assigned => resolved
2014-09-21 20:26 Warmonger Fixed in Version => 0.97
2014-09-21 20:26 Warmonger Resolution open => fixed
2014-12-20 10:51 Warmonger Relationship deleted related to 0001838

Site | Forums | Wiki | Slack | GitHub


Copyright © 2000 - 2024 MantisBT Team
Hosting provided by DigitalOcean