Skip to content

Ensure MessageSvc and JobOptionsSvc are cleaned up when terminating ApplicationMgr

Chris Burr requested to merge lhcb/Gaudi:clean-terminate-appmgr into master

Currently using Gaudi.Application multiple times results in a SIGABORT due to the previous Application's MessageSvc and JobOptionsSvc being kept by the ServiceLocator. This pull request fixes it by making sure ApplicationMgr::terminate correctly cleans.

Reproducer

import Gaudi

app = Gaudi.Application({"ApplicationMgr.JobOptionsType": '"NONE"'})
app.run()
del app

app = Gaudi.Application({"ApplicationMgr.JobOptionsType": '"NONE"'})
app.run()
del app
ApplicationMgr    SUCCESS
====================================================================================================================================
                                                   Welcome to ApplicationMgr (GaudiCoreSvc v36r7)
                                          running on lblhcbpr20.cern.ch on Mon Aug  8 14:28:33 2022
====================================================================================================================================
ApplicationMgr       INFO Application Manager Configured successfully
ApplicationMgr       INFO Application Manager Initialized successfully
ApplicationMgr       INFO Application Manager Started successfully
EventSelector        INFO End of event input reached.
EventLoopMgr         INFO No more events in event selection
ApplicationMgr       INFO Application Manager Stopped successfully
EventLoopMgr         INFO Histograms converted successfully according to request.
ToolSvc              INFO Removing all tools created by ToolSvc
ApplicationMgr       INFO Application Manager Finalized successfully
ApplicationMgr       INFO Application Manager Terminated successfully
ApplicationMgr      FATAL Error creating MessageSvc of type  'MessageSvcType':'MessageSvc'
terminate called after throwing an instance of 'GaudiException'
  what():  failure creating basic services
fish: Job 1, './Gaudi/run ipython' terminated by signal SIGABRT (Abort)

Merge request reports