Gauntlet TestExecutor's ExecuteTests function never releases devices if an UnrealTestNode's StartTest returns false.

From what I can see in our codebase, Gauntlet.UnrealTestNode.IsReadyToStart will claim device(s), Gauntlet.UnrealTestNode.StartTest will return false moving the test directly in the Gauntlet.TestExecutor’s CompletedTests list. Gauntlet.UnrealTestNode.StopTest will never be called. The claimed device(s) will forever stay assigned. In this situation, the Gauntlet would timeout but with the NoTimeout option the behavior is a soft deadlock.

I’ve looked at the implementation of Gauntlet.TestExecutor.cs in newer versions and it does not seem to have changed. Please let me know if I’m missing something or if it works in newer versions.

[Attachment Removed]

Steps to Reproduce
Minimal repro setup would have the following:

  • An UnrealTestNode with a StartTest function returning false.
  • Have more tests or roles than available devices.
  • Use the NoTimeout option (not strictly necessary, it just makes the issue obvious).

[Attachment Removed]

Hi,

Your analysis is correct, and newer engine versions don’t fully fix it. When a test’s StartTest returns false, TestExecutor moves the test straight to its completed list without cleaning it up. The devices reserved

in IsReadyToStart stay reserved until the whole Gauntlet run ends and the device pool is disposed. Any test waiting for those devices is stuck. With -NoTimeout, the run never ends as long as another test is still

running.

Workaround in your test node (no engine change needed):

In your UnrealTestNode subclass, release the session’s devices yourself whenever StartTest is about to fail:

Notes:

- Throwing an exception from StartTest instead of returning false doesn’t help. TestExecutor catches the exception and takes the same path, with no cleanup.

- Until this is fixed, avoid combining -NoTimeout with -parallel greater than 1. Keeping -wait= short also limits how long other tests wait for devices that are never released.

Engine-side alternative (local change)

 public override bool StartTest(int Pass, int InNumPasses)
 {
   bool bStarted = false;
 
   try
   {
     bStarted = base.StartTest(Pass, InNumPasses);
 
     if (bStarted)
     {
       // ... your own start logic; set bStarted = false on failure ...
     }
   }
 
   finally
   {
     if (!bStarted)
     {
       // Kills any app instances launched for this session and returns the devices to the pool
       UnrealApp?.ReleaseSessionDevices();
     }
   }
 
   return bStarted;
 }
 

If you’d rather fix it for every test node, edit Engine/Source/Programs/AutomationTool/Gauntlet/Framework/Gauntlet.TestExecutor.cs. In ExecuteTests, find the branch that handles Started == false, the one that logs

“failed to start”. Add a call to TestToStart.TestNode.CleanupTest() there, inside a try/catch. Don’t call StopTest in that branch: after a failed launch there’s no test instance, and it expects one. For tests with

several passes, also release the devices explicitly, because the base CleanupTest only releases them after the last pass.

We’re logging this as a bug so the executor cleans up failed starts itself.

Regards,

Martin

[Attachment Removed]

Hi,

You’re right about the exception in IsReadyToStart: the test is moved to the completed list without CleanupTest, so any devices it had already reserved stay reserved. The same applies to the wait-for-devices timeout (-wait, “Insufficient devices found”). Since partial reservations are kept, a test that gave up waiting can still hold some of its devices. The MaxDuration timeout of a running test is handled correctly, though: TickTest calls StopTest and then CleanupTest, which releases the devices. The one exception is when StopTest itself throws, which skips CleanupTest. We’ve added these cases to the bug report. The same workaround applies: release the session’s devices (UnrealApp?.ReleaseSessionDevices()) in your node before throwing from IsReadyToStart. For the wait timeout, a local fix is to call CleanupTest() in the executor’s “Insufficient devices” branch, the same way as for the failed-start branch.

I updated the bug report for this part to be addressed as well.

Martin

[Attachment Removed]

I’ve noticed in the meantime that there are two other cases where this will happen in the same Gauntlet.TestExecutor.ExecuteTests function. On exception throw in IsReadyToStart and on test timeout.

Thank you for your answer, I’m glad to hear that there’s a bug for this now.

[Attachment Removed]

Thank you for following up on this!

[Attachment Removed]