Commit Graph

1283 Commits

Author SHA1 Message Date
per larsson
e5610c178b Do not crash when waiting or cancelling a bulk data request that has not been started.
#rb Paul.Chipchase

[CL 33257668 by per larsson in ue5-main branch]
2024-04-26 02:30:13 -04:00
steve robb
bc28537104 Fixed some Printf specifiers.
#rb brandon.schaefer

[CL 33211124 by steve robb in ue5-main branch]
2024-04-24 15:59:50 -04:00
danny couture
73452066ac [ZenLoader]
- Detect when loader is hung and dump its state if it happens
 - Add support for full flush from inside the last loaded package's callback if it ever happens
 - Add unittest for that use case

#jira UE-207196, UE-207324
#rb kevin.macaulayvacher

[CL 33195963 by danny couture in ue5-main branch]
2024-04-24 07:02:54 -04:00
pj kack
53420ec141 ZenLoader: Move CreateExportBundleNodes from FinishInitializeAsyncPackage to InitializeAsyncPackageFromPackageStore.
It does not actually require any package summary information since it only relies on TotalExportBundleCount which is known already in InitializeAsyncPackageFromPackageStore.

Fix nullptr crash in FAsyncLoadingThread2::FindOrInsertPackage for the rare special case path where the following dependency is added:
ImportedByPackage->GetExportBundleNode(ExportBundle_Process, DependentExportBundleIndex).DependsOn(&Package->GetExportBundleNode(ExportBundle_DeferredPostLoad, DependsOnExportBundleIndex));

#rb danny.couture, Per.Larsson
#tests Running Client, Server, Editor, CookedEditor

[CL 33194567 by pj kack in ue5-main branch]
2024-04-24 05:09:08 -04:00
bob tellez
95d39a6309 [Backout] - CL33172731
[FYI] danny.couture
Original CL Desc
-----------------------------------------------------------------
[ZenLoader]
 - Detect when loader is hung and dump its state if it happens
 - Add support for full flush from inside the last loaded package's callback if it ever happens
 - Add unittest for that use case

#jira UE-207196, UE-207324
#rb kevin.macaulayvacher

[CL 33176615 by bob tellez in ue5-main branch]
2024-04-23 15:29:08 -04:00
danny couture
873ef5b608 [ZenLoader]
- Detect when loader is hung and dump its state if it happens
 - Add support for full flush from inside the last loaded package's callback if it ever happens
 - Add unittest for that use case

#jira UE-207196, UE-207324
#rb kevin.macaulayvacher

[CL 33172749 by danny couture in ue5-main branch]
2024-04-23 13:06:51 -04:00
paul chipchase
b6e31da7d8 [Backout] - CL33134216 (removing the new check until the broken calling code can be fixed)
Original CL Desc
-----------------------------------------------------------------
Improve error reporting when making an invalid bulkdata stream request.

#rb Per.Larsson
#rnx

- If a user tries to make a read request from FBulkDataBatchRequest that goes past the end of the bulkdata's payload we will eventually assert, but only at the point of reading which is often quite far away (context wise) from the code that initiated the request.
- Previously we were asserting if the user made a read request that exceeded the size of the bulkdata payload but this did not take into account reading from an offset.
- Fixed the assert to take offset into account so we now asset on invalid reads at the point that the read is first requested. In addition I have added more debug info to the assert making it easier to tell from the log file what was incorrect about the read request.
- This shouldn't raise any new issues as it's effectively just moving an assert that already exists earlier in execution.

[CL 33168986 by paul chipchase in ue5-main branch]
2024-04-23 10:54:27 -04:00
danny couture
a01131037f [ALT]
- Deprecate GIsEditorLoadingPackage global and use accessors instead so we can ensure thread-safety
 - Make GIsEditorLoadingPackage compatible with ALT
 - Prevent GIsEditorLoadingPackage from being misused

#jira UE-203917
#rb kevin.macaulayvacher

