From d3c8b91c8f77a5450ee9c30bd8e1d39d12cde6c6 Mon Sep 17 00:00:00 2001 From: scott snyder <snyder@bnl.gov> Date: Tue, 24 Nov 2020 01:12:28 +0100 Subject: [PATCH] CaloTriggerTool: Trying to fix MT dictionary error. CaloTriggerTowerService used to read LArTTCellMap via a conditions callback. This is not thread-friendly, so it was changed; it is now retrieved from the detector store during event processing. However, this can lead to the I/O system triggering the creation of TClass instances for the LArTTCellMap persistent classes, and TClass has been observed to sometimes malfunction when created in a MT context (at least as of root 6.22.00). The resulting dictionary failures were causing jobs to occasionally crash with bad_alloc exceptions. Try to fix by forcing the needed TClass instances to be created during initialize. --- Calorimeter/CaloTriggerTool/CMakeLists.txt | 4 +++- .../CaloTriggerTool/src/CaloTriggerTowerService.cxx | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Calorimeter/CaloTriggerTool/CMakeLists.txt b/Calorimeter/CaloTriggerTool/CMakeLists.txt index c24a672fa97..f3bc0669028 100644 --- a/Calorimeter/CaloTriggerTool/CMakeLists.txt +++ b/Calorimeter/CaloTriggerTool/CMakeLists.txt @@ -2,13 +2,15 @@ # Declare the package name: atlas_subdir( CaloTriggerTool ) +find_package( ROOT COMPONENTS Core ) # Component(s) in the package: atlas_add_library( CaloTriggerToolLib src/*.cxx PUBLIC_HEADERS CaloTriggerTool + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} LINK_LIBRARIES AthenaBaseComps AthenaKernel CaloIdentifier GaudiKernel Identifier StoreGateLib TrigT1CaloCalibConditions - PRIVATE_LINK_LIBRARIES LArCablingLib LArIdentifier ) + PRIVATE_LINK_LIBRARIES LArCablingLib LArIdentifier ${ROOT_LIBARIES} ) atlas_add_component( CaloTriggerTool src/components/*.cxx diff --git a/Calorimeter/CaloTriggerTool/src/CaloTriggerTowerService.cxx b/Calorimeter/CaloTriggerTool/src/CaloTriggerTowerService.cxx index 5ca29e644f9..5ec8c020c84 100644 --- a/Calorimeter/CaloTriggerTool/src/CaloTriggerTowerService.cxx +++ b/Calorimeter/CaloTriggerTool/src/CaloTriggerTowerService.cxx @@ -17,6 +17,7 @@ #include "CaloIdentifier/LArEM_ID.h" #include "GaudiKernel/IToolSvc.h" #include "GaudiKernel/ServiceHandle.h" +#include "TClass.h" //=========================================================== CaloTriggerTowerService::CaloTriggerTowerService( const std::string& type, @@ -94,6 +95,17 @@ StatusCode CaloTriggerTowerService::initialize () msg() << MSG::DEBUG << "Successfully accessed LArOnlineID helper" << endmsg; } + // Make sure the dictionaries for the LArTTCellMap persistent classes + // are available. We used to read this object via a conditions callback, + // but callbacks are not thread-friendly, so this was changed to retrieving + // it from detStore during event processing. However, this meant that + // the TClass's for the persistent objects were also being loaded + // at that time. As of root 6.22.00, at least, TClass can sometimes + // fail to properly load a dictionary when it's being run in a multithreaded + // context. So force the needed dictionaries to load now. + TClass::GetClass ("LArTTCell_P"); + TClass::GetClass ("LArTTCell_P::LArTTCell_P_t"); + msg()<<MSG::INFO<<" ====> ...CaloTriggerTowerService::init() OK "<< endmsg; return StatusCode::SUCCESS; } -- GitLab