]> SALOME platform Git repositories - modules/superv.git/commitdiff
Salome HOME
Debugs :
authorrahuel <rahuel@opencascade.com>
Fri, 21 May 2004 12:35:00 +0000 (12:35 +0000)
committerrahuel <rahuel@opencascade.com>
Fri, 21 May 2004 12:35:00 +0000 (12:35 +0000)
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
src/GraphExecutor/DataFlowExecutor_InNodeThreads.cxx

index 1e12de895e4ce6e89af9343d24ec7be8575ab3c4..76ff07ffee78b77753ffb28d0dcda505f4ce1c35 100644 (file)
@@ -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 ;
       }
     }
index c11a4475e7a1c9b29f468a0b267a79dd0fa87237..b8a9eda24f26eb39c9800c8d1ac4de55d7b49285 100644 (file)
@@ -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 "