Assertion failed on OnUnmountPak.Execute()

Hi,

I’m using FCoreDelegates::OnMountPak and FCoreDelegates::OnUnmountPak function to handle my patch/DLC pak file. But in ue 4.15, when i execute the FCoreDelegates::OnUnmountPak.Execute( ) to unmount the pak file. It will encounter an assertion failed. Follow are the call stack of the android platform:

07-19 18:59:32.516: D/UE4(16133): Assertion failed: PakPrecacherSingleton [File:C:\UnrealEngine-4.15\Engine\Source\Runtime\PakFile\Private\IPlatformFilePak.cpp] [Line: 1006] 
07-19 18:59:32.516: D/UE4(16133): libUE4.so!FDebug::LogAssertFailedMessage(char const*, char const*, int, wchar_t const*, ...) 
07-19 18:59:32.516: D/UE4(16133): libUE4.so!FPakPlatformFile::Unmount(wchar_t const*) 
07-19 18:59:32.516: D/UE4(16133): libUE4.so!UPatchingSystem::UnmountOutOfDatePaks(TArray<FString, FDefaultAllocator>&) 
07-19 18:59:32.516: D/UE4(16133): libUE4.so!UPatchingSystem::Synchronize(TArray<FObjectSyncInfo, FDefaultAllocator> const&) 
07-19 18:59:32.516: D/UE4(16133): libUE4.so!void ZResponseProcessor::Process<(unsigned char)140, FAwsS3SyncMessageObject>(FAwsS3SyncMessageObject const&, bool) 
07-19 18:59:32.516: D/UE4(16133): libUE4.so!void UMMOGameplayHttp::DispatchResponse<FAwsS3SyncMessageObject>(unsigned char, FAwsS3SyncMessageObject const&, bool) 
07-19 18:59:32.516: D/UE4(16133): libUE4.so!void UMMOGameplayHttp::Response<FAwsS3SyncMessageObject>(TSharedPtr<IHttpRequest, (ESPMode)0>, TSharedPtr<IHttpResponse, (ESPMode)1>, bool) 
07-19 18:59:32.516: D/UE4(16133): libUE4.so!decltype ((((*this).Obj)->*((*this).MemFunPtr))((Forward<TSharedPtr<IHttpRequest, (ESPMode)0>&>)({parm#1}), (Forward<TSharedPtr<IHttpResponse, (ESPMode)1>&>)({parm#1}), (Forward<bool&>)({parm#1}))) TMemberFunctionCaller<UMMOGameplayHttp, void (UMMOGameplayHttp::*)(TSharedPtr<IHttpRequest, (ESPMode)0>, TSharedPtr<IHttpResponse, (ESPMode)1>, bool)>::operator()<TSharedPtr<IHttpRequest, (ESPMode)0>&, TSharedPtr<IHttpResponse, (ESPMode)1>&, bool&>(TSharedPtr<IHttpRequest, (ESPMode)0>&, TSharedPtr<IHttpResponse, (ESPMode)1>&, bool&) 
07-19 18:59:32.516: D/UE4(16133): libUE4.so!decltype ({parm#1}((Forward<TSharedPtr<IHttpRequest, (ESPMode)0>&>)({parm#2}), (Forward<TSharedPtr<IHttpResponse, (ESPMode)1>&>)({parm#2}), (Forward<bool&>)({parm#2}))) TTupleImpl<TIntegerSequence<unsigned int>>::ApplyAfter<TMemberFunctionCaller<UMMOGameplayHttp, void (UMMOGameplayHttp::*)(TSharedPtr<IHttpRequest, (ESPMode)0>, TSharedPtr<IHttpResponse, (ESPMode)1>, bool)>, TSharedPtr<IHttpRequest, (ESPMode)0>&, TSharedPtr<IHttpResponse, (ESPMode)1>&, bool&>(TMemberFunctionCaller<UMMOGameplayHttp, void (UMMOGameplayHttp::*)(TSharedPtr<IHttpRequest, (ESPMode)0>, TSharedPtr<IHttpResponse, (ESPMode)1>, bool)>&&, TSharedPtr<IHttpRequest, (ESPMode)0>&, TSharedPtr<IHttpResponse, (ESPMode)1>&, bool&) const 
07-19 18:59:32.516: D/UE4(16133): libUE4.so!TBaseUObjectMethodDelegateInstance<false, UMMOGameplayHttp, TTypeWrapper<void> (TSharedPtr<IHttpRequest, (ESPMode)0>, TSharedPtr<IHttpResponse, (ESPMode)1>, bool)>::Execute(TSharedPtr<IHttpRequest, (ESPMode)0>, TSharedPtr<IHttpResponse, (ESPMode)1>, bool) const 
07-19 18:59:32.516: D/UE4(16133): libUE4.so!TBaseUObjectMethodDelegateInstance<false, UMMOGameplayHttp, void (TSharedPtr<IHttpRequest, (ESPMode)0>, TSharedPtr<IHttpResponse, (ESPMode)1>, bool)>::ExecuteIfSafe(TSharedPtr<IHttpRequest, (ESPMode)0>, TSharedPtr<IHttpResponse, (ESPMode)1>, bool) const 
07-19 18:59:32.516: D/UE4(16133): libUE4.so!TBaseDelegate<void, TSharedPtr<IHttpRequest, (ESPMode)0>, TSharedPtr<IHttpResponse, (ESPMode)1>, bool>::ExecuteIfBound(TSharedPtr<IHttpRequest, (ESPMode)0>, TSharedPtr<IHttpResponse, (ESPMode)1>, bool) const 
07-19 18:59:32.516: D/UE4(16133): libUE4.so!FCurlHttpRequest::FinishedRequest() 
07-19 18:59:32.516: D/UE4(16133): libUE4.so!FHttpManager::Tick(float) 
07-19 18:59:32.516: D/UE4(16133): libUE4.so!FTicker::Tick(float) 
07-19 18:59:32.516: D/UE4(16133): libUE4.so!FEngineLoop::Tick() 
07-19 18:59:32.516: D/UE4(16133): libUE4.so!AndroidMain(android_app*) 
07-19 18:59:32.516: D/UE4(16133): libUE4.so!android_main() 
07-19 18:59:32.516: D/UE4(16133): libUE4.so![Unknown]() 
07-19 18:59:32.516: D/UE4(16133): libc.so![Unknown]() 
07-19 18:59:32.516: D/UE4(16133): libc.so![Unknown]() 
07-19 18:59:32.516: D/UE4(16133): [2017.07.19-10.59.32:534][  0]Assertion failed: Assertion failed: PakPrecacherSingleton [File:C:\UnrealEngine-4.15\Engine\Source\Runtime\PakFile\Private\IPlatformFilePak.cpp] [Line: 1006] 
07-19 18:59:32.526: D/UE4(16133): [2017.07.19-10.59.32:543][  0]LogWindows: FAndroidMisc::RequestExit(1)

I found the assertion is cause by PakPrecacherSingleton (in file IPlatformFilePak.cpp) equal to NULL.

192328-pakprecachersingleton_is_null.jpg

And I also found:

#define USE_PAK_PRECACHE (!IS_PROGRAM && !WITH_EDITOR) // you can turn this off to use the async IO stuff without the precache

at line 50 (also in IPlatformFilePak.cpp) seems can be disable to skip the precache.

192327-gpakcache_enable_is_true.jpg

But I really don’t want to modify the source code of the engine. Is there any way to resolve this issue? Thanks. :slight_smile:

Here is the code how I use FCoreDelegates::OnUnmountPak

PS: DebugGame and Shipping has the same issue.

figure anything out?

The sad thing is this problem still persists in 4.27, in IOS. The precacher is null causing the whole application to crash.
This is the error shown by the log file:

[UE4] [2021.11.28-14.37.18:548][136]LogPakFile: PakFile FullDirectoryIndexSize=1209

[UE4] [2021.11.28-14.37.18:548][136]LogShaderLibrary: Display: ShaderCodeLibraryPakFileMountedCallback: PakFile ‘/var/mobile/Containers/Data/Application/9A9E3962-79DA-418D-BB02-DB9FD8242646/Documents/Saved/pakchunk1001-ios.pak’ (chunk index 1001, root ‘…/…/…/TestingFirebase/Content/’) mounted

[UE4] [2021.11.28-14.37.18:550][136]LogMetal: Display: No .metalmap file found for global_chunk1001_sf_metal!

[UE4] [2021.11.28-14.37.18:551][136]LogMetal: Display: Failed to create library: Error Domain=MTLLibraryErrorDomain Code=6 “library not found” UserInfo={NSLocalizedDescription=library not found}

[UE4] [2021.11.28-14.37.18:552][136]LogPakFile: OnPakFileMounted2Time == 0.003340

[UE4] [2021.11.28-14.37.18:552][136]LogBlueprintUserMessages: [DefaultPawn_BP_C_2147482535] Mounted File

[UE4] [2021.11.28-14.37.18:553][136]LogStreaming: Display: FlushAsyncLoading: 1 QueuedPackages, 0 AsyncPackages

[UE4] [2021.11.28-14.37.18:553][136]LogPackageLocalizationCache: Processed 1 localized package path(s) for 1 prioritized culture(s) in 0.000065 seconds

[UE4] [2021.11.28-14.37.18:553][136]LogOutputDevice: Warning:

[UE4] Assertion failed: PakPrecacherSingleton [File:/Users/build/Build/++UE4/Sync/Engine/Source/Runtime/PakFile/Private/IPlatformFilePak.cpp] [Line: 1462]

[UE4] [2021.11.28-14.37.18:553][136]Assertion failed: PakPrecacherSingleton [File:/Users/build/Build/++UE4/Sync/Engine/Source/Runtime/PakFile/Private/IPlatformFilePak.cpp] [Line: 1462]

[UE4] [2021.11.28-14.37.18:556][136]LogGenericPlatformMisc: FPlatformMisc::RequestExit(1)

I would love for a solution or workaround for this. If anyone from the unreal team or outside could give a solution for this, it would be great.

Has anyone solved this problem?

I have same problem in Windows Platform on 4.27.2