Commit Graph

1063 Commits

Author SHA1 Message Date
carlmagnus nordin
034541cc85 ZenLoader in editor: Fixed issue where fully loaded packages could sometimes be reloaded after a GC
#preflight 64072e4d5515f4f57b30e045
#rnx
#rb pj.kack

[CL 24541924 by carlmagnus nordin in ue5-main branch]
2023-03-07 11:59:08 -05:00
francis hurteau
63988aa391 Do not broadcast OnAsyncLoadingFlush delegate when they are done in the context of a sync load when using the zen loader
#rb Robert.Millar, Matt.Peters
#preflight 63ff94bcef1b24bf94a3cc39

[CL 24471295 by francis hurteau in ue5-main branch]
2023-03-01 16:51:52 -05:00
francis hurteau
44122576f1 ZenLoader in Editor: Respect the LoadObject flags LOAD_Quiet and LOAD_Warn flags to silence warnings about missing packages in this scenario.
Always silence warning about missing package for script packages, just like GetPackageLinker() simply returns nullptr for PKG_InMemoryOnly.
submitted on behalf of [at]PJ.Kack

#rb Matt.Peters
#preflight 63fe8765ae54ee4ce9e59742

[CL 24469377 by francis hurteau in ue5-main branch]
2023-03-01 15:38:55 -05:00
paul chipchase
dbea2470ab Bulkdata will no longer fatal error if the archive is in an error state before serialization starts.
#rb Per.Larsson
#preflight 63f8922ab879197e73369f7e

- CL 24316937 made an effort to prevent serialization of bad data from corrupting memory, however the checks were a little too zealous. In some cases the archive provided for serialization is already in an error state in which case we should trust that the calling code has processes the problem correctly. Handling the error at this point from within bulkdata can give misleading errors.
- We now check if the archive is in the error state or not BEFORE we start serialization and if it is in error we just return early with default values.
- This should ensure that the problem is reported by the system creating it rather than always by bulkdata and make things easier to diagnose/fix/

[CL 24406791 by paul chipchase in ue5-main branch]
2023-02-24 15:02:22 -05:00
paul chipchase
af3b1efb6c Fix potential memory corruption issue when allocating bulkdata payloads on 32bit systems.
#rb Per.Larsson
#rnx
#preflight 63f3b1fa52460c3a1f4684ce

- The problem is that our allocation functions take allocation sizes as type SIZE_T which on older 32bit platforms will be int32, but bulkdata stores sizes as int64. If the requested allocation is large enough the size will be truncated and the allocation could still return a valid memory allocation but one much smaller than requested. Later when we try to load into that allocation we will overwrite the end of the buffer. Given our supported platforms and how bulkdata is generally used this is an unlikely scenario but one we still should protect against.
- Added two functions ::SafeMalloc and ::SafeRealloc to replace direct calls to malloc/realloc. These utility functions will check to make sure that we can make allocations of the requested size by making sure that SIZE_T (the type that our allocators take for allocation sizes) is a large enough type.
- If the platform cannot service the request we will issue a fatal log error and halt the process. Technically we could error and return nullptr but in practice very little code checks to see if bulkdata allocations are valid or not and will end up crashing anyway. Given that this problem is only going to show up on 32bit machines and only for very large assets (most likely invalid or broken ones at that) we might as well halt execution as close to the problem as possible to make debugging easier.
- The changes are only applied for platforms where PLATFORM_32BITS is true, should be no cost to 64 bit platforms.

[CL 24335588 by paul chipchase in ue5-main branch]
2023-02-21 03:35:51 -05:00
paul chipchase
f1bbba509a Don't set an invalid size on FBulkData if the serialized element count is too large.
#rb Per.Larsson
#jira UE-172853
#rnx
#preflight 63f3834a61378b7ea0065346

