Hello Johan,
I’m afraid that we don’t mean the same thing. Ensure is a non-fatal error, and there is no reason not to report another (different) ensure after an ensure. The code snippet you sent is a case where a fatal error is reported (crash/assert); it makes sense that ensures after the fatal error are not reported then.
In UE, ensures are reported silently in the background by default, but we want to open CRC during each ensure. For this, we set the GEnsureShowsCRC property to true so that the CRC can be shown when an ensure occurs. That indeed works fine for the first encountered ensure, but both the editor and the CRC hang on the second one.
1) UE waits for the response from monitoring CRC; call stack:
FWindowsPlatformProcess::GetProcReturnCode(FProcHandle &, int *) WindowsPlatformProcess.cpp:1039
`anonymous namespace'::ReportCrashForMonitor(_EXCEPTION_POINTERS *, ECrashContextType, const wchar_t *, void *, void *, unsigned long, FProcHandle &, FSharedCrashContext *, void *, void *, EErrorReportUI) WindowsPlatformCrashContext.cpp:972
[Inlined] FCrashReportingThread::OnContinuableEvent(ECrashContextType, _EXCEPTION_POINTERS *, void *, unsigned int, void *, const wchar_t *, EErrorReportUI) WindowsPlatformCrashContext.cpp:1514
ReportContinuableEventUsingCrashReportClient(ECrashContextType, _EXCEPTION_POINTERS *, void *, unsigned int, void *, const wchar_t *, EErrorReportUI) WindowsPlatformCrashContext.cpp:1897
`ReportEventOnCallingThread'::`1'::filt$0(...) WindowsPlatformCrashContext.cpp:1914
2) CRC loops until the monitored process dies (but UE is still alive, waiting for CRC response, and the MonitoredProcess is valid.):
// Loop until the monitored process dies.
while (MonitoredProcess.IsValid() && FPlatformProcess::IsProcRunning(MonitoredProcess))
{...}
But in the CRC, the Engine exit was already requested (IsEngineExitRequested returns true, and it was set by default when the first CRC window was closed), so it skips reporting and loops indefinitely in idle. There is a comment about ignoring ensures as well, but as I mentioned, it should be just after a fatal error, not after an ensure.
// Check if the monitored process signaled a crash or an ensure, read the pipe data to avoid blocking the writer, but process the data only if CRC wasn't requested to exit.
// This purposedly ignores any ensure that could be piped out just after a crash. (The way concurrent crash/ensures are handled/reported make this unlikely, but possible).
FSharedCrashContext CrashContext;
if (IsCrashReportAvailable(MonitorPid, CrashContext, MonitorReadPipe) && !IsEngineExitRequested())
{...}
This is working differently in Game vs Editor, because Game does not use Monitoring CRC (CRASH_REPORT_WITH_MTBF). That was my follow-up question - do you plan to use the Monitoring CRC in Game in the future as well?
[Attachment Removed]