@@ -741,6 +741,32 @@ bool processSigChild(DeviceInfos& infos)
741741 return hasError;
742742}
743743
744+ void doDPLException (RuntimeErrorRef& e)
745+ {
746+ auto & err = o2::framework::error_from_ref (e);
747+ if (err.maxBacktrace != 0 ) {
748+ LOG (ERROR) << " Unhandled o2::framework::runtime_error reached the top of main, device shutting down. Details follow: \n " ;
749+ backtrace_symbols_fd (err.backtrace , err.maxBacktrace , STDERR_FILENO);
750+ } else {
751+ LOG (ERROR) << " Unhandled o2::framework::runtime_error reached the top of main, device shutting down."
752+ " Recompile with DPL_ENABLE_BACKTRACE=1 to get more information." ;
753+ }
754+ }
755+
756+ void doUnknownException (std::string const & s)
757+ {
758+ if (s.empty ()) {
759+ LOG (ERROR) << " Unknown error while setting up workflow." ;
760+ } else {
761+ LOG (ERROR) << " error while setting up workflow: " << s;
762+ }
763+ }
764+
765+ void doDefaultWorkflowTerminationHook ()
766+ {
767+ // LOG(INFO) << "Process " << getpid() << " is exiting.";
768+ }
769+
744770int doChild (int argc, char ** argv, ServiceRegistry& serviceRegistry, const o2::framework::DeviceSpec& spec, TerminationPolicy errorPolicy,
745771 uv_loop_t * loop)
746772{
@@ -808,14 +834,7 @@ int doChild(int argc, char** argv, ServiceRegistry& serviceRegistry, const o2::f
808834 << boost::current_exception_diagnostic_information (true );
809835 return 1 ;
810836 } catch (o2::framework::RuntimeErrorRef e) {
811- auto & err = o2::framework::error_from_ref (e);
812- if (err.maxBacktrace != 0 ) {
813- LOG (ERROR) << " Unhandled o2::framework::runtime_error reached the top of main, device shutting down. Details follow: \n " ;
814- backtrace_symbols_fd (err.backtrace , err.maxBacktrace , STDERR_FILENO);
815- } else {
816- LOG (ERROR) << " Unhandled o2::framework::runtime_error reached the top of main, device shutting down."
817- " Recompile with DPL_ENABLE_BACKTRACE=1 to get more information." ;
818- }
837+ doDPLException (e);
819838 return 1 ;
820839 } catch (std::exception& e) {
821840 LOG (ERROR) << " Unhandled std::exception reached the top of main: " << e.what () << " , device shutting down." ;
@@ -1161,16 +1180,26 @@ int runStateMachine(DataProcessorSpecs const& workflow,
11611180 }
11621181 break ;
11631182 case DriverState::MERGE_CONFIGS: {
1164- controls.resize (deviceSpecs.size ());
1165- deviceExecutions.resize (deviceSpecs.size ());
1166-
1167- DeviceSpecHelpers::reworkShmSegmentSize (dataProcessorInfos);
1168- DeviceSpecHelpers::prepareArguments (driverControl.defaultQuiet ,
1169- driverControl.defaultStopped ,
1170- dataProcessorInfos,
1171- deviceSpecs,
1172- deviceExecutions, controls,
1173- driverInfo.uniqueWorkflowId );
1183+ try {
1184+ controls.resize (deviceSpecs.size ());
1185+ deviceExecutions.resize (deviceSpecs.size ());
1186+
1187+ DeviceSpecHelpers::reworkShmSegmentSize (dataProcessorInfos);
1188+ DeviceSpecHelpers::prepareArguments (driverControl.defaultQuiet ,
1189+ driverControl.defaultStopped ,
1190+ dataProcessorInfos,
1191+ deviceSpecs,
1192+ deviceExecutions, controls,
1193+ driverInfo.uniqueWorkflowId );
1194+ } catch (o2::framework::RuntimeErrorRef& ref) {
1195+ auto & err = o2::framework::error_from_ref (ref);
1196+ LOG (ERROR) << " Unable to merge configurations: " << err.what ;
1197+ #ifdef DPL_ENABLE_BACKTRACE
1198+ std::cerr << " \n Stacktrace follows:\n\n " ;
1199+ backtrace_symbols_fd (err.backtrace , err.maxBacktrace , STDERR_FILENO);
1200+ #endif
1201+ return 1 ;
1202+ }
11741203
11751204 } break ;
11761205 case DriverState::SCHEDULE: {
0 commit comments