Commit 025a2db6 authored by Adam Edward Barton's avatar Adam Edward Barton
Browse files

Merge branch 'hlt_coredumpsvc2' into 'master'

CoreDumpSvc: Add StackTrace property (second try)

See merge request !30573
parents f6913338 197d598a
......@@ -28,6 +28,9 @@
#include "CoreDumpSvc.h"
#include "SetFatalHandler.h"
// ROOT includes
#include "TSystem.h"
// Gaudi includes
#include "GaudiKernel/Property.h"
#include "GaudiKernel/IAlgorithm.h"
......@@ -59,9 +62,10 @@ namespace CoreDumpSvcHandler
{
typedef std::map<int, struct sigaction> SigHandler_t;
SigHandler_t oldSigHandler; ///< old signal handlers
bool callOldHandler(true); ///< forward calls to old handlers?
CoreDumpSvc* coreDumpSvc(nullptr); ///< pointer to CoreDumpSvc
SigHandler_t oldSigHandler; ///< old signal handlers
bool callOldHandler(true); ///< forward calls to old handlers?
bool stackTrace(false); ///< produce stack trace?
CoreDumpSvc* coreDumpSvc(nullptr); ///< pointer to CoreDumpSvc
/**
* Signal handler for the CoreDumpSvc
......@@ -93,6 +97,11 @@ namespace CoreDumpSvcHandler
coreDumpSvc->print();
}
if (gSystem && stackTrace) {
std::cout << "Producing stack trace..." << std::endl;
gSystem->StackTrace();
}
if (callOldHandler) {
// Call previous signal handler
// Need to distinguish between the two different types
......@@ -130,6 +139,7 @@ CoreDumpSvc::CoreDumpSvc( const std::string& name, ISvcLocator* pSvcLocator ) :
CoreDumpSvcHandler::coreDumpSvc = this;
m_callOldHandler.declareUpdateHandler(&CoreDumpSvc::propertyHandler, this);
m_stackTrace.declareUpdateHandler(&CoreDumpSvc::propertyHandler, this);
m_coreDumpStream.declareUpdateHandler(&CoreDumpSvc::propertyHandler, this);
m_fatalHandlerFlags.declareUpdateHandler(&CoreDumpSvc::propertyHandler, this);
......@@ -146,6 +156,7 @@ CoreDumpSvc::~CoreDumpSvc()
void CoreDumpSvc::propertyHandler(Property& p)
{
CoreDumpSvcHandler::callOldHandler = m_callOldHandler;
CoreDumpSvcHandler::stackTrace = m_stackTrace;
if ( p.name()==m_coreDumpStream.name() ) {
const std::string val = p.toString();
......
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
#ifndef ATHENASERVICES_COREDUMPSVC_H
......@@ -102,9 +102,12 @@ private:
Gaudi::Property<std::vector<int>> m_signals{this, "Signals", {SIGSEGV,SIGBUS,SIGILL,SIGFPE},
"List of signals to catch"};
Gaudi::Property<bool> m_callOldHandler{this, "CallOldHandler", true,
Gaudi::Property<bool> m_callOldHandler{this, "CallOldHandler", true,
"Call previous signal handler"};
Gaudi::Property<bool> m_stackTrace{this, "StackTrace", false,
"Produce stack trace on crash. Useful if no other signal handler is used"};
Gaudi::Property<std::string> m_coreDumpStream{this, "CoreDumpStream", "stdout",
"Stream to use for core dump [stdout,stderr,MsgStream]"};
......
......@@ -181,9 +181,10 @@ def setupCommonServicesEnd():
log.info('Configure core services for online running')
svcMgr.CoreDumpSvc.CoreDumpStream = "stdout"
svcMgr.CoreDumpSvc.CallOldHandler = True
svcMgr.CoreDumpSvc.CallOldHandler = False
svcMgr.CoreDumpSvc.StackTrace = True
svcMgr.CoreDumpSvc.FatalHandler = 0 # no extra fatal handler
svcMgr.CoreDumpSvc.TimeOut = 60000000000 # no timeout for stack trace generation -> changed to 60s (ATR17112)
svcMgr.CoreDumpSvc.TimeOut = 60000000000 # timeout for stack trace generation changed to 60s (ATR-17112)
# Disable StatusCodeSvc (causes problems with shutting down children at stop in HLTPU)
svcMgr.StatusCodeSvc.SuppressCheck = True
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment