ATLAS Offline Software
Loading...
Searching...
No Matches
Athena Namespace Reference

Some weak symbol referencing magic... These are declared in AthenaKernel/getMessageSvc.h and will be non-nullptr in case the GaudiSvc/AthenaKernel shared libraries have been loaded. More...

Namespaces

namespace  details
namespace  DsoUtils
namespace  Options
namespace  detail
namespace  Units

Classes

class  Chrono
 Exception-safe IChronoSvc caller. More...
class  CondObjDeleter
 Deletion object for conditions payloads. More...
class  IMessageSvcHolder
 get a IMessageSvc* on 1st use (if not set) and release it on ~ More...
class  IConditionsCleanerSvc
 Interface for doing garbage collection of conditions objects. More...
class  IInputRename
 Interface to retrieve input rename map. More...
class  ToolLock
 RAII helper for acquiring the lock of an ILockableTool. More...
struct  InputRenameEntry
 Type of the input rename map: sgkey_t -> sgkey_t. More...
class  IRCUSvc
 Interface for RCU service. More...
class  ISlimmingHdlr
 This class defines a protocol to slim objects (removing parts of that object). More...
class  IThinningHdlr
 This class defines a protocol to pack and unpack thinned collections. More...
class  DvThinningHdlr
 Handle DataProxy holding DataVector. More...
class  StdThinningHdlr
 Handle DataProxy holding std::vector<T> This class defines a (type-safe) protocol to pack and unpack thinned DataVector. More...
class  IdcThinningHdlr
 Handle DataProxy holding IdentifiableContainer This class defines a (type-safe) protocol to pack and unpack thinned IdentifiableContainer. More...
struct  get_thinning_handler
 metafunction to automagically dispatch on the type of a container and fetch the right thinning handler More...
class  RCURead
 Helper to read data from a RCUObject. More...
class  RCUReadQuiesce
 Helper to read data from a RCUObject. More...
class  RCUUpdate
 Helper to update data in a RCUObject. More...
class  IRCUObject
 Base object class for RCU-style synchronization for Athena. More...
class  RCUObject
 Wrapper object controlled by RCU synchonization. More...
class  RCUUpdater
 Implementation of Updater for RCUSvc. More...
class  RecyclableDataQueue
 Holder for recyclable objects. More...
class  Timeout
 Singleton to access the timeout flag. More...
class  TimeoutMaster
 Class to modify timeout flag. More...
struct  TPCnvVers
struct  TPCnvType
struct  StatusCategory
struct  RCUObjectGraceSets
class  ConditionsCleanerSvc
 Facade class for conditions garbage collection. More...
class  DelayedConditionsCleanerSvcProps
class  DelayedConditionsCleanerSvc
 Clean conditions containers after a delay. More...
class  RCUSvc
 Service to allow cleaning up RCU objects at the EndEvent. More...
class  ROOTMessageFilterSvc
 Service for filtering "ROOT messages" in Athena. More...
class  ThinningCacheTool
 Create ThinningCache for a given stream. More...
class  Signal
 Utilities for handling signals and fatal errors. More...
class  LeafCnv
class  NtupleCnvSvc
class  RootAsciiDumperAlg
class  RootBranchAddress
 A simple class to hold the buffer of a TBranch from a TTree. More...
class  RootCnv
 This class provides the abstract converter to translate an object to/from its persistent ROOT representation. More...
class  RootCnvSvc
 This class provides the interface between Athena and RootSvc. More...
class  RootConnection
 This class provides the implementation of Athena::RootConnection class, similar to Gaudi IDataConnection. More...
class  DataBucketBranch
class  RootGlobalsRestore
 state of a few global resources from ROOT and restores their initial value upon d-tor call. More...
class  RootNtupleEventContext
 ROOT specific event selector context. More...
class  RootNtupleEventSelector
 Class implementing the GAUDI IEvtSelector interface using ROOT TTree as a backend. More...
class  RootNtupleOutputMetadataTool
 This is the AthenaRoot version of AthenaServices/AthenaOutputStreamTool. More...
class  RootNtupleOutputStream
 algorithm that marks for write data objects in SG More...
class  RootOutputStreamTool
 This is the AthenaRoot version of AthenaServices/AthenaOutputStreamTool. More...
class  RootSvc
 This class provides the interface to the ROOT software. More...
class  xAODBranchAddress
 A simple class to do the retrieve from TEvent. More...
class  xAODCnv
class  xAODCnvSvc
class  xAODEventContext
 event selector context ... just holds reference back to the selector More...
class  xAODEventSelector
 Class implementing the GAUDI IEvtSelector interface using ROOT TTree as a backend. More...
class  DBLock
 Common database lock. More...

Typedefs

using InputRenameMap_t = SG::SGKeyMap<InputRenameEntry>
typedef void(* DummyHandlerType) (int)
 Dummy handler type for standard signal() function.