[CL 33165370 by danny couture in ue5-main branch]
2024-04-23 07:41:00 -04:00
kevin macaulayvacher
83b68b0b28 Changes the zenloader interpretation of the flag RF_WasLoaded to match the -nozenloader meaning by setting the RF_WasLoaded flag on the linker root object once the package load is complete. Previously zenloader set this flag during creation of the package but before any loading had occurred (since 10482167).
This change resolves issues where codepaths would look for `RF_WasLoaded` to understand if a package had completed loading or not when in fact the package has not been loaded, but instead may only be partially loaded. Specifically, LinkerLoad::ResolveDeferredDependencies was changed to explicitly not load loaded or already loaded packages.

Any code guarding access to an partially loaded object will now be correct if guarding against objects missing RF_WasLoaded. However this change does means code looking for partially loaded objects will now need to look for RW_WillBeLoaded specifically. I imagine the amount of code that cares about partially loaded objects is quite low in practice compared to knowing if an object is fully loaded. Follow-up work aims to remove RF_WillBeLoaded completely in favour of another mechanism to check for in-flight work UE-212618


A test System.Engine.Loading.LoadBlueprintWithCircularDependency has been added that exhibits a hang if RF_WillBeLoaded is not checked for in ResolveDeferredDependencies before calling LoadPackage since will cause a flush to happen potentially as part of an already on-going flush which can lead to partial loads being unable to be unblocked and the loader softlocking
#jira UE-211383
#rb Francis.Hurteau
#tests System.Engine.Loading.LoadBlueprintWithCircularDependency
[FYI] Francis.Hurteau

[CL 33141808 by kevin macaulayvacher in ue5-main branch]
2024-04-22 12:19:54 -04:00
paul chipchase
04a4aee1c2 Improve error reporting when making an invalid bulkdata stream request.
#rb Per.Larsson
#rnx

- If a user tries to make a read request from FBulkDataBatchRequest that goes past the end of the bulkdata's payload we will eventually assert, but only at the point of reading which is often quite far away (context wise) from the code that initiated the request.
- Previously we were asserting if the user made a read request that exceeded the size of the bulkdata payload but this did not take into account reading from an offset.
- Fixed the assert to take offset into account so we now asset on invalid reads at the point that the read is first requested. In addition I have added more debug info to the assert making it easier to tell from the log file what was incorrect about the read request.
- This shouldn't raise any new issues as it's effectively just moving an assert that already exists earlier in execution.

[CL 33134247 by paul chipchase in ue5-main branch]
2024-04-22 03:53:34 -04:00
charles bloom
fe8064565a EditorBulkData : make sure Payload.Size and PayloadSize stay in sync ; missed Reset when loading transaction with PayloadSize zero
[CL 33131411 by charles bloom in ue5-main branch]
2024-04-21 12:39:40 -04:00
josh adams
eca6d6b781 - Benign engine changes that came from new platform experimentation
#rb Chris.Babcock

[CL 33037334 by josh adams in ue5-main branch]
2024-04-17 11:17:07 -04:00
charles bloom
3fb7c173f2 EditorBulkData : serialize compressed data to the undo buffer without decompressing
resubmit of earlier change 32762180 after rollback
modified to work around bug in FCompressedBuffer corrupting serialization when payload size is zero

#rb paul.chipchase

[CL 33007777 by charles bloom in ue5-main branch]
2024-04-16 14:05:30 -04:00
jamie dale
932e6a9111 Fixed warning about using an ordinal FText::Format with named pattern arguments
[FYI] matt.breindel
#rnx

[CL 32931150 by jamie dale in ue5-main branch]
2024-04-12 11:19:38 -04:00
charles bloom
088e18c30c [Backout] - CL32762180
[FYI] charles.bloom
Original CL Desc
-----------------------------------------------------------------
EditorBulkData : serialize compressed data to the undo buffer without decompressing

#rb paul.chipchase

[CL 32890531 by charles bloom in ue5-main branch]
2024-04-11 10:49:43 -04:00
matt peters
06e24ea711 Cooker SkipOnlyEditorOnly: AsyncLoading2: Fix imports to report their referencer as the package that imported them rather than the package that called the outermost loadpackage. This is necessary for us to detect that packages loaded by editoronly references from their sourcepackage should be skipped and not added to the cook.
#rnx
#rb danny.couture

