Multiplayer stale references preventing Garbage collection with Seamless Travel

Investigating some log spam that occurs when a seamless travel. This is the spam

LogOutputDevice: Error: Ensure condition failed: false
Old World /Game/Maps/HubMap/UEDPIE_0_HubMap.HubMap not cleaned up by GC! Object BP_RSTPlayerCharacter_Blue_C /Game/Maps/HubMap/UEDPIE_0_HubMap.HubMap:PersistentLevel.BP_RSTPlayerCharacter_Blue_C_1 is being referenced by IpConnection /Engine/Transient.IpConnection_0:
 (root)  World /Temp/Untitled_3.Untitled
 -> TObjectPtr<APhysicsVolume> UWorld::DefaultPhysicsVolume =  DefaultPhysicsVolume /Temp/Untitled_3.Untitled:PersistentLevel.DefaultPhysicsVolume_0
  -> UObject* UObject::Outer =  Level /Temp/Untitled_3.Untitled:PersistentLevel
   -> Level /Temp/Untitled_3.Untitled:PersistentLevel::AddReferencedObjects( BP_RSTPlayerController_C /Temp/Untitled_3.Untitled:PersistentLevel.BP_RSTPlayerController_C_1)
      ^ ULevel::AddReferencedObjects() [D:\Burst\eluong_SYS872_BurstMain\Engine\Source\Runtime\Engine\Private\Level.cpp:493]
    -> TObjectPtr<UPlayer> APlayerController::Player =  IpConnection /Engine/Transient.IpConnection_0
     -> TObjectPtr<AActor> UNetConnection::ViewTarget = (Garbage)  BP_RSTPlayerCharacter_Blue_C /Game/Maps/HubMap/UEDPIE_0_HubMap.HubMap:PersistentLevel.BP_RSTPlayerCharacter_Blue_C_1
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         ^ This reference is preventing the old World from being GC'd ^
      -> UObject* UObject::Outer = (Garbage)  Level /Game/Maps/HubMap/UEDPIE_0_HubMap.HubMap:PersistentLevel
       -> UObject* UObject::Outer = (Garbage)  World /Game/Maps/HubMap/UEDPIE_0_HubMap.HubMap

This can be reproed with a very simple map that has a player controller and possessed pawn.

From what I can tell, the exact steps repro + what is happening

  1. Initiate seamless travel with two players in the map. At this point, the server’s client connection UNetConnection::ViewTarget is the player’s Pawn

    a. All controllers unpossess their pawns, setting the controller (not connection) view target to be the controller and not the pawn

    b. UEditorEngine::CheckAndHandleStaleWorldObjectReferences(&CurrentContext) is called. The UNetConnection::ViewTarget is still pointing to the pawn and is a UPROPERTY/TObjectPtr so it is ref counted for garbage collection purposes, so CheckAndHandleStaleWorldObjectReferences spits out warnings that the pawn is not being garbage collected.

  2. On next tick, ServerReplicateActors_PrepConnections goes through the connection and then updates the viewtarget to the controllers view target. This now allows the garbage collector to clean up the pawn.

Has anyone else experienced this issue?

I would like to add this code to the end of UNetConnection::ResetGameWorldState

 	ViewTarget = NULL;
 	for (int32 ChildIdx = 0; ChildIdx < Children.Num(); ChildIdx++)
 	{
 		Children[ChildIdx]->ViewTarget = NULL;
 	}

so that the view targets are cleared out