typedef RootNtupleEventContext::FileNames_t FileNames_t

Enumerations

enum class  Status : StatusCode::code_t { TIMEOUT = 10 , MISSING_DATA = 11 }
 Athena specific StatusCode values. More...

Functions

std::string typeinfoName (const std::type_info &ti)
 Convert a type_info to a demangled string.
IMessageSvc * getMessageSvc (bool quiet=false)
IMessageSvc * getMessageSvc (const Options::CreateOptions o, bool quiet=false)
void reportMessage (IMessageSvc *ims, const std::string &source, int type, const std::string &message)
 Wrappers for some of the IMessageSvc methods These can be used from libraries without explicit Gaudi dependency via weak linking.
int outputLevel (const IMessageSvc *ims, const std::string &source)
void setOutputLevel (IMessageSvc *ims, const std::string &source, int level)
template<typename... ARGS>
 RecyclableDataObject (std::shared_ptr< queue_t > queue, ARGS &&... args)
 Helper for recycling objects from event to event.
virtual unsigned long release () override
 DataObject release method.
int ubsan_boost_suppress ()
StatusCode ROOTMessageFilterSvc::initialize ATLAS_NOT_THREAD_SAFE (void)
 Return the file descriptor #fataldump() uses for output.
static void SignalDumpLibs (const SharedLibrary::LibraryInfo &info, IOFD fd)
 Internal #Signal::fataldump() dumper to produce the list of currently loaded shared libraries.
void Signal::handleQuit ATLAS_NOT_THREAD_SAFE (QuitHook hook)
void Signal::handleFatal ATLAS_NOT_THREAD_SAFE (const char *applicationName, IOFD fd, FatalHook hook, FatalReturn mainreturn, unsigned options)
 Install default handler for fatal signals.
void Signal::quit ATLAS_NOT_THREAD_SAFE (int sig, siginfo_t *info, void *x)
 The quit signal handler.
bool Signal::fatalDump ATLAS_NOT_THREAD_SAFE (int sig, siginfo_t *info, void *extra, IOFD fd, unsigned options)
 find_coll_idx (-1, coll_idx, tuple_idx)
return m_collEvts back ().back().max_entries

Variables

std::atomic< bool > getMessageSvcQuiet
 Set this to force off the warning messages from getMessageSvc (in unit tests, for example).
std::shared_ptr< queue_t > m_queue
 The queue on which this object will be placed when it is recycled.
int ubsan_boost_suppress_ = ubsan_boost_suppress()
static SharedLibrary::InfoHandlerSignalDumpCallback = 0
 Shared library dump callback for #Signal::fataldump().
