Shutdown crash in TransBuffer

Hi,

I have been having a GC crash in EndPlayMap when stopping a PIE session, but ONLY after changing a a value in the Default Panel for a Object while the game is running (see section below):

I have tried to create a minimal reproduction case, but I haven’t managed to do so.

I managed to reduce the number of referenced objects during shutdown by changing header declaration of my object from:

UPROPERTY(BlueprintReadOnly,Category="Skill")
class AEvilPawn* OwningPawn;

to

UPROPERTY(BlueprintReadOnly,NonTransactional,Category="Skill")
TWeakObjectPtr<class AEvilPawn> OwningPawn;

The end of my Log-file looks like this:

[2015.01.19-18.10.02:266][334]LogReferenceChain: Searching referencers for StartLevel. This may take several minutes.
[2015.01.19-18.10.02:736][334]LogReferenceChain: Generating reference graph ...
[2015.01.19-18.10.02:742][334]LogReferenceChain: Level 0 has 10 nodes ...
[2015.01.19-18.10.02:754][334]LogReferenceChain: Level 1 added 74 nodes ...
[2015.01.19-18.10.02:768][334]LogReferenceChain: Level 2 added 287 nodes ...
[2015.01.19-18.10.02:781][334]LogReferenceChain: Level 3 added 307 nodes ...
[2015.01.19-18.10.02:793][334]LogReferenceChain: Level 4 added 30 nodes ...
[2015.01.19-18.10.02:805][334]LogReferenceChain: Level 5 added 14 nodes ...
[2015.01.19-18.10.02:817][334]LogReferenceChain: Level 6 added 0 nodes ...
[2015.01.19-18.10.02:817][334]LogReferenceChain: Generating reference chains ...
[2015.01.19-18.10.02:818][334]LogReferenceChain:   
[2015.01.19-18.10.02:818][334]LogReferenceChain: External Referencers:
[2015.01.19-18.10.02:818][334]LogReferenceChain:   
[2015.01.19-18.10.02:819][334]LogReferenceChain: (root) UnrealEdEngine /Engine/Transient.UnrealEdEngine_0->Trans
[2015.01.19-18.10.06:294][334]LogReferenceChain:   TransBuffer /Engine/Transient.TransBuffer_0->UE4Editor-UnrealEd.dll!UTransBuffer::AddReferencedObjects() (0x000007fee6833ba0) + 0 bytes [c:\programmering\drevil\ue4_engine\engine\source\editor\unrealed\private\editortransaction.cpp:384]
[2015.01.19-18.10.06:295][334]LogReferenceChain:     BP_Castle_C /Game/Maps/UEDPIE_0_StartLevel.StartLevel:PersistentLevel.BP_Castle_C_1->Outer
[2015.01.19-18.10.06:295][334]LogReferenceChain:       Level /Game/Maps/UEDPIE_0_StartLevel.StartLevel:PersistentLevel->OwningWorld
[2015.01.19-18.10.06:295][334]LogReferenceChain:         (target) World /Game/Maps/UEDPIE_0_StartLevel.StartLevel
[2015.01.19-18.10.06:422][334]LogWindows:Error: Windows GetLastError: The operation completed successfully. (0)
[2015.01.19-18.10.06:422][334]LogCrashTracker: 


[2015.01.19-18.10.06:712][334]LogCrashTracker: 


[2015.01.19-18.10.06:712][334]LogWindows: === Critical error: ===
Fatal error: [File:C:\Programmering\DrEvil\UE4_Engine\Engine\Source\Developer\MessageLog\Private\Model\MessageLogListingModel.cpp] [Line: 70] 
Critical Error PlayerState /Game/Maps/UEDPIE_0_StartLevel.StartLevel:PersistentLevel.PlayerState_25 Object from PIE level still referenced. Shortest path from root:    (Object is not currently rooted)



