[User error] [4.2.4] AActor::SetState infinite loop, freezing game (DRPG)

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

[4.2.4] AActor::SetState infinite loop, freezing game (DRPG)

Postby Sumwunn » Sat Nov 09, 2019 1:23 pm

Hello, I'm back with another obscure bug in relation to DRPG and it appears to be unrelated to HUDMessage this time.

So thankfully someone was able to send me a savegame that freezes seconds after loading, something I've been attemping to replicate for far too long.

AFAIK, It seems to be stemming from p_mobj.cpp#L495, and the do-while loop gets stuck and loops for infinity unless if I force line 497 to exit with x64dbg and in which case the engine resumes as normal and no more freezes are witnessed in the next five minutes.

I noticed that AActor::SetState barely registers on the CPU profiler until the freeze happens.
Another thing I noticed was that this freeze seems to go as far back as v3.7.2 and probably earlier.

Here's some info from VS profiler:
https://i.imgur.com/ok6ZuJQ.jpg

Links to save game and the VS profiler report.
https://www.mediafire.com/file/rgv0jux0 ... 0.zip/file
https://www.mediafire.com/file/06m1g854 ... 6.zip/file

I understand DRPG is a pain to setup and test, so feel free to tell me what to change.

Need anymore info? Please scream. Thanks!

How to run:
Spoiler:
User avatar
Sumwunn
Runaway script "_Sumwunn" terminated
 
Joined: 06 Jan 2018
Location: United States of Cheese
Discord: Sumwunn#9562

Re: [4.2.4] AActor::SetState infinite loop, freezing game (D

Postby Graf Zahl » Sat Nov 09, 2019 1:33 pm

There is only one way that loop can get stuck and that is if some actor has a 0-duration state loop. This is one of those cases which cannot really be fixed in the engine because the only way to end the loop would be to set an arbitrary maximum loop count. Set it too low and other mods will break, set it too high and it becomes ineffective.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: [4.2.4] AActor::SetState infinite loop, freezing game (D

Postby Sumwunn » Sat Nov 09, 2019 8:01 pm

Thank you for the info, that's certainly interesting.

So how does one identify whether an actor is affected by a 0-duration state loop? Would it be in a the form of user error in decorate?

DRPG manages its monster compatibility via duplicating actors and basically forcing DRPGs MonsterInit to execute via state modification, could that possibly be an issue? I never did like having to duplicate actors for compatibility sake.
https://github.com/Sumwunn/DoomRPG/blob ... ers.txt#L8
User avatar
Sumwunn
Runaway script "_Sumwunn" terminated
 
Joined: 06 Jan 2018
Location: United States of Cheese
Discord: Sumwunn#9562

Re: [4.2.4] AActor::SetState infinite loop, freezing game (D

Postby Graf Zahl » Sun Nov 10, 2019 2:00 am

While some obvious cases can be detected, those are rarely the problem. Where it goes wrong is often things that look correct on the surface but still do not work properly, like A_Jump combinations with no delays and conditions that evaluate to results that SetState never exits the loop.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: [4.2.4] AActor::SetState infinite loop, freezing game (D

Postby _mental_ » Sun Nov 10, 2019 7:38 am

If this helps, the actor in question is RLUniqueBossSpawner, and the state that loops endlessly is RLUniqueBossSpawner.102 which seems to be Succeed from the actor below.
Spoiler: RLUniqueBossSpawner
_mental_
 
 
 
Joined: 07 Aug 2011

Re: [4.2.4] AActor::SetState infinite loop, freezing game (D

Postby Graf Zahl » Sun Nov 10, 2019 9:28 am

More like the stuff above "Succeed". Succeed is harmless, it just waits and ends, the SpawnLoop above is just horrible code.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: [4.2.4] AActor::SetState infinite loop, freezing game (D

Postby Sumwunn » Sun Nov 10, 2019 1:13 pm

Thanks for the actor name! It seems HEYSTOPTHAT is the culprit when DRPG is active which would explain why DRLA by itself does not freeze the game.

Changing TNT1 A from 0 to 1 avoids the freeze up, and judging from the function's structure it looks like RLDemonicBossSpawner is susceptible also.
I'm not sure about the other checks scattered around as they are a bit different from this case, however I managed to figure out VS debugger so if this happens again I can see the actor responsible.

I think this wraps things up assuming the above is the correct way to solve this.

EDIT:
I think I've properly fixed it, had to copy over the DoorpegOutpostCheck section from RLDemonicBossSpawner to RLUniqueBossSpawner's empty one, and a UniqueBoss spawned so I'm guessing that's the intended behaviour.

EDIT 2:
The fix will be included in the next DRLA update, so this can be closed.

Thanks guys.
User avatar
Sumwunn
Runaway script "_Sumwunn" terminated
 
Joined: 06 Jan 2018
Location: United States of Cheese
Discord: Sumwunn#9562

Re: [4.2.4] AActor::SetState infinite loop, freezing game (D

Postby Major Cooke » Mon Dec 02, 2019 7:23 pm

What about a debug variable that can be set where modders can use this as a tool, Graf? If it's set to < 1 then it doesn't perform.
User avatar
Major Cooke
Do unto others as you would have unto you. Judge yourself first.
 
Joined: 28 Jan 2007


Return to Closed Bugs

Who is online

Users browsing this forum: No registered users and 1 guest