ThreadHeartbeat: fix ignored GameThreadHeartBeatStackWalk ini option

Hi, I wanted to call out a small PR I made with a fix for ThreadHeartBeat.cpp: https://github.com/EpicGames/UnrealEngine/pull/14223

CL 35262649 (https://github.com/EpicGames/UnrealEngine/commit/8f1dde916b765f6d17ff5c8f9a63943a7e1bdfed) updated the ini loading code to only run once, but accidentally caused it to short circuit if GameThreadHeartBeatHitchDuration is set in the .ini, leading it to leave Config_StackWalk defaulted to false, even if it is also set in the .ini. These changes preserve the run-once behavior and ensure the stackwalk setting is properly loaded.

We’ve made the fix locally but it would be great to get this upstreamed so we don’t have to maintain it. Thanks!

Reuben

[Attachment Removed]

Steps to Reproduce
Enable hitch detection in MyProject.Target.cs:

      GlobalDefinitions.Add("ALLOW_HITCH_DETECTION=1");
      GlobalDefinitions.Add("WALK_STACK_ON_HITCH_DETECTED=1");

In DefaultEngine.ini, add the following items:

[Core.System]
GameThreadHeartBeatHitchDuration=0.06666
GameThreadHeartBeatStackWalk=true

  1. Put a breakpoint in FGameThreadHitchHeartBeatThreaded::InitSettings() where it initializes bReadFromConfig
  2. Launch the game with a debugger
  3. Observe when debugging that Config_StackWalk remains defaulted to false
  4. Enter “CauseHitches 1” in the console
  5. Observe the log when a hitch is detected, no stack is printed
    [Attachment Removed]

Yep, that’s embarrassing! I will make this change right now.

[Attachment Removed]

Submitted to p4, changelist 49765589

[Attachment Removed]

No problem, thank you!

[Attachment Removed]