mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-24 22:27:55 -05:00
Do not dispatch widget events while sending a crash report
Repainting while the crash handler pumps the event loop can crash again, replacing the original report with one blaming the crash handler. Call stack: [0] performCrashLogging at ResInsight/ApplicationExeCode/RiaMainTools.cpp:178 [1] manageSegFailureSA(int, siginfo_t*, void*) at ResInsight/ApplicationExeCode/RiaMainTools.cpp:310 [21] RiaGuiApplication::notify(QObject*, QEvent*) at ResInsight/ApplicationLibCode/Application/RiaGuiApplication.cpp:1879 [30] RiaOpenTelemetryManager::reportCrash(int, std::basic_stacktrace<std::allocator<std::stacktrace_entry> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&) at ResInsight/ApplicationLibCode/Application/Tools/Telemetry/RiaOpenTelemetryManager.cpp:429 [31] performCrashLogging at ResInsight/ApplicationExeCode/RiaMainTools.cpp:211 [32] manageSegFailureSA(int, siginfo_t*, void*) at ResInsight/ApplicationExeCode/RiaMainTools.cpp:310 [52] RiaGuiApplication::notify(QObject*, QEvent*) at ResInsight/ApplicationLibCode/Application/RiaGuiApplication.cpp:1879 [62] main at ResInsight/ApplicationExeCode/RiaMain.cpp:267 [63] __libc_start_main at :0
This commit is contained in:
1 parent
a7cecc2ecf
commit
4770abda8e
3 files changed
+19
No files matched your search
@@ -1881,6 +1881,13 @@ bool RiaGuiApplication::notify( QObject* receiver, QEvent* event )
|
||||
return QApplication::notify( receiver, event );
|
||||
}
|
||||
|
||||
// The crash handler pumps the event loop to send the crash report. Repainting a widget there can re-enter the
|
||||
// faulting code and crash again, replacing the original report with one blaming the crash handler.
|
||||
if ( RiaOpenTelemetryManager::instance().isReportingCrash() && ( receiver->isWidgetType() || receiver->isWindowType() ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool done = false;
|
||||
try
|
||||
{
|
||||
|
||||
@@ -418,6 +418,8 @@ void RiaOpenTelemetryManager::reportCrash( int signalCode, const std::stacktrace
|
||||
// still flow, so the HTTP reply completes.
|
||||
if ( m_pendingReplies.load() > 0 )
|
||||
{
|
||||
m_isReportingCrash = true;
|
||||
|
||||
auto* prefs = RiaPreferencesOpenTelemetry::current();
|
||||
int timeoutMs = prefs ? prefs->connectionTimeoutMs() : 5000;
|
||||
int elapsedMs = 0;
|
||||
@@ -451,6 +453,14 @@ bool RiaOpenTelemetryManager::isInitialized() const
|
||||
return m_initialized.load();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// True while the crash handler sends a crash report. Never reset, the process exits afterwards.
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaOpenTelemetryManager::isReportingCrash() const
|
||||
{
|
||||
return m_isReportingCrash.load();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -111,6 +111,7 @@ public:
|
||||
// Configuration
|
||||
bool isEnabled() const;
|
||||
bool isInitialized() const;
|
||||
bool isReportingCrash() const;
|
||||
void setErrorCallback( ErrorCallback callback );
|
||||
void setUsername( const std::string& username );
|
||||
|
||||
@@ -180,6 +181,7 @@ private:
|
||||
std::atomic<bool> m_enabled{ false };
|
||||
std::atomic<bool> m_isShuttingDown{ false };
|
||||
std::atomic<bool> m_circuitBreakerOpen{ false };
|
||||
std::atomic<bool> m_isReportingCrash{ false };
|
||||
|
||||
// Qt networking and timer
|
||||
QNetworkAccessManager* m_networkAccessManager{ nullptr };
|
||||
|
||||
Reference in new issue
Block a user