- The main issue we are trying to solve is that we serialize the number of elements when saving/loading the package. On load we multiple the number of elements (int64) by the size of each element (int64) and if either of those values is large enough we could overflow and end up with an incorrect size. We do check for this when saving the package so this is only likely to come up if the package has been corrupted in some way.
- Change FBulkMetaData::FromSerialized to do the actual serialization as well. This lets us set the error flag on the archive if we do detect problems and keep all the error handling in a single place.
-- Note that setting the error flag on an archive while a package is being loaded doesn't seem to do much at the moment, so this is more of an attempt to future proof.
- If we detect an error with serializing FBulkMetaResource we will log an error and immediately return so that FBulkMetaData will remain set to defaults.
- We now calculate the largest value of ElementCount that we can support, given the ElementCount size and if the count is exceeded we will log an error, set the error flag on the archive and return leaving FBulkMetaData as default.
- Note that both before and after this change the package is effectively broken and won't work properly, but this change will stop us from potentially stomping memory.
- Note that at runtime we generally serialize the bulkdata info from the BulkDataMap in the package header, so this is mostly an editor thing.

[CL 24322887 by paul chipchase in ue5-main branch]
2023-02-20 15:37:35 -05:00
mattias hornlund
ab4e47d140 Implemented FExportArchive::GetArchiveName() to get more information in logs.
#rb CarlMagnus.Nordin
#preflight 63ef55c761378b7ea0111a96

[CL 24281951 by mattias hornlund in ue5-main branch]
2023-02-17 10:24:37 -05:00
carlmagnus nordin
3f61dc09ed ZenLoader: Ensure that postload and serialize never overlaps for exports in related packages.
#preflight 63ef42c390198dffbad4a669
#jira UE-166872
#rb pj.kack

[CL 24279266 by carlmagnus nordin in ue5-main branch]
2023-02-17 06:21:19 -05:00
carlmagnus nordin
7c289ced67 ZenLoader: Fixed some potential integer overflows
#preflight 63eb5a91b91ae11c1c1f5714
#rb pj.kack

[CL 24253458 by carlmagnus nordin in ue5-main branch]
2023-02-16 04:19:21 -05:00
joe pribele
6907d0f2cd add FNullArchive which does nothing
added because FArchive by default asserts on FObjectPtr

#rb zousar.shaker
#preflight 63ebc8e4b64ac0eccbfda48a

[CL 24215955 by joe pribele in ue5-main branch]
2023-02-14 13:11:36 -05:00
danny couture
83796ab514 Fix an issue where async loading leftover after tick timeout were mistaken for objects being loaded during postload
#rnx
#jira UE-176193
#rb CarlMagnus.Nordin
#preflight 63e4e51407207b2570f29255

UDN: https://epicgames.lightning.force.com/lightning/r/Case/5004z00001m9hZeAAI/view
#lockdown mark.lintott

[CL 24106085 by danny couture in ue5-main branch]
2023-02-09 16:15:58 -05:00
per larsson
168a79989f AsyncLoading2 - set correct inline bulk data offset
#rb CarlMagnus.Nordin
#preflight 63e3d7c8244dc45a202155e0
#rnx

[CL 24094297 by per larsson in ue5-main branch]
2023-02-09 04:59:55 -05:00
carlmagnus nordin
8cc64965c5 Backout 24069883
#rb none

[CL 24071356 by carlmagnus nordin in ue5-main branch]
2023-02-08 08:10:32 -05:00
carlmagnus nordin
3d4f7825f6 ZenLoader: Ensure that postload and serialize never overlaps for exports in related packages.
#preflight 63e353131b44ee7cb1219571
#jira UE-166872
#rb pj.kack

[CL 24070078 by carlmagnus nordin in ue5-main branch]
2023-02-08 05:00:40 -05:00
carlmagnus nordin
dd2525feb5 ZenLoader: Always run with GEventDrivenLoaderEnabled set to false
#rb pj.kack
#preflight 63e1fcc59910415ae2ec1f46

[CL 24046027 by carlmagnus nordin in ue5-main branch]
2023-02-07 04:19:19 -05:00
joe pribele
0136c5c178 added ObjectSerializeScope which will log a warning when enabled about accessing referenced objects during serialize
#preflight 63d99ce765738ba95103714b

[CL 23940953 by joe pribele in ue5-main branch]
2023-01-31 18:14:37 -05:00
patrick enfedaque
b97d64f7a1 FLinkerInstancingContex: refactor SoftObjectPath fixup code so it is shared between AsyncPackage2 and FLinkerload
- Fixes cooked softobjectpath fixup on instanced WorldPartitions when not using iostore

#rb jamie.dale, francis.hurteau
#preflight 63d813185c69f453c11796a1

