From 4d866042e3e1afe67936f1cfa44f82dfd153b2a1 Mon Sep 17 00:00:00 2001 From: rahuel Date: Fri, 21 May 2004 12:35:00 +0000 Subject: [PATCH] Debugs : 1. If Suspend, Resume, Kill, etc... is called for a node/Running-Service fo a component and if the component was terminated in error, the exception is catched and an error status is returned without crash. 2. If an Engines::Component method is invoked from the GraphExecutor and if the correcponding component crashed, the exeception is catched and an error status is returned without crash. 3. In any of theese case, the node and the graph get the state "ErroredState" --- src/GraphExecutor/DataFlowExecutor_InNode.cxx | 52 +++++++++++++++++-- .../DataFlowExecutor_InNodeThreads.cxx | 18 +++++-- 2 files changed, 60 insertions(+), 10 deletions(-) diff --git a/src/GraphExecutor/DataFlowExecutor_InNode.cxx b/src/GraphExecutor/DataFlowExecutor_InNode.cxx index 1e12de8..76ff07f 100644 --- a/src/GraphExecutor/DataFlowExecutor_InNode.cxx +++ b/src/GraphExecutor/DataFlowExecutor_InNode.cxx @@ -411,7 +411,15 @@ bool GraphExecutor::InNode::Ping() { RetVal = !CORBA::is_nil( _FactoryNode->Component() ) ; if ( RetVal ) { if ( State() != SUPERV::SuspendedExecutingState ) { - _FactoryNode->Component()->ping() ; + try { + _FactoryNode->Component()->ping() ; + } + catch( ... ) { + cdebug << "InNode::Ping() catched" << endl ; + State( SUPERV::ErroredState ) ; + _OutNode->State( SUPERV::ErroredState ) ; + RetVal = false ; + } } else { RetVal = false ; @@ -451,7 +459,15 @@ bool GraphExecutor::InNode::Suspend() { ControlState( SUPERV::ToSuspendState ) ; if ( IsFactoryNode() || IsComputingNode() ) { if ( !CORBA::is_nil( Component() ) ) { - RetVal = Component()->Suspend_impl() ; + try { + RetVal = Component()->Suspend_impl() ; + } + catch( ... ) { + cdebug << "InNode::Suspend() catched" << endl ; + State( SUPERV::ErroredState ) ; + _OutNode->State( SUPERV::ErroredState ) ; + RetVal = false ; + } if ( RetVal ) { if ( IsRunning() ) { cdebug << pthread_self() << "GraphExecutor::InNode::Suspend_impl " << Name() @@ -525,7 +541,15 @@ bool GraphExecutor::InNode::Kill() { if ( IsRunning() ) { if ( IsFactoryNode() || IsComputingNode() ) { if ( !CORBA::is_nil( Component() ) ) { - RetVal = Component()->Kill_impl() ; + try { + RetVal = Component()->Kill_impl() ; + } + catch( ... ) { + cdebug << "InNode::Suspend() catched" << endl ; + State( SUPERV::ErroredState ) ; + _OutNode->State( SUPERV::ErroredState ) ; + RetVal = false ; + } cdebug << "Component()->Kill_impl() returns status " << RetVal << endl ; RetVal = true ; if ( IsRunning() ) { @@ -622,7 +646,15 @@ bool GraphExecutor::InNode::Stop() { if ( IsRunning() ) { if ( IsFactoryNode() || IsComputingNode() ) { if ( !CORBA::is_nil( Component() ) ) { - RetVal = Component()->Stop_impl() ; + try { + RetVal = Component()->Stop_impl() ; + } + catch( ... ) { + cdebug << "InNode::Stop() catched" << endl ; + State( SUPERV::ErroredState ) ; + _OutNode->State( SUPERV::ErroredState ) ; + RetVal = false ; + } if ( RetVal ) { if ( IsRunning() ) { SendEvent( GraphExecutor::StopEvent ) ; @@ -696,7 +728,15 @@ bool GraphExecutor::InNode::Resume() { } else if ( State() == SUPERV::SuspendedExecutingState ) { if ( IsFactoryNode() || IsComputingNode() ) { - RetVal = Component()->Resume_impl() ; + try { + RetVal = Component()->Resume_impl() ; + } + catch( ... ) { + cdebug << "InNode::Resume() catched" << endl ; + State( SUPERV::ErroredState ) ; + _OutNode->State( SUPERV::ErroredState ) ; + RetVal = false ; + } } } else if ( State() == SUPERV::SuspendedSuccessedState ) { @@ -1264,6 +1304,8 @@ const long GraphExecutor::InNode::CpuUsed( bool tot ) { } catch ( ... ) { cdebug << "CpuUsed " << Name() << " --> Component()->CpuUsed_impl() ERROR catched " << endl ; + State( SUPERV::ErroredState ) ; + _OutNode->State( SUPERV::ErroredState ) ; cpu = 0 ; } } diff --git a/src/GraphExecutor/DataFlowExecutor_InNodeThreads.cxx b/src/GraphExecutor/DataFlowExecutor_InNodeThreads.cxx index c11a447..b8a9eda 100644 --- a/src/GraphExecutor/DataFlowExecutor_InNodeThreads.cxx +++ b/src/GraphExecutor/DataFlowExecutor_InNodeThreads.cxx @@ -491,10 +491,11 @@ void GraphExecutor::InNode::ThreadStartAction() { } int GraphExecutor::InNode::executeAction() { - int oldRewindStack = ( _RewindStack > 101 ) ; + int oldRewindStack = ( _RewindStack > MAXSTACKTHREADSIZE ) ; if ( !CreateNewThread() && oldRewindStack ) { cdebug << pthread_self() << "/" << ThreadNo() - << " executeAction start Thread _RewindStack " << _RewindStack << " > 101 CreateNewThread " + << " executeAction start Thread _RewindStack " << _RewindStack << " > " + << MAXSTACKTHREADSIZE << " CreateNewThread " << CreateNewThread() << " " << Automaton()->ActionName( _NextAction ) << "(" << Name() << ")" << endl; CreateNewThread( true ) ; @@ -1093,7 +1094,13 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { myObjComponent = Component() ; // cdebug << ThreadNo() << "Component known : NO StartComponent & Ping" // << endl ; - myObjComponent->ping() ; + try { + myObjComponent->ping() ; + } + catch( ... ) { + cdebug << "ping() catched" << endl ; + Err = true ; + } } int nOutParams = GetNodeOutPortsSize() ; @@ -1390,9 +1397,10 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { } catch( ... ) { cdebug << "DynInvoke setProperties catched ERROR" << endl ; + Err = true ; } } - if ( IsComputingNode() ) { + if ( !Err && IsComputingNode() ) { cdebug << ThreadNo() << " !ObjInterface " << Name() << " IsComputingNode DynInvoke" << endl ; cdebug << ServiceInParameter().length()-1 << " input parameters and " @@ -1402,7 +1410,7 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() { &InParametersList[1] , ServiceInParameter().length()-1 , &OutParametersList[0] , ServiceOutParameter().length() ) ; } - else if ( IsFactoryNode() ) { + else if ( !Err &&IsFactoryNode() ) { cdebug << ThreadNo() << " !ObjInterface " << Name() << " IsFactoryNode DynInvoke" << endl ; cdebug << ServiceInParameter().length() << " input parameters and " -- 2.39.2