RiaGuiApplication::notify queried RiaOpenTelemetryManager::instance() for every event. Make the crash flag a static atomic so the check never constructs the manager or takes part in its initialization.
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
libstdc++ defines __cpp_lib_stacktrace from GCC 13 on, but the implementation
lives in libstdc++exp, which some distributions do not ship (Red Hat's
gcc-toolset among them). The header-only feature test then reports the feature
as present and the link fails with undefined references to
std::__stacktrace_impl::_S_current.
Add cmake/StdStacktrace.cmake, which probes the feature by actually linking:
first with no extra library, then with stdc++exp. The result selects the link
library through RESINSIGHT_STACKTRACE_LIBRARIES, or defines
RIA_HAS_STD_STACKTRACE=0 project-wide when neither links, so the crash handler
compiles out its stack-trace capture and logs the signal only.
RiaMainTools.cpp and RiaOpenTelemetryManager.h now honour a
RIA_HAS_STD_STACKTRACE definition from the build system and only include
<stacktrace> when the feature is enabled.
Follow-up to #14045.
Send one batched request per event batch instead of one request per event.
Application Insights v2/track accepts an array of envelopes, so a batch of up
to maxBatchSize (512) events was previously issued as 512 concurrent POSTs.
QNetworkAccessManager only opens a handful of connections per host, so the
queued requests were aborted by their own transfer timeout before reaching the
wire, reported as "HTTP 0: Operation canceled".
Honour the circuit breaker in processEvents(). It was only checked when
enqueuing, so the up to 10000 already queued events kept being posted at full
rate after the breaker opened. The crash and shutdown flush bypasses the
breaker so a crash report is still attempted.
Keep at most one request in flight. Failures are only observed when the reply
finishes, which for an unreachable endpoint takes the full transfer timeout,
and the 100 ms timer kept launching requests during that window.
Log the circuit breaker transition once instead of on every subsequent failure.
Only read the reply body when the device is open. An aborted reply has a closed
device, and reading from it emitted a QIODevice warning per request.
Call attemptReconnection() from the process timer. It was dead code, so once
the breaker opened it could only close if a reply happened to succeed.
Deleting PDM objects on a worker thread is not safe. PdmObjectHandle::prepareForDelete()
mutates state owned by other objects, it nulls the guarded pointers held by other objects
and clears m_pointersReferencingMe, an unsynchronised std::set that every PdmPointer
construction and destruction touches. Destroying an object off the main thread therefore
races with the main thread on the shared object graph. See issue 14491.
Profiling a summary ensemble teardown shows the mechanism does not pay for itself. Releasing
397 Drogon realizations takes 0.24 s sequentially and 0.24 s in parallel, and for a heavy
case the parallel release is slower than the sequential one, because free() is serialised
inside the allocator. The PDM bookkeeping itself is 0.4 to 2.8 percent of the teardown.
Remove the class and deleteChildrenAsync(), and delete synchronously instead. The call sites
that used clearWithoutDelete() and a manual delete loop to work around the race can now call
deleteChildren() directly. Add caf::PdmObjectHandleTools::deleteObjects() for the case where
the objects are no longer owned by a child array field.
The observer disconnection from issue 12262 does not depend on clearWithoutDelete(). ~Signal()
unregisters itself from every observer, so a deleted child detaches itself. That fix addressed
the async race, where ~Signal() mutated the observer list from a worker thread. The unit test
is updated to assert the observed signal count directly instead of relying on a crash.
reportCrash pumps a nested Qt event loop from within the signal handler to
let the async crash-report HTTP POST finish. Pumping all events also
dispatches buffered mouse/keyboard events, which re-enter arbitrary UI code
mid-crash and can re-trigger the faulting path, causing a double-fault
inside the handler. Pump with QEventLoop::ExcludeUserInputEvents so socket
and timer events still flow (the reply completes) while user input is held
back.
Fixes#14312
* Refactor: add MACOSX_BUNDLE option to qt_add_executable in multiple CMakeLists.txt files
* #14045 macOS: Guard std::stacktrace usage and skip ucontext on Apple platforms
* #14045 macOS: Guard std::ispanstream with std::istringstream fallback
* #14045 macOS: Add vcpkg overlay triplets for osx and exclude grpc on osx
* #14045 macOS: CMake macOS build support and openzgy OpenMP-disable patch
* #14045 CI: Add macOS build workflow
* #14045 macOS: Use feature-test macros to detect <stacktrace> and <spanstream>
* #14045 macOS: Make MAX_STIMPLAN_LAYERS constexpr to fix arm64 link error
* #14045 CI: Ship README-macOS.txt with artifact to document Gatekeeper workaround
* #14045 CI: Pin macOS runner to macos-14 and set deployment target to 14.0
* #14045 CI: Move macOS runner to macos-15 and fix README step on configure failure
Switch signal handler registration from signal() to sigaction(SA_SIGINFO)
on Linux to capture fault address, signal code description, and program
counter at crash time. These are logged to the file logger and included
in OpenTelemetry crash reports.
Add OS info (os.type, os.version, os.name) to all non-crash events in
reportEventAsync. Consolidate OS info and hashUsername into an anonymous
namespace with a shared addOsInfo helper function.
- Track pending network replies using an atomic counter
- Pump the event loop in `reportCrash` to allow asynchronous telemetry requests to complete before the process terminates
- Use a timeout to prevent the crash handler from hanging indefinitely if the network is unresponsive
OpenTelemetry initialization is now driven by the presence of a config
file: if no config file is found (connection string is empty), init is
skipped silently without writing to the log.
Extend opentelemetry_config.json with optional event_allowlist and
event_denylist arrays. Patterns support wildcard suffix (e.g. grpc.*).
Allowlist is checked first; denylist further restricts within the
allowed set. crash.* events always bypass all filters and queue limits.
Add RiaConnectorTools-Test.cpp covering all JSON value types including
the new array handling.
Add explicit disconnection of signals and abort pending network replies in destructors and shutdown methods to prevent unwanted callbacks and threading issues during object destruction or shutdown. This enhances robustness and safety, especially in asynchronous and multi-threaded contexts.
Adds username hashing for privacy-preserving telemetry and includes full username for crash reports to aid debugging.
Also incorporates OS information into crash reports for better diagnostics.
Removes conditional compilation for OpenTelemetry, ensuring it is always included.
Reinitializes OpenTelemetry based on user preferences, ensuring that changes to telemetry settings are applied immediately.
Configures cloud services, including OpenTelemetry, after the logger is initialized, ensuring that telemetry data is properly captured and transmitted.
Retrieves system username for telemetry tracking.
Modifies the stack trace reporting to only include the path relative to the ResInsight root folder, enhancing readability and reducing verbosity in crash reports.
Adds support for OpenTelemetry to enable telemetry and crash reporting.
This change introduces:
- New RiaPreferencesOpenTelemetry class for managing OpenTelemetry configuration.
- RiaOpenTelemetryManager class for handling the OpenTelemetry lifecycle,
event processing, and error handling.
- Configuration options in preferences to enable, disable, and configure
OpenTelemetry.
- Asynchronous event reporting.
- Crash reporting capabilities.
- Health monitoring features.