Bug 2247 - FT client does not receive COMM_FAILURE when server dies
Summary: FT client does not receive COMM_FAILURE when server dies
Status: RESOLVED FIXED
Alias: None
Product: TAO
Classification: Unclassified
Component: ORB (show other bugs)
Version: 1.4.7
Hardware: All All
: P3 normal
Assignee: Johnny Willemsen
URL:
Depends on:
Blocks: 4158
  Show dependency tree
 
Reported: 2005-09-29 06:18 CDT by Simon McQueen
Modified: 2014-02-26 07:42 CST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Simon McQueen 2005-09-29 06:18:31 CDT
On 21/09/2005 18:39, Milan Cvetkovic wrote:

> 1. I run a server, it writes an IOR file. This IOR file does not have
>    any FT related components.
> 2. I run a FT aware client by giving it a regular IOR of the object
>    in server process
> 3. Server core dumps in the middle of RPC
> 4. Client app does not receive COMM_FAILURE. Instead its returned
>    string is a NULL pointer (is this a bug).
>    If client is not FT aware, it does indeed receive COMM_FAILURE.
> 
> 
> I was trying to find exactly where this "NULL string" commes from.
> 
> Here is what I know so far:
> 
> For non FT-aware client:
> ========================
> 1. When the connection is lost, the client code invokes
>    Invocation_Base::handle_any_exception
> 2. The Invocation_Base::adapter_ == 0
>        Invocation_Base::invoke_status_ == TAO_INVOKE_START
> 3. Invocation_Base::handle_any_exception returns
>        PortableInterceptor::SYSTEM_EXCEPTION
> 
> For FT-aware client:
> ====================
> 1. When the connection is lost, the client code invokes
>    Invocation_Base::handle_any_exception
> 2. The Invocation_Base::adapter_ != 0,
>                  points to an instance of
>                  ClientRequestInterceptor_Adapter_Impl
>        Invocation_Base::invoke_status_ == TAO_INVOKE_START
> 3. Invocation_Base::handle_any_exception invokes
>        ClientRequestInterceptor_Adapter_Impl::reply_status
> 4. ClientRequestInterceptor_Adapter_Impl::reply_status
>        returns PortableInterceptor::UNKNOWN
> 5. Invocation_Base::handle_any_exception returns
>        returns PortableInterceptor::UNKNOWN
> 6. Synch_Twoway_Invocation::remote_twoway
>        treats PortableInterceptor::UNKNOWN as success
> 

Proposing this fix:

Index: tao/Invocation_Base.cpp
===================================================================
RCS file:
/project/cvs-repository/ACE_wrappers-repository/TAO/tao/Invocation_Base.cpp,v
retrieving revision 1.14
diff -u -r1.14 Invocation_Base.cpp
--- tao/Invocation_Base.cpp     19 Aug 2005 08:02:35 -0000      1.14
+++ tao/Invocation_Base.cpp     29 Sep 2005 11:18:03 -0000
@@ -205,6 +205,7 @@
                                          ACE_ENV_ARG_DECL)
   {
     caught_exception_ = ex;
+    invoke_status_ = TAO_INVOKE_SYSTEM_EXCEPTION;
 
     PortableInterceptor::ReplyStatus status =
       PortableInterceptor::SYSTEM_EXCEPTION;
@@ -227,6 +228,7 @@
   {
     PortableInterceptor::ReplyStatus status =
       PortableInterceptor::SYSTEM_EXCEPTION;
+    invoke_status_ = TAO_INVOKE_SYSTEM_EXCEPTION;
 
     if (adapter_ != 0)
       {
Comment 1 Johnny Willemsen 2005-09-29 07:10:02 CDT
I can't tell for sure until the regression is in the repo, but I think the
following patch will solve this. At the moment the exception is put in the
invocation base then we set the correct status. Also fixed an issue with the
handle_all_exception. 

Simon, can you add the patch to the archive and let me know when it is in, I
will revalidate then the patch.

cvs -z9 -w -q diff -u -- Invocation_Base.cpp Invocation_Base.h (in directory
C:\ACE\latest\ACE_wrappers\TAO\tao\)
Index: Invocation_Base.cpp
===================================================================
RCS file:
/project/cvs-repository/ACE_wrappers-repository/TAO/tao/Invocation_Base.cpp,v
retrieving revision 1.14
diff -u -u -r1.14 Invocation_Base.cpp
--- Invocation_Base.cpp	19 Aug 2005 08:02:35 -0000	1.14
+++ Invocation_Base.cpp	29 Sep 2005 12:08:46 -0000
@@ -204,7 +204,7 @@
   Invocation_Base::handle_any_exception (CORBA::Exception *ex
                                          ACE_ENV_ARG_DECL)
   {
-    caught_exception_ = ex;
+    this->exception (ex);
 
     PortableInterceptor::ReplyStatus status =
       PortableInterceptor::SYSTEM_EXCEPTION;
@@ -225,14 +225,14 @@
   PortableInterceptor::ReplyStatus
   Invocation_Base::handle_all_exception (ACE_ENV_SINGLE_ARG_DECL)
   {
+    CORBA::UNKNOWN ex;
+    this->exception (&ex);
+
     PortableInterceptor::ReplyStatus status =
       PortableInterceptor::SYSTEM_EXCEPTION;
 
     if (adapter_ != 0)
       {
-        CORBA::UNKNOWN ex;
-        this->caught_exception_ = &ex;
-
         this->adapter_->receive_exception (*this
                                            ACE_ENV_ARG_PARAMETER);
         ACE_CHECK_RETURN (PortableInterceptor::UNKNOWN);
@@ -247,6 +247,11 @@
   void
   Invocation_Base::exception (CORBA::Exception *exception)
   {
+    if (CORBA::SystemException::_downcast (exception) != 0)
+      this->invoke_status_ = TAO::TAO_INVOKE_SYSTEM_EXCEPTION;
+    else if (CORBA::UserException::_downcast (exception) != 0)
+      this->invoke_status_ = TAO::TAO_INVOKE_USER_EXCEPTION;
+
     this->caught_exception_ = exception;
   }
 
Index: Invocation_Base.h
===================================================================
RCS file:
/project/cvs-repository/ACE_wrappers-repository/TAO/tao/Invocation_Base.h,v
retrieving revision 1.9
diff -u -u -r1.9 Invocation_Base.h
--- Invocation_Base.h	19 Aug 2005 08:02:35 -0000	1.9
+++ Invocation_Base.h	29 Sep 2005 12:03:27 -0000
@@ -226,6 +226,7 @@
 
     TAO::Invocation_Status invoke_status_;
 
+  private:
     /// Pointer to the caught exception.
     CORBA::Exception *caught_exception_;
 #endif /*TAO_HAS_INTERCEPTORS*/


Comment 2 Johnny Willemsen 2005-09-29 12:55:21 CDT
Simon add the test to the repo, thanks! I will retest my patch now.
Comment 3 Johnny Willemsen 2005-09-30 05:48:47 CDT
Fixed.

Fri Sep 30 10:48:12 UTC 2005  Johnny Willemsen  <jwillemsen@remedy.nl>

        * tao/Invocation_Base.{h,cpp}:
          Set the invoke_status_ correctly when an exception has occured.
          This fixes bugzilla bug 2247. Thanks to Simon McQueen
          <sm@prismtech.com> for adding the regression for this test
          to the repo and to Milan Cvetkovic
          <milan dot cvetkovic at mpathix dot com> for creating the
          regression