KERNELBASE.dll!UnknownFunction (0x000007fefd62940d) + 0 bytes [UnknownFile:0]
UE4Editor-Core.dll!FOutputDeviceWindowsError::Serialize() (0x000007feec62080d) + 0 bytes [c:\programmering\drevil\ue4_engine\engine\source\runtime\core\private\windows\windowsplatformoutputdevices.cpp:95]
UE4Editor-Core.dll!FMsg::Logf__VA() (0x000007feec4bf73f) + 0 bytes [c:\programmering\drevil\ue4_engine\engine\source\runtime\core\private\misc\outputdevice.cpp:526]
UE4Editor-MessageLog.dll!FMessageLogListingModel::AddMessageInternal() (0x000007fedfc410d5) + 150 bytes [c:\programmering\drevil\ue4_engine\engine\source\developer\messagelog\private\model\messageloglistingmodel.cpp:70]
UE4Editor-MessageLog.dll!FMessageLogListingModel::AddMessages() (0x000007fedfc411cf) + 79 bytes [c:\programmering\drevil\ue4_engine\engine\source\developer\messagelog\private\model\messageloglistingmodel.cpp:89]
UE4Editor-Core.dll!FMessageLog::~FMessageLog() (0x000007feec433ab5) + 58 bytes [c:\programmering\drevil\ue4_engine\engine\source\runtime\core\private\logging\messagelog.cpp:91]
UE4Editor-UnrealEd.dll!UEditorEngine::EndPlayMap() (0x000007fee69d7606) + 414 bytes [c:\programmering\drevil\ue4_engine\engine\source\editor\unrealed\private\playlevel.cpp:232]
UE4Editor-UnrealEd.dll!UEditorEngine::Tick() (0x000007fee678c10a) + 0 bytes [c:\programmering\drevil\ue4_engine\engine\source\editor\unrealed\private\editor.cpp:1468]
UE4Editor-UnrealEd.dll!UUnrealEdEngine::Tick() (0x000007fee6c1d9d6) + 0 bytes [c:\programmering\drevil\ue4_engine\engine\source\editor\unrealed\private\unrealedengine.cpp:307]
UE4Editor.exe!FEngineLoop::Tick() (0x000000013f39b564) + 0 bytes [c:\programmering\drevil\ue4_engine\engine\source\runtime\launch\private\launchengineloop.cpp:2214]
UE4Editor.exe!GuardedMain() (0x000000013f38f9de) + 0 bytes [c:\programmering\drevil\ue4_engine\engine\source\runtime\launch\private\launch.cpp:131]
UE4Editor.exe!GuardedMainWrapper() (0x000000013f38fa4a) + 5 bytes [c:\programmering\drevil\ue4_engine\engine\source\runtime\launch\private\windows\launchwindows.cpp:126]
UE4Editor.exe!WinMain() (0x000000013f39cbb9) + 17 bytes [c:\programmering\drevil\ue4_engine\engine\source\runtime\launch\private\windows\launchwindows.cpp:202]
UE4Editor.exe!__tmainCRTStartup() (0x000000013f39db79) + 21 bytes [f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c:618]
kernel32.dll!UnknownFunction (0x00000000774d59ed) + 0 bytes [UnknownFile:0]
ntdll.dll!UnknownFunction (0x000000007760c541) + 0 bytes [UnknownFile:0]
ntdll.dll!UnknownFunction (0x000000007760c541) + 0 bytes [UnknownFile:0]

However, I have found some really strange reference graphs that makes me confused, where the reference graph looks like this:

[2015.01.19-18.35.48:543][ 69]LogReferenceChain: (root) UnrealEdEngine /Engine/Transient.UnrealEdEngine_0->Trans
[2015.01.19-18.35.48:825][ 69]LogReferenceChain:   TransBuffer /Engine/Transient.TransBuffer_0->UE4Editor-UnrealEd.dll!UnknownFunction (0x000007fed3cdcdc0) + 0 bytes [UnknownFile:0]
[2015.01.19-18.35.48:825][ 69]LogReferenceChain:     BP_Charge_C /Engine/Transient.BP_Charge_C_0->CallFunc_GetWeapon_ReturnValue2
[2015.01.19-18.35.48:825][ 69]LogReferenceChain:       BP_Spear_C /Game/Maps/UEDPIE_0_StartLevel.StartLevel:PersistentLevel.BP_Spear_C_0->Outer
[2015.01.19-18.35.48:826][ 69]LogReferenceChain:         Level /Game/Maps/UEDPIE_0_StartLevel.StartLevel:PersistentLevel->OwningWorld
[2015.01.19-18.35.48:826][ 69]LogReferenceChain:           (target) World /Game/Maps/UEDPIE_0_StartLevel.StartLevel

