Hey,
As stated in the title and detailed in the repro steps, the following code prevents more than 4 ensures report being broadcast via OnHandleSystemEnsure. This is a problem for plugins like Sentry which rely on OnHandleSystemEnsure to route ensures to their online services.
A quick fix is to just bump this number to something much higher but, I really fail to see what the goal is of this code and why it exists, can you please raise a bug to fix this? I shudder to think how many projects are loosing/delaying information about how their systems are operating because of this limit.
As far as I can tell it’s not even unique ensures, it’s just any ensure, even if it’s the same ensure 4 times.
Cheers.
if (GEnsuresAreErrors)
{
// How many unique previous errors we should keep track of
const uint32 MaxPreviousErrorsToTrack = 4;
static uint32 StaticPreviousErrorCount = 0;
if (StaticPreviousErrorCount < MaxPreviousErrorsToTrack)
{
// Check to see if we've already reported this error. No point in blasting the server with
// the same error over and over again in a single application session.
bool bHasErrorAlreadyBeenReported = false;
// Static: Array of previous unique error message CRCs
static uint32 StaticPreviousErrorCRCs[MaxPreviousErrorsToTrack];
// Compute CRC of error string. Note that along with the call stack, this includes the message
// string passed to the macro, so only truly redundant errors will go unreported. Though it also
// means you shouldn't pass loop counters to ensureMsgf(), otherwise failures may spam the server!
const uint32 ErrorStrCRC = FCrc::StrCrc_DEPRECATED(ErrorMsg);
for (uint32 CurErrorIndex = 0; CurErrorIndex < StaticPreviousErrorCount; ++CurErrorIndex)
{
if (StaticPreviousErrorCRCs[CurErrorIndex] == ErrorStrCRC)
{
// Found it! This is a redundant error message.
bHasErrorAlreadyBeenReported = true;
break;
}
}
// Add the element to the list and bump the count
StaticPreviousErrorCRCs[StaticPreviousErrorCount++] = ErrorStrCRC;
if (!bHasErrorAlreadyBeenReported)
{
#if STATS
FString SubmitErrorReporterfMessage = FString::Printf(TEXT("SubmitErrorReport"));
SCOPE_LOG_TIME_IN_SECONDS(*SubmitErrorReporterfMessage, nullptr)
#endif
FCoreDelegates::OnHandleSystemEnsure.Broadcast();
FPlatformMisc::SubmitErrorReport(ErrorMsg, EErrorReportMode::Balloon);
bShouldSendNewReport = true;
}
}
}
[Attachment Removed]