static char buf [SIGNAL_MESSAGE_BUFSIZE]
 Dump application state information on a fatal signal.
 const
 helper method to get the collection index (into m_inputCollectionsName) and tuple index (into m_tupleNames') for a given event index evtidx`.

Detailed Description

Some weak symbol referencing magic... These are declared in AthenaKernel/getMessageSvc.h and will be non-nullptr in case the GaudiSvc/AthenaKernel shared libraries have been loaded.

Typedef Documentation

◆ DummyHandlerType

typedef void(* Athena::DummyHandlerType) (int)

Dummy handler type for standard signal() function.

Definition at line 109 of file SealSignal.cxx.

◆ FileNames_t

◆ InputRenameMap_t

Enumeration Type Documentation

◆ Status

enum class Athena::Status : StatusCode::code_t
strong

Athena specific StatusCode values.

These can be used in place of Gaudi's StatusCode::XYZ if additional information should be returned. Some of these codes will result in special treatment of the event (e.g. sending them to the debug stream in the HLT).

Only generic return codes should be defined here. Algorithm-specific return values should be encoded in separate enums in the respective packages.

Enumerator
TIMEOUT 

Timeout during event processing.

MISSING_DATA 

Missing/corrupted input data.

Definition at line 22 of file AthStatusCode.h.

22 : StatusCode::code_t {
23 TIMEOUT = 10,
24 MISSING_DATA = 11
25};
@ TIMEOUT
Timeout during event processing.
@ MISSING_DATA
Missing/corrupted input data.

Function Documentation

◆ ATLAS_NOT_THREAD_SAFE() [1/5]

void Signal::handleFatal Athena::ATLAS_NOT_THREAD_SAFE ( const char * applicationName,
IOFD fd,
FatalHook hook,
FatalReturn mainreturn,
unsigned options )

Install default handler for fatal signals.

This method installs a handler for fatal signals such as floating point exceptions, illegal instructions, and memory violations. The behaviour is more precisely determined by options, a bitwise or of the option constants defined in the class declaration.

applicationName sets the application name to be used to report the signal in #fatalDump(). fd sets the file descriptor to which the fatal signal message is written; by default this will be the standard error output. hook sets the pre-exit application hook to invoke, mainreturn sets the hook to return to back to the application "main loop" (i.e. ignore the signal by jumping out of the signal back to the somewhere higher up in the application).

Options left to default values will not change the current state. This allows one to re-install signal handlers without disturbing already registered information. Use this to restore handlers after some other library has meddled with the handlers.

This installs #fatal() as the handler for fatal signals and on Windows for otherwise unhandled fatal structured exceptions. If #FATAL_ON_QUIT is included in options, quitting related signals (see #quit()) are also considered fatal. If #FATAL_ON_INT is set, SIGINT is considered fatal—but see also #fatal() documentation. If #USR1_DUMP_CORE is set, DebugAids::coredump is registered as a handler for SIGUSR1 (please note the security risks of this option in its documentation).

A multi-threaded application should call this method in each thread. (FIXME: Calling this in one thread and blocking signals in others won't work on Linux, and in any case will probably produce nonsense stack traces (unless stacktrace can be fixed to dump the stacks of all the threads). Since the handler is always the same, I am not sure it will make the slightest difference which thread catches the signals, and on the other hand, it is best to dump the problems in the faulting thread if possible.)

Definition at line 646 of file SealSignal.cxx.

651{
652 // FIXME: Provide means to install handlers for fatal signals that
653 // an application has requested and app was supposed to register a
654 // handler before making the request? (So that if the app handler
655 // is not installed for some reason, an internal error hook can
656 // run?) Such fatal signals include:
657 // - SIGPIPE: read or write to broken pipe; child died
658 // (read or write to socket with ASYNC io?)
659 // - SIGLOST: lost a resource (e.g., lock on nfs server reboot)
660 // - SIGALRM: interval timer elapsed
661 // - SIGUSR1, SIGUSR2
662 // - SIGPOLL: pollable streams device events
663 // - SIGIO: i/o possible (from async i/o)
664 // - SIGVTALRM: virtual timer expired
665 // - SIGPROF: profiling timer expired
666 // - SIGRTMIN - SIGRTMAX: POSIX real-time signals
667 //
668 // Some of these the application should probably just #block()
669 // (e.g. SIGPIPE). Some of them the app should block and then
670 // wait or poll for events (SIGPOLL, SIGIO, possibly SIGALRM, the
671 // real-time signals if they are used).
672
673 static const int hups [] = {
674#ifdef SIGHUP
675 SIGHUP, // hang up (lost terminal or process group leader)
676#endif
677#ifdef SIGTERM
678 SIGTERM, // terminate (e.g. system going down)
679#endif
680#ifdef SIGQUIT
681 SIGQUIT, /* user request to quit and leave debuggable
682 state (from quit key on controlling
683 terminal) */
684
685#endif
686 -1
687 };
688
689 static int fatals [] = {
690#ifdef SIGFPE
691 SIGFPE, // arithmetic exception
692#endif
693#ifdef SIGILL
694 SIGILL, // illegal instruction
695#endif
696#ifdef SIGSEGV
697 SIGSEGV, // illegal address
698#endif
699#ifdef SIGBUS
700 SIGBUS, // hardware exception
701#endif
702#ifdef SIGIOT
703 SIGIOT, /* IOT trap. Before SIGABRT so that if SIGIOT
704 == SIGABRT then SIGABRT overrides SIGIOT;
705 SIGABRT is in ISO C and POSIX.1, SIGIOT is
706 not. */
707#endif
708#ifdef SIGABRT
709 SIGABRT, // abort
710
711#endif
712#ifdef SIGTRAP
713 SIGTRAP, // trace/breakpoint reached
714#endif
715#ifdef SIGEMT
716 SIGEMT, // emulation trap (may be used by profiler?)
717#endif
718#ifdef SIGSYS
719 SIGSYS, // invalid system call
720#endif
721#ifdef SIGXCPU
722 SIGXCPU, // cpu time limit exceeded
723#endif
724#ifdef SIGXFSZ
725 SIGXFSZ, // file size limit exceeded
726#endif
727 -1
728 };
729
730 // Make sure `strsignal' is properly initialised.
731 name (1);
732
733 // Remember app name if specified
734 if (applicationName && *applicationName)
735 s_applicationName = applicationName;
736
737 // Automatically initialise s_fatalFd on first access
738 if (s_fatalFd == IOFD_INVALID)
739 s_fatalFd = STDERR_HANDLE;
740
741 // Remember the fatal output fd if defined
742 if (fd != IOFD_INVALID)
743 s_fatalFd = fd;
744
745 // Now that we know the fd, setup a callback for dumping shared
746 // libraries via #SignalDumpLibs. This avoids having to allocate
747 // memory for the callback implementation in the middle of a fatal
748 // signal, and on the other hand avoids a global object which
749 // might not be initialised yet.
750 delete SignalDumpCallback;
752 (CreateCallback (&SignalDumpLibs, s_fatalFd));
753
754 // Remember the hooks if specified
755 if (hook)
756 s_fatalHook = hook;
757
758 if (mainreturn)
759 s_fatalReturn = mainreturn;
760
761 // Remember the new options
762 s_fatalOptions = options;
763
764 // Signal::fatal() requires this, otherwise weird things can happen.
765 // Programs not wanting to return to main should set FATAL_AUTO_EXIT.
766 assert (s_fatalReturn || (s_fatalOptions & FATAL_AUTO_EXIT));
767
768 // Install signal handlers.
769 if (options & FATAL_ON_QUIT)
770 for (unsigned sig = 0; hups [sig] != -1; ++sig)
771 handle (hups [sig], fatal);
772
773 for (unsigned sig = 0; fatals [sig] != -1; ++sig)
774 handle (fatals [sig], fatal);
775
776#ifdef SIGINT
777 // interrupt key from controlling terminal
778 if (options & FATAL_ON_INT)
779 handle (SIGINT, fatal);
780#endif
781
782#ifdef SIGUSR1
783 // program-defined signals SIGUSR1 and SIGUSR2
784 if (options & USR1_DUMP_CORE)
785 handle (SIGUSR1, (HandlerType) DebugAids::coredump);
786#endif
787
788#ifdef _WIN32
789 SetUnhandledExceptionFilter (&SEHFatal);
790#endif
791}
#define IOFD_INVALID
Invalid channel descriptor constant.
Definition SealCommon.h:20
#define STDERR_HANDLE
Callback1Rep< T1 > * CreateCallback(void(*function)(T1, T2), const T2 &fill_2)
static void coredump(int sig,...)
Drop a core dump and continue.
Callback1< const LibraryInfo & > InfoHandler
static void SignalDumpLibs(const SharedLibrary::LibraryInfo &info, IOFD fd)
Internal Signal::fataldump() dumper to produce the list of currently loaded shared libraries.
static SharedLibrary::InfoHandler * SignalDumpCallback
Shared library dump callback for Signal::fataldump().
virtual void handle(const Incident &inc)
Handle end of run incidents to save the metadata at that point.

◆ ATLAS_NOT_THREAD_SAFE() [2/5]

bool Signal::fatalDump Athena::ATLAS_NOT_THREAD_SAFE ( int sig,
siginfo_t * info,
void * extra,
IOFD fd,
unsigned options )

Definition at line 1515 of file SealSignal.cxx.

1518{
1519 const unsigned int buf_size = sizeof (buf);
1520 bool haveCore = false;
1521 if (sig < 0)
1522 {
1523 sig = -sig;
1524 haveCore = true;
1525 }
1526
1527 if (options & FATAL_DUMP_SIG)
1528 {
1529 MYWRITE (fd, "\n", 1);
1530 if (s_applicationName)
1531 {
1532 MYWRITE (fd, s_applicationName,
1533 STDC::strlen (s_applicationName));
1534 MYWRITE (fd, " ", 1);
1535 }
1536
1537 MYWRITE (fd, buf,
1538 snprintf (buf, SIGNAL_MESSAGE_BUFSIZE, "(pid=%ld ppid=%ld) received fatal signal %d"
1539 " (%.100s)%s\n",
1540 (long) ProcessInfo__pid (), (long) ProcessInfo__ppid (), // wlav :: -> __ (x2)
1541 sig, name (sig), haveCore ? " (core dumped)" : ""));
1542
1543 MYWRITE (fd, buf, snprintf(buf, buf_size, "signal context:\n"));
1544 dumpInfo (fd, buf, buf_size, sig, info);
1545 }
1546
1547 unsigned long sp = 0;
1548 if (options & FATAL_DUMP_CONTEXT)
1549 sp = dumpContext (fd, buf, buf_size, extra);
1550
1551 if (options & FATAL_DUMP_STACK)
1552 {
1553 MYWRITE (fd, buf, snprintf(buf, buf_size, "\nstack trace:\n"));
1554 if (s_lastSP) {
1555 MYWRITE (fd, buf, snprintf(buf, buf_size, "\n(backtrace failed; raw dump follows)\n"));
1556 MYWRITE (fd, buf, snprintf(buf, buf_size, "%016lx:", s_lastSP.load()));
1557 dumpMemory (fd, buf, buf_size, reinterpret_cast<void*>(s_lastSP.load()), 1024);
1558 MYWRITE (fd, buf, snprintf(buf, buf_size, "\n\n"));
1559 }
1560 else {
1561 s_lastSP = sp;
1562 DebugAids::stacktrace (fd);
1563 }
1564 s_lastSP = 0;
1565 }
1566
1567 if (options & FATAL_DUMP_LIBS)
1568 {
1569 MYWRITE (fd, buf, snprintf(buf, buf_size, "\nshared libraries present:\n"));
1571 catch (...) { ; }
1572 }
1573
1574 return true;
1575}
static Double_t sp
#define MYWRITE(fd, data, n)
static pid_t ProcessInfo__pid(void)
Get the process id.
static const int SIGNAL_MESSAGE_BUFSIZE
static pid_t ProcessInfo__ppid(void)
Get the parent process id.
static void loaded(InfoHandler &handler)
Iterate and provide information about all currently loaded shared libraries.
static char buf[SIGNAL_MESSAGE_BUFSIZE]
Dump application state information on a fatal signal.

◆ ATLAS_NOT_THREAD_SAFE() [3/5]

bool Signal::fatalDump Athena::ATLAS_NOT_THREAD_SAFE ( int sig,
siginfo_t * info,
void * x )

The quit signal handler.

The fatal signal handler.

This is the handler installed by #handleQuit(). Please use #handleQuit() and this method instead of installing your own handlers with #handle().

This handler first invokes the application hook if one was given to #handleQuit(). If the hook returns true, the signal handler for this signal (number sig) is reset to its default handler, and the signal is re-raised. This causes the program to exit via the signal and have a the correct exit status.

The application should do whatever is necessary for a graceful shutdown. Note however that this signal may arrive asynchronously at any time, hence it probably isn't safe to allocate memory, use the standard output streams, and so forth. What you can do is to set a flag, return false to return back to your application, detect the flag setting and drain your current event loop, and then quit. But do note that if #FATAL_AUTO_EXIT was set in call to #handleFatal(), #fatal() will call #quit() which in turn calls the application hook. Thus the hook should make sure it returns true if the application has crashed as noted in the documentation for <<QuitHook>>.

This is the handler installed by #handleFatal(). Please use #handleFatal() and this method instead of installing your handlers with #handle(). You should be able use the handler options to specify all the control you need.

The first thing this handler does is to reinstall itself for the benefit of platforms with single-delivery signals. Immediately after that it unblocks the delivery of that signal again, in case the signal handler itself gets in trouble. The next step is to check if the current crash level (the recursion of calls to #fatal(), see #fatalLevel()) exceeds the predefined limit of 4; if so, we give up and let the application die with this this signal. The handler then determines whether the signal is fatal: everything except SIGINT is, and SIGINT is fatal if #FATAL_ON_INT was set. If the signal is fatal, crash indicator is set (see #crashed()).

If this is not a nested fatal signal, the signal is fatal, and #FATAL_DUMP_CORE is set, the handler tries dump a core file. Then the handler will either attempt to quit or to return to the main program depending on #FATAL_AUTO_EXIT option setting. If it is set or this is a nested fatal signal, the handler will attempt to exit as follows: the application hook (or #fatalDump() in its absence) is invoked. If the hook returns true, #quit() is called; otherwise the signal handler will return (and crash or get an infinite sequence of fatal signals). Note that if an application hook is registered, #fataldump() is not called by default; the application hook must invoke it itself to get the dump.

If #FATAL_AUTO_EXIT is not set, the application must have registered a main return hook, which will be invoked. The hook must not return, but do a siglongjmp back to the main program (it should not throw unless all code is built with options that allow exceptions to be thrown from signal handlers). Note that the fatal signal may be asynchronous and may have arisen in code left in unsafe state, so returning back to the main program may not buy you much. It may make sense for a few things like rogue null pointer dereferences or floating point exceptions.

An interactive application using a main return hook should do something like this when the sigsetjmp in the main loop returns:

  • disable "main loop entered" status
  • inform the user about the fatal error (e.g. with a popup); the popup window should be precreated for best stability
  • reset any locks the application holds, especially for user interface, including status bars, wait icons etc.
  • suggest to run a debugger against the program right there
  • in a windowing system ungrab pointer, keyboard and the server
  • unblock the signal via #block(sig, false) as the operating system may think the signal is still being processed
  • add an idle processor to re-return the "main loop entered" once all pending event queue events have been drained
  • go onto processing gui events

Using a main return will most likely leak memory like a sieve, but in balance, the application just got a fatal signal and the leak is unlikely to be the greatest concern.

Definition at line 817 of file SealSignal.cxx.

818{
819 // Quit if no hook has been registered: we are coming in via
820 // FATAL_AUTO_EXIT in fatal and the application did not call
821 // handleQuit.
822 if (! s_quitHook || (*s_quitHook) (sig, info, x))
823 {
824 // Reactivate the default signal handling behaviour for this
825 // signal, which is to terminate the application one way or
826 // the other. Then exit through the signal. This makes the
827 // process exit status correct.
828 revert (sig);
829 raise (sig);
830 }
831}
#define x

◆ ATLAS_NOT_THREAD_SAFE() [4/5]

void Signal::handleQuit Athena::ATLAS_NOT_THREAD_SAFE ( QuitHook hook)

Definition at line 581 of file SealSignal.cxx.

582{
583 static int hups [] = {
584#ifdef SIGHUP
585 // hang up (lost terminal or process group leader)
586 SIGHUP,
587#endif
588#ifdef SIGTERM
589 // terminate (e.g. system going down)
590 SIGTERM,
591#endif
592#ifdef SIGQUIT
593 // user request to quit and leave debuggable state (from quit
594 // key on controlling terminal)
595 SIGQUIT,
596#endif
597 -1
598 };
599
600 if (hook)
601 s_quitHook = hook;
602
603 for (unsigned sig = 0; hups [sig] != -1; ++sig)
604 handle (hups [sig], quit);
605}

◆ ATLAS_NOT_THREAD_SAFE() [5/5]

bool Signal::crashed Athena::ATLAS_NOT_THREAD_SAFE ( void )

Return the file descriptor #fataldump() uses for output.

Return the crash status indicator: true if a fatal signal has been received since the program started.

Return the depth to which #fatal() is currently recursively entered, or zero if #fatal() is not currently active.

Return the current application quit signal hook.

Return the current fatal signal handling options.

Return the application fatal signal return hook.

Return the application fatal signal hook.

Registered through #handleFatal().

Registered through #handleFatal().

See also
#fatal()

Registered through #handleFatal().

See also
#fatal().

Set on invocation to #handleFatal().

Registered through #handleQuit().

Use this method in application fatal hook to decide which operations are safe to perform. For example, if the attempts to notify the user result in further signals, it is best to avoid such attempts at deeper recursion levels. Currently #fatal() ceases to call the application's hooks and forces termination if the nesting level reaches 4.

Set if #fatal() is entered with a fatal signal.

Definition at line 103 of file ROOTMessageFilterSvc.cxx.

103 {
104
105 // Print the received configuration.
106 ATH_MSG_DEBUG("Using: " << m_suppressionRules);
107
108 // Extend the global list of suppression rules with the ones configured on
109 // this service.
110 for (const auto& rule : m_suppressionRules.value()) {
111 s_data.m_suppressionRules.insert({
112 std::regex{std::get<0>(rule)}, // locationPattern
113 std::regex{std::get<1>(rule)}, // messagePattern
114 std::get<2>(rule), // severity
115 std::hash<std::string>{}(std::get<0>(rule) + std::get<1>(rule) +
116 std::to_string(std::get<2>(rule))) // hash
117 });
118 }
119
120 // Set up our own error handler, while remembering the original one. But only
121 // if we have not set it up already.
122 if (!s_data.m_errorHandler) {
123 s_data.m_errorHandler = ::SetErrorHandler(::errorHandler);
124 }
125
126 // Return gracefully.
127 return StatusCode::SUCCESS;
128}
#define ATH_MSG_DEBUG(x)
static void errorHandler()

◆ back()

return m_collEvts Athena::back ( )

◆ find_coll_idx()

Athena::find_coll_idx ( - 1,
coll_idx ,
tuple_idx  )

◆ getMessageSvc() [1/2]

IMessageSvc * Athena::getMessageSvc ( bool quiet = false)

Definition at line 20 of file getMessageSvc.cxx.

20{ return getMessageSvc( Options::Lazy, quiet ); }
IMessageSvc * getMessageSvc(bool quiet=false)

◆ getMessageSvc() [2/2]

IMessageSvc * Athena::getMessageSvc ( const Options::CreateOptions o,
bool quiet = false )

Definition at line 21 of file getMessageSvc.cxx.

21 {
22
23 // We cache the MessageSvc, but only once it has been found. This ensures that an
24 // early call to this method (before MessageSvc is available) does not prevent
25 // from finding it in subsequent calls. The limited use of ServiceHandle for this
26 // purpose should be thread-safe:
27 static ServiceHandle<IMessageSvc> msgSvc ATLAS_THREAD_SAFE ("MessageSvc", "getMessageSvc");
28
29 IMessageSvc* svc = nullptr;
30 try {
31 svc = msgSvc.get();
32 if (svc) {
33 svc->addRef(); // even if cached, maintain correct ref-count
34 return svc;
35 }
36
37 const bool warn = !(quiet || Athena::getMessageSvcQuiet);
38 if ( ((opt==Athena::Options::Lazy && !Gaudi::svcLocator()->existsService("MessageSvc")) ||
39 msgSvc.retrieve().isFailure()) && warn ) {
40 std::cerr << "Athena::getMessageSvc: WARNING MessageSvc not found, will use std::cout" << std::endl;
41 }
42 svc = msgSvc.get();
43 }
44 catch (const GaudiException& e)
45 {
46 std::cerr << "Athena::getMessageSvc: WARNING Got Gaudi exception " << e
47 << "; will use std::out" << std::endl;
48 return nullptr;
49 }
50
51
52 return svc;
53}
#define ATLAS_THREAD_SAFE
std::atomic< bool > getMessageSvcQuiet
Set this to force off the warning messages from getMessageSvc (in unit tests, for example).
AthROOTErrorHandlerSvc * svc

◆ outputLevel()

int Athena::outputLevel ( const IMessageSvc * ims,
const std::string & source )

Definition at line 60 of file getMessageSvc.cxx.

60 {
61 if (ims) return ims->outputLevel(source);
62 else return MSG::INFO;
63}

◆ RecyclableDataObject()

template<typename... ARGS>
Athena::RecyclableDataObject ( std::shared_ptr< queue_t > queue,
ARGS &&... args )

Helper for recycling objects from event to event.

In some cases, one wants to reuse already-allocated objects from event to event, rather than deleting and recreating them each time. This has typically been done for complicated objects, such as classes deriving from IdentfiableContainer.

Some care is obviously needed for this to work in a MT job. Rather than holding a pointer to a specific object from a class member, we instead maintain a concurrent_queue of pointers to objects. When we want an object, we get one from the queue; if the queue is empty, then we allocate a new one.

The object used should derive from DataObject. We bump the reference count by 1 when the object is allocated so that it won't get deleted by StoreGate. We also override release() so that when the reference count goes back to 1 it is `recycled'. When this happens, we call the recycle() method on the object (which should probably be protected) and put the object back on the queue to be allocated again.

Example use: *

class MyDataObj : public DataObject { ...
public:
MyDataObj (bool createColl); ...
protected:
void recycle();
... };
class MyConverter { ...
private:
RecyclableDataQueue<MyDataObj> m_queue;
... };
StatusCode MyConverter::createObj (...) { ...
MyDataObj* obj = m_queue.get (true);
std::shared_ptr< queue_t > m_queue
The queue on which this object will be placed when it is recycled.
::StatusCode StatusCode
StatusCode definition for legacy code.

DOBJ should derive from DataObject and should provide a member recycle().

Implementation note: one needs to be careful about the order in which objects are deleted during finalization. In particular, it is possible for a Gaudi component that holds a RecyclableDataQueue as a member to be deleted while there are still associated data objects registered in the event store. To be robust against this, we allocate the actual queue object separately from RecyclableDataQueue and manage it with shared_ptr; RecyclableDataObject then references the queue with a shared_ptr. */ template <class DOBJ> class RecyclableDataObject : public DOBJ { public: / Underlying queue type holding these objects. typedef tbb::concurrent_queue<DOBJ*> queue_t;

/**

Constructor.

Parameters
queueQueue on which this object will be entered when it is released.
args...Additional arguments to pass to the DOBJ constructor.

◆ release()

virtual unsigned long Athena::release ( )
overridevirtual

DataObject release method.

This overrides the release() method of DataObject. Once the reference count falls back to 1 (meaning that the object is no longer referenced from StoreGate), we recycle the object back to the queue.

◆ reportMessage()

void Athena::reportMessage ( IMessageSvc * ims,
const std::string & source,
int type,
const std::string & message )

Wrappers for some of the IMessageSvc methods These can be used from libraries without explicit Gaudi dependency via weak linking.

(see e.g. TrigConf::MsgStream in TrigConfBase)

DO NOT MODIFY THE SIGNATURE OF THESE METHODS WITHOUT UPDATING THE TRIGCONF SIDE !!!

Definition at line 56 of file getMessageSvc.cxx.

56 {
57 if (ims) ims->reportMessage(source, type, message);
58}

◆ setOutputLevel()

void Athena::setOutputLevel ( IMessageSvc * ims,
const std::string & source,
int level )

Definition at line 65 of file getMessageSvc.cxx.

65 {
66 if(ims) ims->setOutputLevel(source, level);
67}

◆ SignalDumpLibs()

void Athena::SignalDumpLibs ( const SharedLibrary::LibraryInfo & info,
IOFD fd )
static

Internal #Signal::fataldump() dumper to produce the list of currently loaded shared libraries.

Called for every library detected by SharedLibrary::loaded().

Parameters
infoInformation about this particular library.
fdThe file descriptor to output to.

Definition at line 175 of file SealSignal.cxx.

176{
177 const int buf_size = BitTraits<unsigned long>::HexDigits + 5;
178 char buf [buf_size];
179 MYWRITE (fd, buf, snprintf (buf, buf_size, " 0x%08lx ", info.m_text_start));
180 MYWRITE (fd, info.m_filename, strlen (info.m_filename));
181 MYWRITE (fd, "\n", 1);
182}

◆ typeinfoName()

std::string Athena::typeinfoName ( const std::type_info & ti)

Convert a type_info to a demangled string.

Parameters
tiThe type_info to convert.

A wrapper around System::typeinfoName. Moved out-of-line so that this header does not need to depend on System.h.

Definition at line 23 of file AthenaKernel/src/ClassName.cxx.

24{
25 return System::typeinfoName (ti);
26}

◆ ubsan_boost_suppress()

int Athena::ubsan_boost_suppress ( )

Definition at line 21 of file ubsan_boost_suppress.cxx.

22{
23 // See <https://svn.boost.org/trac/boost/ticket/11632>
24 CxxUtils::ubsan_suppress ([]() { boost::format("%1%") % "asd"; });
25 return 0;
26}
void ubsan_suppress(void(*func)())
Helper for suppressing ubsan warnings.

Variable Documentation

◆ buf

char Athena::buf[SIGNAL_MESSAGE_BUFSIZE]
static

Dump application state information on a fatal signal.

Use this method to dump program state on a delivery of a fatal signal. #fatal() uses this function automatically if no fatal handler hook has not been registered by the application.

This function attempts to be as maximally robust given that it runs in a signal handler in conditions where the program by definition is unstable. In other words, it allocates no memory and writes its output directly to a file descriptor with direct system calls. For this reason some initialisation is required; use #handleFatal() to register the current application name and an output file descriptor, preferably as early in the program as possible.

The dump will consist of the following items:

  • if #FATAL_DUMP_SIG option is set:
    • the application name if registered with #handleFatal()
    • a title describing telling which fatal signal has been received (defined by sig, the signal number, or its negative if core has been dumped)
    • information available from the info argument
  • if #FATAL_DUMP_CONTEXT option is set, all the available CPU context information like registers
  • if #FATAL_DUMP_STACK option is set, the stack trace
  • if #FATAL_DUMP_LIBS option is set, the list of currently loaded shared libraries

This always returns true so it is convenient for the application fatal hook to return with a call to this function.

Note that this function will not flush std::cerr or stderr before producing output, for stability reasons. If the streams have unflushed output in their buffers, that output may get mixed with unbuffered direct output from this function. If you wish to avoid this mixup and are willing to take the risk that those calls might crash, install an application hook that flushes the streams and then calls this function.

Definition at line 1508 of file SealSignal.cxx.

◆ const

Athena::const
Initial value:
{
long coll_idx, tuple_idx

helper method to get the collection index (into m_inputCollectionsName) and tuple index (into m_tupleNames') for a given event index evtidx`.

returns -1 if not found. */ void RootNtupleEventSelector::find_coll_idx (int evtidx, long& coll_idx, long& tuple_idx) const { coll_idx = -1; tuple_idx = -1;

std::cout << "--find_coll_idx(" << evtidx << ")..." << std::endl << "--collsize: " << m_collEvts.size() << std::endl; for (size_t ituple = 0; ituple < m_collEvts.size(); ++ituple) { for (size_t icoll = 0; icoll < m_collEvts[ituple].size(); ++icoll) { CollMetaData &itr = m_collEvts[ituple][icoll]; if (itr.min_entries == -1) { TTree *tree = fetchNtuple(m_inputCollectionsName.value()[icoll], m_tupleNames[ituple]); if (tree) { long offset = 0; if (icoll > 0) { offset = m_collEvts[ituple][icoll-1].max_entries; } else if (ituple > 0) { offset = m_collEvts[ituple-1].back().max_entries; } itr.entries = tree->GetEntriesFast(); itr.min_entries = offset; itr.max_entries = offset + itr.entries; } else { throw "RootNtupleEventSelector: Unable to fetch ntuple"; } } std::cout << "--[" << i << "] => [" << itr.min_entries << ", " << itr.max_entries << ") evtidx=[" << evtidx << "]" << std::endl; if (itr.min_entries <= evtidx && evtidx < itr.max_entries) { coll_idx = icoll; tuple_idx = ituple; return; } } } }

/return total number of events in all TTree int RootNtupleEventSelector::size (Context& /*refCtxt

Definition at line 1262 of file RootNtupleEventSelector.cxx.

◆ getMessageSvcQuiet

std::atomic< bool > Athena::getMessageSvcQuiet
extern

Set this to force off the warning messages from getMessageSvc (in unit tests, for example).

Definition at line 18 of file getMessageSvc.cxx.

◆ m_queue

std::shared_ptr<queue_t> Athena::m_queue
private

The queue on which this object will be placed when it is recycled.

Definition at line 115 of file RecyclableDataObject.h.

◆ SignalDumpCallback

SharedLibrary::InfoHandler* Athena::SignalDumpCallback = 0
static

Shared library dump callback for #Signal::fataldump().

Allocated at initialisation time in #Signal::handleFatal() so that we won't need to allocate memory in the middle of a fatal handler. This variable is deliberately private to this file (to keep Signal headers from referring to SharedLibrary for the local class).

Definition at line 118 of file SealSignal.cxx.

◆ ubsan_boost_suppress_

int Athena::ubsan_boost_suppress_ = ubsan_boost_suppress()

Definition at line 29 of file ubsan_boost_suppress.cxx.