From 771bc0d816e3facc52ed8fd62d9d0ccbc9e63a68 Mon Sep 17 00:00:00 2001 From: "W. David Dagenhart" Date: Fri, 22 Mar 2024 16:27:19 +0100 Subject: [PATCH 1/2] Fix two spinlocks --- DPGAnalysis/Skims/src/LogErrorEventFilter.cc | 6 +++--- FWCore/Framework/src/Path.cc | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/DPGAnalysis/Skims/src/LogErrorEventFilter.cc b/DPGAnalysis/Skims/src/LogErrorEventFilter.cc index 141b2378e8f71..61a5ba5770d14 100644 --- a/DPGAnalysis/Skims/src/LogErrorEventFilter.cc +++ b/DPGAnalysis/Skims/src/LogErrorEventFilter.cc @@ -71,9 +71,9 @@ namespace { }; std::unique_ptr, release> make_guard(std::atomic &b) noexcept { bool expected = false; - while (not b.compare_exchange_strong(expected, true)) - ; - + while (not b.compare_exchange_strong(expected, true)) { + expected = false; + } return std::unique_ptr, release>(&b, release()); } diff --git a/FWCore/Framework/src/Path.cc b/FWCore/Framework/src/Path.cc index ba6462aa6f3e1..31726e0055a2b 100644 --- a/FWCore/Framework/src/Path.cc +++ b/FWCore/Framework/src/Path.cc @@ -133,7 +133,7 @@ namespace edm { void Path::threadsafe_setFailedModuleInfo(int nwrwue, bool iExcept) { bool expected = false; - while (stateLock_.compare_exchange_strong(expected, true)) { + while (not stateLock_.compare_exchange_strong(expected, true)) { expected = false; } if (iExcept) { From 8ed0a213c3e9a6bc8d26f91aadc21c0b3956d2bb Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Mon, 18 Mar 2024 10:01:08 +0100 Subject: [PATCH 2/2] Initialize statsGuard_ Hopefully this fixes the segfaults seeing in this module in IBs. --- DPGAnalysis/Skims/src/LogErrorEventFilter.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DPGAnalysis/Skims/src/LogErrorEventFilter.cc b/DPGAnalysis/Skims/src/LogErrorEventFilter.cc index 61a5ba5770d14..229665ecc1c22 100644 --- a/DPGAnalysis/Skims/src/LogErrorEventFilter.cc +++ b/DPGAnalysis/Skims/src/LogErrorEventFilter.cc @@ -116,7 +116,7 @@ class LogErrorEventFilter : public edm::global::EDFilter statsGuard_; + mutable std::atomic statsGuard_{false}; template static void increment(ErrorSet &scoreboard, Collection &list);