Encounter FName overflow crash with version 2.7.0 after running the build for 12 hour

Hello everyone,

We are using Unreal 5.3.1 and Cesium 2.7.0, and we have encountered an FName overflow in builds which causes the build to crash every time. This issue consistently occurs after running the build for 12 hours +. Due to the special use case of our project, we would prefer the build to be able to run for at least 48 hours without crashing. It would be greatly appreciated if anyone has an idea of how to fix this.

Thank you!

> [2024.07.15-22.49.07:842][560]LogWindows: Windows GetLastError: The operation completed successfully. (0)
> [2024.07.15-22.50.07:862][560]LogWindows: Error: === Critical error: ===
> [2024.07.15-22.50.07:862][560]LogWindows: Error: 
> [2024.07.15-22.50.07:862][560]LogWindows: Error: Assertion failed: CurrentBlock < FNameMaxBlocks [File:D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Private\UObject\UnrealNames.cpp] [Line: 684] 
> [2024.07.15-22.50.07:862][560]LogWindows: Error: FName overflow, allocated 1024MB of string data. FName strings are never freed and should be created sparingly. Some system might be generating too many FNames, see call stack. 
> [2024.07.15-22.50.07:862][560]LogWindows: Error: 
> [2024.07.15-22.50.07:862][560]LogWindows: Error: 
> [2024.07.15-22.50.07:862][560]LogWindows: Error: 
> [2024.07.15-22.50.08:080][560]LogExit: Executing StaticShutdownAfterError
> [2024.07.15-22.50.08:152][560]LogWindows: FPlatformMisc::RequestExit(1, LaunchWindowsStartup.ExceptionHandler)
> [2024.07.15-22.50.08:152][560]LogWindows: FPlatformMisc::RequestExitWithStatus(1, 3, LaunchWindowsStartup.ExceptionHandler)
> [2024.07.15-22.50.08:152][560]LogCore: Engine exit requested (reason: Win RequestExit)

Hi @Luna_Wu , thanks for reporting this.

We have encountered a similar memory error with FName previously, which we fixed in this PR. We still do use FNames in the code base though.

Do you happen to have a stack trace handy?

Also, what map assets are you using? Your own or Cesium ion content?

Hi @Brian_Langevin, Thank you for your reply. I donā€™t have the stack trace for it right now, but I can confirm Iā€™m using the Cesium map and Cesium geofence. Here are some details on how I am using it in the project:

Iā€™m using the Cesium terrain in the level and CesiumGeoreference. In my C++ code, Iā€™m calling the function CesiumGeoreference->SetOriginLongitudeLatitudeHeight(CoordinateToSet); to set the coordinate on tick. Right now, the build crashes after it runs for around 12 hours.

Let me know if this is helpful and if there is anything else I can provide you. Thank you for your help!

Hi @Luna_Wu,

Apologies for the delayed follow-up on this, and thanks for the information thus far. Iā€™m trying to follow the history of this ticket ā€“ it looks like youā€™re running out of memory due to FName memory? As Brian mentioned, we did release a PR to prevent tiles from creating numerous FName objects, so Iā€™m not sure what else could be contributing to that issue.

It would help to know two things:

  1. Are you still experiencing this error on the latest version of the plugin? (v2.7.1)
  2. Are there any other objects in your level that are being created / destroyed at runtime?

Thank you again for your patience!

1 Like

Hi @janine , Thank you so much for following up. Here is some updates and things we tried over the last week:

I tried followed the link Brian gave me. I checked the code of CesiumGltfComponent.cpp on my end. I saw in the PR the developer remove ā€œmeshNameā€ at multiple location in CesiumGltfComponent.cpp , but in mine CesiumGltfComponent.cpp ā€œmeshNameā€ was replaced be"componentName". So I tried to remove all reference to ā€œcomponentNameā€ and made a build yesterday.

This time instead of getting the FName overflow error, the build crashed after running for 5 hrs with this error

