From d4151d54739dde9b9d94322077d2ddbf5db97ad6 Mon Sep 17 00:00:00 2001 From: Srecko Date: Wed, 19 Mar 2025 21:02:57 +0100 Subject: [PATCH] fix file deletion deadlock caused by stream not being assigned next file. --- EventFilter/Utilities/interface/FastMonitoringService.h | 1 + EventFilter/Utilities/src/DAQSource.cc | 2 +- EventFilter/Utilities/src/FastMonitoringService.cc | 5 +++++ EventFilter/Utilities/src/FedRawDataInputSource.cc | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/EventFilter/Utilities/interface/FastMonitoringService.h b/EventFilter/Utilities/interface/FastMonitoringService.h index e8ae97b80b87f..dfe189cb35b29 100644 --- a/EventFilter/Utilities/interface/FastMonitoringService.h +++ b/EventFilter/Utilities/interface/FastMonitoringService.h @@ -233,6 +233,7 @@ namespace evf { void setTMicrostate(FastMonState::Microstate m); static unsigned int getTID() { return tbb::this_task_arena::current_thread_index(); } + bool streamIsIdle(unsigned int i) const; private: void doSnapshot(const unsigned int ls, const bool isGlobalEOL); diff --git a/EventFilter/Utilities/src/DAQSource.cc b/EventFilter/Utilities/src/DAQSource.cc index 700e035640be7..d4f9531bbdaab 100644 --- a/EventFilter/Utilities/src/DAQSource.cc +++ b/EventFilter/Utilities/src/DAQSource.cc @@ -649,7 +649,7 @@ void DAQSource::fileDeleter() { for (unsigned int i = 0; i < streamFileTracker_.size(); i++) { if (it->first == streamFileTracker_.at(i)) { //only skip if LS is open - if (fileLSOpen) { + if (fileLSOpen && (!fms_ || !fms_->streamIsIdle(i))) { fileIsBeingProcessed = true; break; } diff --git a/EventFilter/Utilities/src/FastMonitoringService.cc b/EventFilter/Utilities/src/FastMonitoringService.cc index b7a85b3b1e1a4..eaab5e8d0b90b 100644 --- a/EventFilter/Utilities/src/FastMonitoringService.cc +++ b/EventFilter/Utilities/src/FastMonitoringService.cc @@ -1052,4 +1052,9 @@ namespace evf { fmt_->jsonMonitor_->snap(ls); } + bool FastMonitoringService::streamIsIdle(unsigned int i) const { + auto ms = microstate_.at(i); + return ms == getmIdle(); + } + } //end namespace evf diff --git a/EventFilter/Utilities/src/FedRawDataInputSource.cc b/EventFilter/Utilities/src/FedRawDataInputSource.cc index 75aba73d15f0a..0d6f045d8b3ec 100644 --- a/EventFilter/Utilities/src/FedRawDataInputSource.cc +++ b/EventFilter/Utilities/src/FedRawDataInputSource.cc @@ -727,7 +727,7 @@ void FedRawDataInputSource::fileDeleter() { for (unsigned int i = 0; i < streamFileTracker_.size(); i++) { if (it->first == streamFileTracker_.at(i)) { //only skip if LS is open - if (fileLSOpen) { + if (fileLSOpen && (!fms_ || !fms_->streamIsIdle(i))) { fileIsBeingProcessed = true; break; }