Opened 6 years ago

Closed 3 years ago

#5185 closed defect (fixed)

OOS on rejoin on turn 0

Reported by: elexis Owned by: wraitii
Priority: Must Have Milestone: Alpha 24
Component: Simulation Keywords:
Cc: Patch: Phab:D3068

Description (last modified by wraitii)

As found in #5162, rejoining on turn 0 results in an OOS error.

One can reproduce it by starting a game and sending Engine.SetSimrate(0); with F9 during the loading screen and then perform a rejoin and increase the simrate.

To minimize the oos_dump, this should be ideally done on an empty atlas map with a tiger and an infantry unit for instance.

The oos_dump difference contains already a different rng value, but the callstack is identical and performed with the same arguments.

The issue is reproducible in Alpha 19 and Alpha 22 too (most likely inbetween too). It seems (I might be wrong) to not trigger issues after turn 0 passed.

Change History (7)

comment:1 by Imarok, 5 years ago

Component: UI & SimulationSimulation

Move tickets to Simulation as UI & Simulation got some sub components.

comment:2 by Freagarach, 5 years ago

#5546 Related?

comment:3 by elexis, 5 years ago

In 22998:

Support testing rejoins on turn 0, refs #3460, #4242, #5185, #5162, rP18940

Differential Revision: https://code.wildfiregames.com/D1522

comment:4 by wraitii, 3 years ago

Interestingly, while I get the OOS systematically in a 'real' rejoin, I can't reproduce with a turn-0 rejoin test.

I have a hunch this has something to do with the m_CurrentTurn/ReadyTurn starting at 0/1 but the first actually processed commands being on turn 2 (from the turnmanager POV), but I haven't been able to figure it out and this is all somewhat confusing.

One thing I've noticed is that when MP-rejoining on turn 0, the client will actually fast-forward and Update() the sim once, even though the server hasn't. I'm not sure if that has consequences, but making sure it doesn't doesn't change the OOS.

#5546 is unrelated to this as far as I can tell.

comment:5 by wraitii, 3 years ago

Thankfully, I could actually reproduce this deterministically locally. After examining the oos dump, In noticed a different in timer. Setting a printf in SetInterval, I noticed that the host created a timer at turn 0, whereas the client did so at turn 1.

After some more careful examination, the bug is that since the host hasn't yet run turn 0, m_ServerTurnManager->GetSavedTurnLength(0) returns 0 instead of 500. Thus there is a turn that does nothing, and all hell breaks loose.

I'm not sure this can only happen on turn 0, but probably.

What I'm not entirely sure of yet is if the comment that inits these values to 0 is correct or not...

comment:6 by wraitii, 3 years ago

Description: modified (diff)
Owner: set to wraitii
Patch: Phab:D3068

comment:7 by wraitii, 3 years ago

Resolution: fixed
Status: newclosed

In 24275:

Fix MP OOS when rejoining on turn 0

Reported by: elexis

Fixes #5185

Differential Revision: https://code.wildfiregames.com/D3068

Note: See TracTickets for help on using tickets.