Skip to content

Service initialisation problem

Not sure if this is a bug or a feature: I noticed an failure if ServiceA depends on ServiceB and both are in theApp.CreateSvc. Note that we (ATLAS) run with theApp.ExtSvcCreates=False.

Long story (after digging through the code): For services listed in theApp.CreateSvc, serviceManger->addService(..) gets called from AppMgr::configure(). At this point, the service gets created but not initialised. They get initialised once the ServiceManager is initialised.

Now I have the situation that one of the Services has an ServiceHandle to another Service and retrieves that in its initalize() method. That call goes through the fairly long call-chain ServiceLocatorHelper::getService(.. ,createIf=true, ..) -> ServiceLocatorHelper::createService( .. ) -> serviceLocator(=ServiceMgr)::service( .. ). In case the service is already in the list, it will return the pointer as-it-is, eg un-initialised. And this is where things fail.

If the service is not in the list, ServiceManager::service( .. ) calls ServiceManager.addService( .. ) and since the FSM has advanced to initialize it will also initialize the service.

This explains why adding another service to theApp.CreateSvc breaks the job.

A possible fix could be to check the targetFSMState and the FSM state of the service beeing request just before line line 189 in ServiceManager::service( ... ).

Aside: The two athena-services where I found this case form actually a circular dependency. I am working on fixing this one.

  • Walter
Edited by Frank Winklmeier
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information