diff --git a/artdaq/Application/DataLoggerCore.cc b/artdaq/Application/DataLoggerCore.cc index 7d5756ed..91653bd1 100644 --- a/artdaq/Application/DataLoggerCore.cc +++ b/artdaq/Application/DataLoggerCore.cc @@ -53,6 +53,12 @@ bool artdaq::DataLoggerCore::initialize(fhicl::ParameterSet const& pset) TLOG(50) << "In any case, if you are using multiple art analyzers, make sure to set \"shared_memory_ordering\" to false in the DataLogger configuration to avoid issues with events not being received by the art analyzers."; } + if (!agg_pset.has_key("init_fragment_count")) + { + TLOG(TLVL_ERROR) << "ERROR: init_fragment_count must be set for the DataLogger to function properly. Please set `init_fragment_count: 0` in the DataLogger configuration. (Will be book-kept by DAQInterface)"; + return false; + } + // initialize the MetricManager and the names of our metrics fhicl::ParameterSet metric_pset = daq_pset.get("metrics", fhicl::ParameterSet()); diff --git a/artdaq/Application/DispatcherCore.cc b/artdaq/Application/DispatcherCore.cc index 56b6a478..6cc0d5ae 100644 --- a/artdaq/Application/DispatcherCore.cc +++ b/artdaq/Application/DispatcherCore.cc @@ -65,6 +65,11 @@ bool artdaq::DispatcherCore::initialize(fhicl::ParameterSet const& pset) return false; } + if (!agg_pset.has_key("init_fragment_count")) + { + TLOG(TLVL_ERROR) << "ERROR: init_fragment_count must be set for the Dispatcher to function properly. Please set `init_fragment_count: 0` in the Dispatcher configuration. (Will be book-kept by DAQInterface)"; + return false; + } broadcast_mode_ = agg_pset.get("broadcast_mode", true); allow_label_overwrites_ = agg_pset.get("allow_label_overwrites", true); if (broadcast_mode_ && !agg_pset.has_key("broadcast_mode")) diff --git a/artdaq/ArtModules/ArtdaqSharedMemoryService_service.cc b/artdaq/ArtModules/ArtdaqSharedMemoryService_service.cc index c1d5106b..3df30c69 100644 --- a/artdaq/ArtModules/ArtdaqSharedMemoryService_service.cc +++ b/artdaq/ArtModules/ArtdaqSharedMemoryService_service.cc @@ -93,6 +93,7 @@ class ArtdaqSharedMemoryService : public ArtdaqSharedMemoryServiceInterface private: std::unique_ptr incoming_events_; std::list> event_ordering_; + std::set released_broadcast_sequence_ids_; size_t read_timeout_; size_t subrun_closure_threshold_{1}; double safety_valve_timeout_s_{10.0}; @@ -309,9 +310,19 @@ std::shared_ptr ArtdaqSharedMemoryService::ReceiveEvent(bool broadc { // First Fragment is broadcast (begin/end run/subrun), but there's more in event ordering! TLOG(TLVL_RECEIVEEVENT) << "Returning Broadcast Fragment due to subrun closure"; - output_event = event_ordering_.front(); + + if (released_broadcast_sequence_ids_.count(event_ordering_.front()->header->sequence_id) == 0) + { + output_event = event_ordering_.front(); + released_broadcast_sequence_ids_.insert(event_ordering_.front()->header->sequence_id); + while (released_broadcast_sequence_ids_.size() > 1000) { released_broadcast_sequence_ids_.erase(released_broadcast_sequence_ids_.begin()); } + } + else + { + TLOG(TLVL_WARNING) << "Discarding duplicate Broadcast with sequence ID " << event_ordering_.front()->header->sequence_id << " and count " << event_ordering_.front()->fragments.size(); + } event_ordering_.pop_front(); - break; // while(output_event == nullptr) + continue; // while(output_event == nullptr) } } else if (current_subrun_ != 0 && first_sr > current_subrun_ + 1) diff --git a/artdaq/DAQrate/SharedMemoryEventManager.cc b/artdaq/DAQrate/SharedMemoryEventManager.cc index 43ce4095..7962ee95 100644 --- a/artdaq/DAQrate/SharedMemoryEventManager.cc +++ b/artdaq/DAQrate/SharedMemoryEventManager.cc @@ -1802,7 +1802,7 @@ void artdaq::SharedMemoryEventManager::send_init_frags_() } else if (init_fragment_count_ > 0 && init_fragment_map_size_() == 0) { - TLOG(TLVL_WARNING) << "Cannot send Init Fragment(s) because I haven't yet received them! Set send_init_fragments to false or init_fragment_count to 0 if this process does not receive serialized art events to avoid potentially lengthy timeouts!"; + TLOG(TLVL_INFO) << "Cannot send Init Fragment(s) because I haven't yet received any! Set send_init_fragments to false or init_fragment_count to 0 if this process does not receive serialized art events to avoid potentially lengthy timeouts!"; } else if (init_fragment_count_ > 0) {