[2024.08.06-20.16.31:023][248]LogStats: FPlatformStackWalk::StackWalkAndDump -  1.716 s
[2024.08.06-20.16.31:023][248]LogOutputDevice: Error: === Handled ensure: ===
[2024.08.06-20.16.31:023][248]LogOutputDevice: Error: 
[2024.08.06-20.16.31:023][248]LogOutputDevice: Error: Ensure condition failed: 0  [File:D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\GarbageCollection.cpp] [Line: 4194] 
[2024.08.06-20.16.31:023][248]LogOutputDevice: Error: Spent to much time waiting for FinishDestroy for 1 object(s) (last object: CesiumIonRasterOverlay None.None:None.None.None), check log for details
[2024.08.06-20.16.31:023][248]LogOutputDevice: Error: Stack: 
[2024.08.06-20.16.31:023][248]LogOutputDevice: Error: [Callstack] 0x00007ff60e701994 crossing.exe!FProperty::ImportText_Internal() []
[2024.08.06-20.16.31:023][248]LogOutputDevice: Error: [Callstack] 0x00007ff60e7020f5 crossing.exe!IncrementalPurgeGarbage() []
[2024.08.06-20.16.31:023][248]LogOutputDevice: Error: [Callstack] 0x00007ff60e80f76c crossing.exe!StaticExit() []
[2024.08.06-20.16.31:023][248]LogOutputDevice: Error: [Callstack] 0x00007ff60ddc2127 crossing.exe!TBaseStaticDelegateInstance<void __cdecl(void),FDefaultDelegateUserPolicy>::ExecuteIfSafe() []
[2024.08.06-20.16.31:023][248]LogOutputDevice: Error: [Callstack] 0x00007ff60ddb62f5 crossing.exe!TMulticastDelegate<void __cdecl(void),FDefaultDelegateUserPolicy>::Broadcast() []
[2024.08.06-20.16.31:023][248]LogOutputDevice: Error: [Callstack] 0x00007ff615125627 crossing.exe!FEngineLoop::AppPreExit() []
[2024.08.06-20.16.31:023][248]LogOutputDevice: Error: [Callstack] 0x00007ff61512fb03 crossing.exe!FEngineLoop::Exit() []
[2024.08.06-20.16.31:023][248]LogOutputDevice: Error: [Callstack] 0x00007ff615130af7 crossing.exe!GuardedMain() []
[2024.08.06-20.16.31:023][248]LogOutputDevice: Error: [Callstack] 0x00007ff615130b4a crossing.exe!GuardedMainWrapper() []
[2024.08.06-20.16.31:023][248]LogOutputDevice: Error: [Callstack] 0x00007ff6151339f6 crossing.exe!LaunchWindowsStartup() []
[2024.08.06-20.16.31:023][248]LogOutputDevice: Error: [Callstack] 0x00007ff6151435e4 crossing.exe!WinMain() []
[2024.08.06-20.16.31:023][248]LogOutputDevice: Error: [Callstack] 0x00007ff61b4f82ba crossing.exe!__scrt_common_main_seh() [D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
[2024.08.06-20.16.31:023][248]LogOutputDevice: Error: [Callstack] 0x00007fff8a8a257d KERNEL32.DLL!UnknownFunction []
[2024.08.06-20.16.31:023][248]LogOutputDevice: Error: [Callstack] 0x00007fff8b26af28 ntdll.dll!UnknownFunction []

We are not sure if us modifying the CesiumGltfComponent.cpp is the right move, itā€™s just something we tried to avoid the FName bug.

And to answer your question:

  1. we were on v2.7.0, I update it to 2.7.1 today and I can run a test with the update as well
  2. we do have other game objects being created and destroyed, but that doesnā€™t happens often and mostly happens in the first 10 min when we fired up the build. So I donā€™t think they will be causing the crash after the build running for a long time

Thank you so much for your help. Looking forward to your reply

we are still experiencing it with the latest version

Hi @Luna_Wu,

Thank you so much for confirming. Iā€™m putting a note for our team to triage this at the earliest opportunity. :pray:

Thank you so much! Do you know when we will hear back about how to fix it?

Hi @Luna_Wu,

We suspect it may have to do with the materials. Especially this line:

Weā€™re creating a unique FName for every material instance in Cesium for Unreal. However, this actually seems necessary. In Unrealā€™s MaterialDynamicInstance.cpp file, it contains this line:

		// If a MID is made with the same name and outer as another, it will overwrite it. To avoid this we will change the name when there is a collision.
		Name = MakeUniqueObjectName(Outer, UMaterialInstanceDynamic::StaticClass(), Name);

So itā€™s not as simple as spawning all of the materials with the same name. I think the true solution for this would be to create a pool of UMaterialInstanceDynamic instances, and to reuse existing ones when tiles load in / out.

Iā€™ve created an issue on Github here to track this. Weā€™ll be sure to post updates to this thread when there is progress. Thank you! :pray:

Thank you for looking into this. This is really helpful, Iā€™m looking forward to see more progress on this!

Something we would like to ask is that, if FName ImportedSlotName is just a constant, will that fix the problem? or will it keep overwriting the old material? Cause we are thinking if itā€™s just gonna overwrite the old material, we are fine with it if that will solve the FName overflow problem. Thank you in advance.

Hi @Luna_Wu,

Something we would like to ask is that, if FName ImportedSlotName is just a constant, will that fix the problem? or will it keep overwriting the old material?

From what I can tell, the materials all require different names so theyā€™re distinguishable to the renderer. If you use the same name, it will overwrite the existing material.

We have to use a material instance per-tile because every model contains its own textures, parameters, etc. So using the same material instance for every tile will likely render the tileset incorrectly. :sweat_smile: But if you try this out and experience different results, let us know!