However, changing this BP:

to this BP:

removes this error.

The GetWeapon function that is refered is just a small C++ helper that looks like this:

int32 UEvilSkill::GetDamage_Implementation() const
{
	AEvilWeapon* Weapon = GetWeapon();
	check( Weapon );
	return Weapon->GetDamage() * DamageMultiplier;
}

So that I get less nodes in my blueprints.

I have tried this in both 4.6.1 and 4.7.p3

Do you have any recommendations on how to track down these kind of garbage collection crashes. As the reference graph is really misleading as it’s the shortest path, and not the path that makes the error occur. Is there any way to show a more exhaustive reference graph.

Also, is there a way for me to track down why the BP_Castle instance happens to go into the Trans-buffer (as that’s seems to be the reason for the crash) when it’s totally unrelated to the BP_Charge instance that I change runtime.

If you want, then I can send you the entire project where you can see the issue, but it’s around 600mb unzipped.

I’m sorry for the long and really confusing post, but I have a really hard time describing the issue and collecting the relevant information.

Cheers,

I have managed to track down this to a issue where objects that live in the Engine/Transient package are added to the transaction buffer when changing a property and then preventing them from getting cleaned up when ending play.

My current solution is to go through the transaction buffer when shutting down PIE and removing these actors from the transaction buffer. It solves my crash. I’m going to try to reproduce this issue with a minimal reproduction case and accompany my fix with the reproduction case. But first, I have a urge to actually work on my game for a short while.

Cheers,

Hi ,

I tried to reproduce this issue and was not successful. If you get a reproduce this, please let us know. I will leave this issue as resolved for now, but whenever you come back to it you can re-open the issue with more information.

Hi ,

I am glad to hear that you were able to start moving forward with your game again. If you do find an opportunity to dig into this issue again, we would appreciate any additional information you can provide about it. I think the process should be a bit smoother than what you have been dealing with.

My spare time is currently clogged, but the next time I’ll sit down, I will try to reproduce the issue in a clean engine.

Hi,
I’m having a similar issue with Trans buffer when stopping a PIE.
I’m still on UE 4.5, but looked quickly through code changes on github and I don’t think this behavior changed since.

I’m working on the c++ side, and changing properties on more than 1 actor spawned dynamically from code triggers the issue.

Here is my repro:

  1. start PIE
  2. from C++ code, spawn several actors
  3. change a bool property value on at least 2 of the actors through the UE editor property window
    (Note: it doesn’t complain in EndPlayMap() if only 1 actor is modified)
  4. stop PIE
    => GC warning / crash

I tried spawning the actors without ‘RF_Transactional’ flag,
or marking the bool UProperty with ‘NonTransactional’ flag,
but it doesn’t fix the issue.

Looking at source code, in SPropertyEditorBool::OnCheckStateChanged(), it doesn’t pass down the property transactional flag.
Maybe it should pass down PropertyHandle->GetProperty()->HasAllPropertyFlags(CPF_NonTransactional) to PropertyHandle->SetValue() ?

If this is the way to solve the issue, this change might have to be mirrored to other types of properties.

Cheers,

Max

My issue might be only because of transient actor selection and possibly fixed in later UE version (See: Editor crashes exiting play mode after selecting objects in Scene Outliner - Character & Animation - Epic Developer Community Forums).
I’ll see if it fixes it for me when I’ll find the time to update.

My issue seems to be fixed in 4.6.1.