I’m having trouble attaching the file (some permissions issue); here’s the function in 5.7. You can also merge it yourself; the UE_Log changes are pretty straight-forward to mechanically change to the 5.7. versions.
void UCookOnTheFlyServer::SetSaveBusy(bool bInBusy, int32 NumAsyncWorkRetired)
{
using namespace UE::Cook;
if (!bInBusy)
{
if (bSaveBusy)
{
bSaveBusy = false;
SaveBusyStartTimeSeconds = MAX_flt;
SaveBusyRetryTimeSeconds = MAX_flt;
SaveBusyWarnTimeSeconds = MAX_flt;
// Whenever we set Save back to non-busy, reset the counter for how many busy reports with an
// idle shadercompiler we need before we issue a warning
bShaderCompilerWasActiveOnPreviousBusyReport = true;
}
return;
}
const double CurrentTime = FPlatformTime::Seconds();
if (!bSaveBusy)
{
bSaveBusy = true;
SaveBusyStartTimeSeconds = CurrentTime;
SaveBusyWarnTimeSeconds = CurrentTime + GCookProgressWarnBusyTime;
}
SaveBusyRetryTimeSeconds = CurrentTime + CookProgressRetryBusyPeriodSeconds;
if (NumAsyncWorkRetired)
{
// Some progress was made so reset the warning time, and the start time in case we later issue a warning.
SaveBusyStartTimeSeconds = CurrentTime;
SaveBusyWarnTimeSeconds = CurrentTime + GCookProgressWarnBusyTime;
}
if (CurrentTime >= SaveBusyWarnTimeSeconds)
{
// Compiler users - classes using the shader compiler - can take multiple minutes to be compiled due to long
// queues and long compile times, so we do not issue a warning when they are the only objects holding us up,
// so long as the shadercompiler reports it is working on them.
bool bShaderCompilerIsActive = GShaderCompilingManager->IsCompiling();
bool bBusyCompilationUsersAreExpected = bShaderCompilerIsActive ||
// Even if the ShaderCompilerManager is not currently compiling, it might shortly begin or have recently finished.
// Issue a warning for blocked compiler users only if there are two reports in a row where the compiler is not active
bShaderCompilerWasActiveOnPreviousBusyReport;
bShaderCompilerWasActiveOnPreviousBusyReport = bShaderCompilerIsActive;
// Issue a status update. For each UObject we're still waiting on, check whether the long duration is expected using type-specific checks
// Make the status update a warning if the long duration is not reported as expected.
TArray<UObject*> NonExpectedObjects;
TSet<UPackage*> NonExpectedPackages;
TArray<UObject*> ExpectedObjects;
TSet<UPackage*> ExpectedPackages;
FPackageDataQueue& SaveQueue = PackageDatas->GetSaveQueue();
TArray<UClass*> CompilationUsers({
UMaterialInterface::StaticClass(),
FindObject<UClass>(nullptr, TEXT("/Script/Niagara.NiagaraScript")),
FindObject<UClass>(nullptr, TEXT("/Script/Niagara.NiagaraSystem"))
});
PackageDatas->ForEachPendingCookedPlatformData(
[&CompilationUsers, &ExpectedObjects, &ExpectedPackages, &NonExpectedObjects, &NonExpectedPackages, bBusyCompilationUsersAreExpected]
(const FPendingCookedPlatformData& Data)
{
UObject* Object = Data.Object.Get();
if (!Object)
{
return;
}
bool bCompilationUser = false;
for (UClass* CompilationUserClass : CompilationUsers)
{
if (Object->IsA(CompilationUserClass))
{
bCompilationUser = true;
break;
}
}
if (bCompilationUser && bBusyCompilationUsersAreExpected)
{
ExpectedObjects.Add(Object);
ExpectedPackages.Add(Object->GetPackage());
}
else
{
NonExpectedObjects.Add(Object);
NonExpectedPackages.Add(Object->GetPackage());
}
});
TArray<UPackage*> RemovePackages;
for (UPackage* Package : ExpectedPackages)
{
if (NonExpectedPackages.Contains(Package))
{
RemovePackages.Add(Package);
}
}
for (UPackage* Package : RemovePackages)
{
ExpectedPackages.Remove(Package);
}
bool bExpectedDueToSlowBuildOperations = !ExpectedObjects.IsEmpty() && NonExpectedObjects.IsEmpty();
FString Message = FString::Printf(TEXT("Cooker has been blocked from saving the current packages for %.0f seconds."),
(float)CurrentTime - SaveBusyStartTimeSeconds);
ELogVerbosity::Type MessageSeverity = ELogVerbosity::Display;
if (!bExpectedDueToSlowBuildOperations)
{
MessageSeverity = CookerIdleWarningSeverity;
}
#if !NO_LOGGING
FMsg::Logf(__FILE__, __LINE__, LogCook.GetCategoryName(), MessageSeverity, TEXT("%s"), *Message);
#endif
int DisplayCount = 0;
const int DisplayMax = 10;
if (NonExpectedPackages.Num() + ExpectedPackages.Num() > 0)
{
UE_LOG(LogCook, Display, TEXT("%d packages in the savequeue: "), SaveQueue.Num());
for (TSet<UPackage*>* PackageSet : { &NonExpectedPackages, &ExpectedPackages })
{
for (UPackage* Package : *PackageSet)
{
if (DisplayCount == DisplayMax)
{
UE_LOG(LogCook, Display, TEXT(" ..."));
break;
}
UE_LOG(LogCook, Display, TEXT(" %s"), *Package->GetName());
++DisplayCount;
}
}
if (DisplayCount == 0)
{
UE_LOG(LogCook, Display, TEXT(" <None>"));
}
UE_LOG(LogCook, Display, TEXT("%d objects that have not yet returned true from IsCachedCookedPlatformDataLoaded:"),
PackageDatas->GetPendingCookedPlatformDataNum());
DisplayCount = 0;
for (TArray<UObject*>* ObjectArray : { &NonExpectedObjects, &ExpectedObjects })
{
for (UObject* Object : *ObjectArray)
{
if (DisplayCount == DisplayMax)
{
UE_LOG(LogCook, Display, TEXT(" ..."));
break;
}
UE_LOG(LogCook, Display, TEXT(" %s"), *Object->GetFullName());
TStringBuilder<2048> AdditionalDebugInfo;
FDelegates::PackageBlocked.Broadcast(Object, AdditionalDebugInfo);
UE::String::ParseTokens(AdditionalDebugInfo.ToView(), TEXT('\n'),
[](FStringView Line)
{
UE_LOG(LogCook, Display, TEXT(" %.*s"), Line.Len(), Line.GetData());
}, UE::String::EParseTokensOptions::SkipEmpty);
++DisplayCount;
}
}
if (DisplayCount == 0)
{
UE_LOG(LogCook, Display, TEXT(" <None>"));
}
}
else if (SaveQueue.Num() > 0)
{
UE_LOG(LogCook, Display, TEXT("%d packages in the savequeue: "), SaveQueue.Num());
for (FPackageData* PackageData : SaveQueue)
{
if (DisplayCount == DisplayMax)
{
UE_LOG(LogCook, Display, TEXT(" ..."));
break;
}
FString GeneratorText;
if (PackageData->GetGenerationHelper())
{
GeneratorText = TEXT(" (Generator)");
}
else if (PackageData->GetParentGenerationHelper())
{
GeneratorText = TEXT(" (Generated)");
}
UE_LOG(LogCook, Display, TEXT(" %s%s: %s"),
*PackageData->GetPackageName().ToString(), *GeneratorText, LexToString(PackageData->GetSaveSubState()));
++DisplayCount;
}
}
SaveBusyWarnTimeSeconds = CurrentTime + GCookProgressWarnBusyTime;
UE::Cook::FDelegates::CookSaveIdle.Broadcast(
*this, SaveQueue.Num(), PackageDatas->GetPendingCookedPlatformDataNum(), bExpectedDueToSlowBuildOperations);
}
}
[Attachment Removed]