[CL 32866388 by matt peters in ue5-main branch]
2024-04-10 18:25:47 -04:00
francis hurteau
4349bf480d Only make ZenLoader the default loader in editor cases
#jira UE-211343
#rb Zousar.Shaker
[FYI] Danny.Couture

[CL 32777672 by francis hurteau in ue5-main branch]
2024-04-05 18:58:23 -04:00
charles bloom
7ec83ac2af EditorBulkData : serialize compressed data to the undo buffer without decompressing
#rb paul.chipchase

[CL 32762204 by charles bloom in ue5-main branch]
2024-04-05 12:08:32 -04:00
paul chipchase
ee70eb2ee5 Add checks before allocating buffers during bulkdata serialization.
#rb Per.Larsson
#rnx

- If archive is corrupt we could serialize an unreasonable value for the payload size from disk. This could cause very large allocations to be made which could cause the process to OOM or to allocate resources that it doesn't need.
- To avoid this we can check the archive we are serializing from and make sure that, at the very least, it will be possible to load all of the payload bytes from it. This way we will never make an allocation larger than the remaining space in the archive. It would then be up to the higher level code to validate that overall size of the provided file makes sense.
- Note that we are not able to do this is we are loading a payload from legacy bulkdata format that was marked as compressed as we only know the uncompressed payload size, not the compressed size on disk.

[CL 32755840 by paul chipchase in ue5-main branch]
2024-04-05 06:33:52 -04:00
steve robb
fdb0b82bc4 Fixed subtree parsing in FJsonArchiveInputFormatter.
#rb robert.manuszewski

[CL 32664317 by steve robb in ue5-main branch]
2024-04-02 08:45:26 -04:00
daniele pieroni
50ab97d38c Manual integration of 32610366 by Per.Larsson
Potential fix when issuing empty texture streaming requests with batch API.

[CL 32638117 by daniele pieroni in ue5-main branch]
2024-04-01 09:50:50 -04:00
alex kahn
593a09d09d [Backout] - CL32585960 - CIS Compile Error
#rnx
[FYI] Steve.Robb
Original CL Desc
-----------------------------------------------------------------
Added FUtf8StrProperty and FAnsiStrProperty.

#rb robert.manuszewski
#jira UE-204743

[CL 32590075 by alex kahn in ue5-main branch]
2024-03-28 15:39:39 -04:00
steve robb
33f991cfd9 Added FUtf8StrProperty and FAnsiStrProperty.
#rb robert.manuszewski
#jira UE-204743

[CL 32586529 by steve robb in ue5-main branch]
2024-03-28 14:26:59 -04:00
michael nicolella
22eed94a4c autortfm: rework the way UObject construction works
The goal here is that if a UObject is constructed during a transaction, and then decides to abort, we leave the UObject in an intact-enough state that the GC can come along later to destruct and deallocate the object.

To that end, we move StaticConstructObject_Internal back to instrumented, but execute the UObject malloc and UObjectBase constructor uninstrumented. Then later when the derived constructor runs over the same memory, we run the constructor instrumented, except when it gets down to the UObject constructor level, we run that uninstrumented.

If we abort, the UObject memory will not be freed by the AutoRTFM runtime, the destructor will not be called, but the memory will be rolled back to what the UObject and base constructors initialize it as, so it should be a bare bones object ready for destruction and deallocation.

- added a new attribute to the compiler (autortm_always_open) so we can annotate functions themselves (like constructors) to ensure the entire function isn't instrumented (including code we can't normally wrap, like when the constructor writes the vtable pointer)
#rb Brandon.Schaefer, neil.henning

[CL 32426570 by michael nicolella in ue5-main branch]
2024-03-21 23:46:29 -04:00
danny couture
d1f5b751a9 [GarbageCollect]
- Move PreGarbageCollect broadcast outside of the GC lock because it's too easy for user code to cause deadlocks by calling into other part of the engine.
 - Introduce a new event when GC has started and the GC lock is held
 - Use the new event for zenloader as it provides thread-safety guarantees with async loading thread

#rb Robert.Manuszewski

[CL 32362280 by danny couture in ue5-main branch]
2024-03-20 08:07:04 -04:00