[CL 23927477 by patrick enfedaque in ue5-main branch]
2023-01-31 10:39:37 -05:00
danny couture
74782129ec Fix race in FCounters used in FileSystemCacheStore and AsyncLoading
#rnx
#rb Devin.Doucette
#preflight 63d1d57e6a14d8406d8fc7d4

[CL 23863764 by danny couture in ue5-main branch]
2023-01-25 21:07:51 -05:00
Per Larsson
705ce4b89b ArchiveStackTrace - fixed bug with missing callstack CRC and added basic low level tests
#rb trival
#jira UE-174727
#preflight 63cf8d9eef20a5272dfc4f01
#rnx

[CL 23827777 by Per Larsson in ue5-main branch]
2023-01-24 04:08:29 -05:00
Per Larsson
522fb52c82 Bulk Data - allow cooked loose file in editor builds
#rb Paul.Chipchase
#preflight 63ca935b0434dba5746d3f6a
#jira UE-174069
#rnx

[CL 23802730 by Per Larsson in ue5-main branch]
2023-01-21 02:38:41 -05:00
Tim Smith
0fb5daa752 Removed HACK_HEADER_GENERATOR
#rb devin.doucette
#preflight 63cad02ca265157a6d5159af

[CL 23792667 by Tim Smith in ue5-main branch]
2023-01-20 12:47:21 -05:00
paul chipchase
a0a0a6860a Fix some cast/truncation warnings in the async loading code
#rb carlmagnus.nordin
#rnx
#preflight 63ca7b97e3138815655cf971

- Changed a ranged for loop in FEventLoadGraph::RemoveNode to be index based to avoid pointer arithmetic to index casting.
- FAsyncPackage::PostLoadDeferredObjects and FAsyncPackage::CreateClusters were not modifying the parameter InOutTimeLimit that was being passed in by reference, so it has been changed to be passed by value to avoid confusion.
- Changed a number of methods that were taking float values to doubles, in most cases double variables were being passed into these methods and they were being compared to doubles inside of the methods, so there didn't seem to be much point in the parameter type being float.

### Double->Float explicit cast
- Need to do this when using the IAsyncReadRequest api.
- Need to do this when using FLinkerLoad
- FAsyncLoadingThread::TickAsyncThread otherwise we'd need to change FAsyncLoadingThread::ProcessAsyncLoading to take doubles, which in turn would require a large number of double->float casting when calling out to the rest of the engine.

[CL 23788745 by paul chipchase in ue5-main branch]
2023-01-20 08:12:00 -05:00
Per Larsson
3698741437 Support diff only cooks with separate exports archive
- extracted out callstack offets and stack traces into FArchiveCallstacks
- created FArchiveStackTraceWriter that wraps an archive and writes into a FArchiveCallstacks
- refactored existing FArchiveStackTrace to use the new writer and callstack collection
- added IPackageWriter::CreateLinkerExportArchive in order to create a stack trace archive writer in DiffPackageWriter

#rb Matt.Peters, Francis.Hurteau
#jira UE-173560
#preflight 63c7bd232e714f64ad89fd2c
#rnx

[CL 23787282 by Per Larsson in ue5-main branch]
2023-01-20 03:53:32 -05:00
paul chipchase
97f6f0eebb Fix the generation of duplicate bulkdata identifiers when creating new levels from templates containing bulkdata payloads.
#rb Matt.Peters
#jira UE-174329
#rnx
#preflight 63c95073ac35a0e9da7f2c30

- This replaces the solution to the same problem that was submitted in CL 21587137.
- Instead of trying to pass the need to regenerate the guids via FLinkerInstancingContext it is now done via ELoadFlags.
- The fix was originally added to FLinkerInstancingContext as a) at the time a similar fix had been made to instancing b) we felt it would be easier to remove in the future when we change how the guids are calculated making the need to regenerate moot. However this stopped working when 22635658 prevented the instancing context from being passed to objects not being instanced. The concept was a better fix for the flags so it has been moved there.

[CL 23787156 by paul chipchase in ue5-main branch]
2023-01-20 03:07:24 -05:00
joe pribele
eb2bb506e7 code cleanup of ObjectHandle
made ObjectPathId to private
trimmed down the public API as much as possible

https://p4-swarm.epicgames.net/reviews/23658342

#rb zousar.shaker
#preflight 63c5c8922a6acaf1625fcf25

[CL 23734208 by joe pribele in ue5-main branch]
2023-01-16 19:20:47 -05:00