Bug 2350

Summary: AMI calls that throw an exception don't work with -ORBCollocation no
Product: TAO Reporter: Alan Stokes <alan>
Component: AMIAssignee: DOC Center Support List (internal) <tao-support>
Status: RESOLVED FIXED    
Severity: normal CC: n.metchev
Priority: P3    
Version: 1.5.2   
Hardware: x86   
OS: Windows XP   
Bug Depends on: 2141    
Bug Blocks:    
Attachments: Patch illustrating how I was able to get the test working
TAO_IDL patch to correct this bug
A revision of my previous patch

Description Alan Stokes 2006-01-06 08:08:46 CST
If a client is running with -ORBCollocation no and it makes an AMI call where
the server throws an exception, then what should happen is that the client
handler's _excep function is called.

In fact what happens is that the message "(.\Valuetype\ValueBase.cpp:352) OBV
factory is null !!!" is printed and no handler function is called.

The easiest way to see this is to modify ACE_wrappers\TAO\tests\AMI\run_test.pl
as follows:@@ -47,6 +47,7 @@
 $CL = new PerlACE::Process ("simple_client",
                             "-ORBsvcconf $client_conf "
                             . "-ORBdebuglevel $debug_level"
+                            . " -ORBCollocation no"
                             . " -k file://$iorfile "
                             . " -i $iterations -x -d");

Then run run_test.pl. The output looks in part like this:
  .\ami_test_i.cpp:43:(3008:2732):AMI_Test_i::foo:  931247 Let's talk SMI.
  (.\Valuetype\ValueBase.cpp:352) OBV factory is null !!!
The expected success line ("... exception received successfully") is not printed.

The problem seems to be that when the exception response is received the
reply handler skeleton function xxx_reply_stub is called from
TAO_Asynch_Reply_Dispatcher::dispatch_reply.  In turn it tries to call
xxx_excep on the handler object. This should be a collocated call, but
it actually ends up going across the wire (since we've disabled
collocation) and hits the OBV factory problem and returns a
marshalling error. (Because it doesn't know how to marshall the
Messaging::ExceptionHolder?)

Note that removing "ORBcollocation no" is only a workaround if the client and
server are not in fact collocated. If they are much worse problems occur,
because of the separate issue that AMI does not work with collocation.

(As possibly a separate issue I have seen the _excep function called with a null
pointer after the OBV message is displayed. But I can't create a simple example
which demonstrates this. It may be timing related and involves interaction with
other asynchronous calls.)
Comment 1 Johnny Willemsen 2006-01-06 12:46:45 CST
accepting on behalf of TAO support. This is also happening with x.4.7, so not
related to the AMI update. There is no OBV factory for the exception holder at
this moment
Comment 2 Johnny Willemsen 2006-01-06 14:32:05 CST
Diff below adds a factory for the messaging holder, but this seems not to be
enough, data_ and count_ member of the exceptionholder are not filled now,
meaning we can't raise the right exception, only an unknown user exception (of
course the members should be initialized to the zero, not done yet). Call stack
for everything is at the bottom. Seems we could generate some more exception
info by the idl compiler, but then we should get it someway in the exceptionholder.

Index: ExceptionHolder_i.cpp
===================================================================
RCS file:
/project/cvs-repository/ACE_wrappers-repository/TAO/tao/Messaging/ExceptionHolder_i.cpp,v
retrieving revision 1.4
diff -u -u -r1.4 ExceptionHolder_i.cpp
--- ExceptionHolder_i.cpp	3 Nov 2005 17:38:46 -0000	1.4
+++ ExceptionHolder_i.cpp	6 Jan 2006 19:53:39 -0000
@@ -15,6 +15,10 @@
 
 namespace TAO
 {
+  ExceptionHolder::ExceptionHolder (void)
+  {
+  }
+
   ExceptionHolder::ExceptionHolder (
       ::CORBA::Boolean is_system_exception,
       ::CORBA::Boolean byte_order,
@@ -57,6 +61,20 @@
       // todo convert exceptionlist to something we can really use.
       this->raise_exception (ACE_ENV_SINGLE_ARG_PARAMETER);
     }
+
+  CORBA::ValueBase *
+  ExceptionHolderFactory::create_for_unmarshal (
+    ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+  {
+    TAO::ExceptionHolder* ret_val = 0;
+    ACE_NEW_THROW_EX (ret_val,
+                      ExceptionHolder,
+                      CORBA::NO_MEMORY ());
+    ACE_CHECK_RETURN (0);
+
+    return ret_val;
+  }
+
 }
 
 TAO_END_VERSIONED_NAMESPACE_DECL
Index: ExceptionHolder_i.h
===================================================================
RCS file:
/project/cvs-repository/ACE_wrappers-repository/TAO/tao/Messaging/ExceptionHolder_i.h,v
retrieving revision 1.4
diff -u -u -r1.4 ExceptionHolder_i.h
--- ExceptionHolder_i.h	3 Nov 2005 17:38:46 -0000	1.4
+++ ExceptionHolder_i.h	6 Jan 2006 19:44:46 -0000
@@ -26,6 +26,7 @@
 
 #include "tao/Messaging/ExceptionHolderA.h"
 #include "tao/Messaging/ExceptionHolderC.h"
+#include "tao/ValueType/ValueFactory.h"
 
 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
 
@@ -48,6 +49,8 @@
       public virtual ::CORBA::DefaultValueRefCountBase
   {
   public:
+    ExceptionHolder (void);
+
     ExceptionHolder (
       ::CORBA::Boolean is_system_exception,
       ::CORBA::Boolean byte_order,
@@ -68,10 +71,26 @@
 
   private:
 
-    TAO::Exception_Data* const data_;
-    CORBA::ULong const count_;
+    TAO::Exception_Data* data_;
+    CORBA::ULong count_;
+
+  };
 
+  /**
+   * @class ExceptionHolderFactory
+   *
+   * @brief OBV factory implementation.
+   *
+   * Factory for ExceptionHolder
+   */
+  class TAO_Messaging_Export ExceptionHolderFactory :
+    public virtual CORBA::ValueFactoryBase
+  {
+  public:
+    virtual CORBA::ValueBase * create_for_unmarshal (
+      ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);
   };
+
 }
 
 TAO_END_VERSIONED_NAMESPACE_DECL
Index: Messaging_ORBInitializer.cpp
===================================================================
RCS file:
/project/cvs-repository/ACE_wrappers-repository/TAO/tao/Messaging/Messaging_ORBInitializer.cpp,v
retrieving revision 1.10
diff -u -u -r1.10 Messaging_ORBInitializer.cpp
--- Messaging_ORBInitializer.cpp	3 Nov 2005 17:38:46 -0000	1.10
+++ Messaging_ORBInitializer.cpp	6 Jan 2006 20:16:54 -0000
@@ -5,7 +5,9 @@
 #include "Messaging_Policy_i.h"
 #include "Connection_Timeout_Policy_i.h"
 #include "Messaging_PolicyFactory.h"
+#include "ExceptionHolder_i.h"
 #include "tao/ORB_Core.h"
+#include "tao/PI/ORBInitInfo.h"
 
 ACE_RCSID (Messaging,
            Messaging_ORBInitializer,
@@ -145,6 +147,36 @@
       ACE_ENDTRY;
       ACE_CHECK;
     }
+
+      // Narrow to a TAO_ORBInitInfo object to get access to the
+  // orb_core() TAO extension.
+  TAO_ORBInitInfo_var tao_info =
+    TAO_ORBInitInfo::_narrow (info
+                              ACE_ENV_ARG_PARAMETER);
+  ACE_CHECK;
+
+  if (CORBA::is_nil (tao_info.in ()))
+    {
+      if (TAO_debug_level > 0)
+        ACE_ERROR ((LM_ERROR,
+                    "(%P|%t) TAO_RT_ORBInitializer::pre_init:\n"
+                    "(%P|%t)    Unable to narrow "
+                    "\"PortableInterceptor::ORBInitInfo_ptr\" to\n"
+                    "(%P|%t)   \"TAO_ORBInitInfo *.\"\n"));
+
+      ACE_THROW (CORBA::INTERNAL ());
+    }
+
+      TAO::ExceptionHolderFactory *base_factory = 0;
+  ACE_NEW (base_factory,
+                  TAO::ExceptionHolderFactory)
+                  ; // supplied by mapping
+
+  tao_info->orb_core()->orb ()->register_value_factory
(Messaging::ExceptionHolder::_tao_obv_static_repository_id (),
+                               base_factory
+                               ACE_ENV_ARG_PARAMETER);
+  ACE_TRY_CHECK;
+  base_factory->_remove_ref (); // release ownership
 }
 
 TAO_END_VERSIONED_NAMESPACE_DECL

***** CVS exited normally with code 1 *****



007E952E TAO_Messaging_Helper::exception_holder_raise(exception_data=:78452F67,
exception_count=1953523043, marshaled_data=:00DD24C8, marshaled_data_length=41,
byte_order=true, is_system_exception=false)
007E771A TAO::ExceptionHolder::raise_exception(this=:00DD599C)
0040E5C8 Handler::foo_excep(this=:0012FE34, excep_holder=:00DD59C4)
0040C729 POA_A::foo_excep_AMI_AMI_TestHandler::execute(this=:0012B8B4)
0078E688 TAO::Upcall_Wrapper::upcall(this=:0012B87C, server_request=:0012BC00,
args=:0012B888, nargs=2, command=:0012B8B4, servant_upcall=:0012B9C0,
exceptions=NULL, nexceptions=0)
00409C5E POA_A::AMI_AMI_TestHandler::foo_excep_skel(server_request=:0012BC00,
servant_upcall=:0012B9C0, servant=:0012FE34)
00785FC8 TAO_ServantBase::synchronous_upcall_dispatch(this=:0012FE50,
req=:0012BC00, servant_upcall=:0012B9C0, derived_this=:0012FE34)
0040B285 POA_A::AMI_AMI_TestHandler::_dispatch(this=:0012FE34, req=:0012BC00,
servant_upcall=:0012B9C0)
0075A2FC TAO_Object_Adapter::do_dispatch(this=:00DBAF64, req=:0012BC00,
upcall=:0012B9C0)
0075805F TAO_Object_Adapter::dispatch_servant(this=:00DBAF64, key=:0012BC88,
req=:0012BC00, forward_to={ :0012BBF0 })
00759136 TAO_Object_Adapter::dispatch(this=:00DBAF64, key=:0012BC88,
request=:0012BC00, forward_to={ :0012BBF0 })
0057415B TAO_Adapter_Registry::dispatch(this=:00D9B714, key=:0012BC88,
request=:0012BC00, forward_to={  })
005EAAD3 TAO_Request_Dispatcher::dispatch(this=:00DA1674, orb_core=:00D9B50C,
request=:0012BC00, forward_to={  })
0059BFA8 TAO_GIOP_Message_Base::process_request(this=:00DD5514,
transport=:00DD52CC, cdr=:0012BF68, output=:0012BFA0, parser=:00DD5538)
0059B953 TAO_GIOP_Message_Base::process_request_message(this=:00DD5514,
transport=:00DD52CC, qd=:00DD473C)
00609969 TAO_Transport::process_parsed_messages(this=:00DD52CC, qd=:00DD473C,
rh=:0012C64C)
00609D7C TAO_Transport::process_queue_head(this=:00DD52CC, rh=:0012C64C)
006098B0 TAO_Transport::consolidate_extra_messages(this=:00DD52CC,
incoming=:0012C59C, rh=:0012C64C)
00608AF0 TAO_Transport::parse_consolidate_messages(this=:00DD52CC,
block=:0012C59C, rh=:0012C64C, max_wait_time=NULL)
006087A7 TAO_Transport::handle_input(this=:00DD52CC, rh=:0012C64C,
max_wait_time=NULL,  =0)
0057BFBB TAO_Connection_Handler::handle_input_internal(this=:00DD5240,
h=:0000069C, eh=:00DD51D4)
0057BE7F TAO_Connection_Handler::handle_input_eh(this=:00DD5240, h=:0000069C,
eh=:00DD51D4)
005ACBC5 TAO_IIOP_Connection_Handler::handle_input(this=:00DD51D4, h=:0000069C)
004CC8BC ACE_TP_Reactor::dispatch_socket_event(this=:00DA91A0,
dispatch_info=:0012C6D0)
004CC4EB ACE_TP_Reactor::handle_socket_events(this=:00DA91A0,
event_count=:0012C710, guard=:0012C750)
004CC22D ACE_TP_Reactor::dispatch_i(this=:00DA91A0, max_wait_time=NULL,
guard=:0012C750)
004CC069 ACE_TP_Reactor::handle_events(this=:00DA91A0, max_wait_time=NULL)
004A31D4 ACE_Reactor::handle_events(this=:00DA9190, max_wait_time=NULL)
00610BF9 TAO_Wait_On_Reactor::wait(this=:00DD4AC0, max_wait_time=NULL, rd=:0012C8D8)
005F1644 TAO::Synch_Twoway_Invocation::wait_for_reply(this=:0012CBB4,
max_wait_time=NULL, rd=:0012C8D8, bd=:0012C8C8)
005F1395 TAO::Synch_Twoway_Invocation::remote_twoway(this=:0012CBB4,
max_wait_time=NULL)
005BD858 TAO::Invocation_Adapter::invoke_twoway(this=:0012CDB4,
details=:0012CD14, effective_target=:0012CCC8, r=:0012CC58, max_wait_time=:0012CC9C)
005BD70A TAO::Invocation_Adapter::invoke_remote_i(this=:0012CDB4,
stub=:00DCCC3C, details=:0012CD14, effective_target=:0012CCC8,
max_wait_time=:0012CC9C)
005BD289 TAO::Invocation_Adapter::invoke_i(this=:0012CDB4, stub=:00DCCC3C,
details=:0012CD14)
005BD135 TAO::Invocation_Adapter::invoke(this=:0012CDB4, ex_data=NULL, ex_count=0)
00404281 A::AMI_AMI_TestHandler::get_yadda(this=:00DD58B0, ami_return_val=4711)
00404397 A::AMI_AMI_TestHandler::get_yadda_reply_stub(_tao_in=:00DCFEE8,
_tao_reply_handler=:00DCCDD0, reply_status=0)
007E5496 TAO_Asynch_Reply_Dispatcher::dispatch_reply(this=:00DCFCA4,
params=:0012D048)
005CAEE1 TAO_Muxed_TMS::dispatch_reply(this=:00DCD02C, params=:0012D048)
0059BBBB TAO_GIOP_Message_Base::process_reply_message(this=:00DCD1A4,
params=:0012D048, qd=:00DD479C)
006099DA TAO_Transport::process_parsed_messages(this=:00DCCF5C, qd=:00DD479C,
rh=:0012D5F0)
00609D7C TAO_Transport::process_queue_head(this=:00DCCF5C, rh=:0012D5F0)
00608431 TAO_Transport::handle_input(this=:00DCCF5C, rh=:0012D5F0,
max_wait_time=NULL,  =0)
0057BFBB TAO_Connection_Handler::handle_input_internal(this=:00DCCED0,
h=:FFFFFFFF, eh=:00DCCE64)
0057BE7F TAO_Connection_Handler::handle_input_eh(this=:00DCCED0, h=:FFFFFFFF,
eh=:00DCCE64)
005ACBC5 TAO_IIOP_Connection_Handler::handle_input(this=:00DCCE64, h=:FFFFFFFF)
004AA50B ACE_Select_Reactor_Notify::dispatch_notify(this=:00DB5510,
buffer=:0012D694)
004CC3F2 ACE_TP_Reactor::handle_notify_events(this=:00DA91A0,  =:0012D6B4,
guard=:0012D6F4)
004CC207 ACE_TP_Reactor::dispatch_i(this=:00DA91A0, max_wait_time=NULL,
guard=:0012D6F4)
004CC069 ACE_TP_Reactor::handle_events(this=:00DA91A0, max_wait_time=NULL)
004A31D4 ACE_Reactor::handle_events(this=:00DA9190, max_wait_time=NULL)
00610BF9 TAO_Wait_On_Reactor::wait(this=:00DD4AC0, max_wait_time=NULL, rd=:0012D87C)
005F1644 TAO::Synch_Twoway_Invocation::wait_for_reply(this=:0012DB58,
max_wait_time=NULL, rd=:0012D87C, bd=:0012D86C)
005F1395 TAO::Synch_Twoway_Invocation::remote_twoway(this=:0012DB58,
max_wait_time=NULL)
005BD858 TAO::Invocation_Adapter::invoke_twoway(this=:0012DD5C,
details=:0012DCB8, effective_target=:0012DC6C, r=:0012DBFC, max_wait_time=:0012DC40)
005BD70A TAO::Invocation_Adapter::invoke_remote_i(this=:0012DD5C,
stub=:00DCCC3C, details=:0012DCB8, effective_target=:0012DC6C,
max_wait_time=:0012DC40)
005BD289 TAO::Invocation_Adapter::invoke_i(this=:0012DD5C, stub=:00DCCC3C,
details=:0012DCB8)
005BD135 TAO::Invocation_Adapter::invoke(this=:0012DD5C, ex_data=:00410130,
ex_count=1)
00403806 A::AMI_AMI_TestHandler::foo(this=:00DD5854, ami_return_val=931234,
out_l=931233)
00403952 A::AMI_AMI_TestHandler::foo_reply_stub(_tao_in=:00DD01A8,
_tao_reply_handler=:00DCCDD0, reply_status=0)
007E5496 TAO_Asynch_Reply_Dispatcher::dispatch_reply(this=:00DCFF64,
params=:0012E00C)
005CAEE1 TAO_Muxed_TMS::dispatch_reply(this=:00DCD02C, params=:0012E00C)
0059BBBB TAO_GIOP_Message_Base::process_reply_message(this=:00DCD1A4,
params=:0012E00C, qd=:00DD47CC)
006099DA TAO_Transport::process_parsed_messages(this=:00DCCF5C, qd=:00DD47CC,
rh=:0012E618)
00609D7C TAO_Transport::process_queue_head(this=:00DCCF5C, rh=:0012E618)
006098B0 TAO_Transport::consolidate_extra_messages(this=:00DCCF5C,
incoming=:0012E568, rh=:0012E618)
00608AF0 TAO_Transport::parse_consolidate_messages(this=:00DCCF5C,
block=:0012E568, rh=:0012E618, max_wait_time=NULL)
006087A7 TAO_Transport::handle_input(this=:00DCCF5C, rh=:0012E618,
max_wait_time=NULL,  =0)
0057BFBB TAO_Connection_Handler::handle_input_internal(this=:00DCCED0,
h=:000006C0, eh=:00DCCE64)
0057BE7F TAO_Connection_Handler::handle_input_eh(this=:00DCCED0, h=:000006C0,
eh=:00DCCE64)
005ACBC5 TAO_IIOP_Connection_Handler::handle_input(this=:00DCCE64, h=:000006C0)
004CC8BC ACE_TP_Reactor::dispatch_socket_event(this=:00DA91A0,
dispatch_info=:0012E69C)
004CC4EB ACE_TP_Reactor::handle_socket_events(this=:00DA91A0,
event_count=:0012E6DC, guard=:0012E71C)
004CC22D ACE_TP_Reactor::dispatch_i(this=:00DA91A0, max_wait_time=NULL,
guard=:0012E71C)
004CC069 ACE_TP_Reactor::handle_events(this=:00DA91A0, max_wait_time=NULL)
004A31D4 ACE_Reactor::handle_events(this=:00DA9190, max_wait_time=NULL)
00610BF9 TAO_Wait_On_Reactor::wait(this=:00DD4AC0, max_wait_time=NULL, rd=:0012E8A4)
005F1644 TAO::Synch_Twoway_Invocation::wait_for_reply(this=:0012EB80,
max_wait_time=NULL, rd=:0012E8A4, bd=:0012E894)
005F1395 TAO::Synch_Twoway_Invocation::remote_twoway(this=:0012EB80,
max_wait_time=NULL)
005BD858 TAO::Invocation_Adapter::invoke_twoway(this=:0012ED80,
details=:0012ECE0, effective_target=:0012EC94, r=:0012EC24, max_wait_time=:0012EC68)
005BD70A TAO::Invocation_Adapter::invoke_remote_i(this=:0012ED80,
stub=:00DCCC3C, details=:0012ECE0, effective_target=:0012EC94,
max_wait_time=:0012EC68)
005BD289 TAO::Invocation_Adapter::invoke_i(this=:0012ED80, stub=:00DCCC3C,
details=:0012ECE0)
005BD135 TAO::Invocation_Adapter::invoke(this=:0012ED80, ex_data=NULL, ex_count=0)
00403FA8 A::AMI_AMI_TestHandler::foo_excep(this=:00DD4808, excep_holder=:00DD48AC)
00403B1E A::AMI_AMI_TestHandler::foo_reply_stub(_tao_in=:00DD0468,
_tao_reply_handler=:00DCCDD0, reply_status=2)
007E5496 TAO_Asynch_Reply_Dispatcher::dispatch_reply(this=:00DD0224,
params=:0012F01C)
005CAEE1 TAO_Muxed_TMS::dispatch_reply(this=:00DCD02C, params=:0012F01C)
0059BBBB TAO_GIOP_Message_Base::process_reply_message(this=:00DCD1A4,
params=:0012F01C, qd=:0012F064)
006099DA TAO_Transport::process_parsed_messages(this=:00DCCF5C, qd=:0012F064,
rh=:0012F594)
0060892A TAO_Transport::handle_input(this=:00DCCF5C, rh=:0012F594,
max_wait_time=NULL,  =0)
0057BFBB TAO_Connection_Handler::handle_input_internal(this=:00DCCED0,
h=:000006C0, eh=:00DCCE64)
0057BE7F TAO_Connection_Handler::handle_input_eh(this=:00DCCED0, h=:000006C0,
eh=:00DCCE64)
005ACBC5 TAO_IIOP_Connection_Handler::handle_input(this=:00DCCE64, h=:000006C0)
004CC8BC ACE_TP_Reactor::dispatch_socket_event(this=:00DA91A0,
dispatch_info=:0012F618)
004CC4EB ACE_TP_Reactor::handle_socket_events(this=:00DA91A0,
event_count=:0012F658, guard=:0012F698)
004CC22D ACE_TP_Reactor::dispatch_i(this=:00DA91A0, max_wait_time=NULL,
guard=:0012F698)
004CC069 ACE_TP_Reactor::handle_events(this=:00DA91A0, max_wait_time=NULL)
004A31D4 ACE_Reactor::handle_events(this=:00DA9190, max_wait_time=NULL)
00610BF9 TAO_Wait_On_Reactor::wait(this=:00DCD01C, max_wait_time=NULL, rd=:0012F820)
005F1644 TAO::Synch_Twoway_Invocation::wait_for_reply(this=:0012FAFC,
max_wait_time=NULL, rd=:0012F820, bd=:0012F810)
005F1395 TAO::Synch_Twoway_Invocation::remote_twoway(this=:0012FAFC,
max_wait_time=NULL)
005BD858 TAO::Invocation_Adapter::invoke_twoway(this=:0012FD0C,
details=:0012FC5C, effective_target=:0012FC10, r=:0012FBA0, max_wait_time=:0012FBE4)
005BD70A TAO::Invocation_Adapter::invoke_remote_i(this=:0012FD0C,
stub=:00DCC4E4, details=:0012FC5C, effective_target=:0012FC10,
max_wait_time=:0012FBE4)
005BD289 TAO::Invocation_Adapter::invoke_i(this=:0012FD0C, stub=:00DCC4E4,
details=:0012FC5C)
005BD135 TAO::Invocation_Adapter::invoke(this=:0012FD0C, ex_data=:004100D4,
ex_count=1)
00401CF2 A::AMI_Test::foo(this=:00DCC630, out_l=:0012FDD8, in_l=931247,
in_str=:0041400F)
0040DB8A ace_main_i(argc=6, argv=:00D9B118)
0040EA96 ACE_Main::run_i(this=:0012FF88, argc=10, argv=:00D9B118)
004885F5 ACE_Main_Base::run(this=:0012FF88, argc=10, argv=:00D9B118)
0048864E ace_os_main_i(mbase=:0012FF88, argc=10, argv=:00D9B118)
0040D4CF main(argc=10, argv=:00D9B118)
3267E552 C:\PROGRA~1\Borland\CBUILD~1\Bin\CC3260MT.DLL
Comment 3 Nikolay 2006-01-09 09:08:12 CST
adding myself to the cc list
Comment 4 Johnny Willemsen 2006-01-09 09:09:53 CST
Local patches are ready to get at least system exceptions through, all user
exceptions are converted to UNKNOWN. Have to do some more testing before this
can get into the repo.
Comment 5 Johnny Willemsen 2006-01-13 06:51:59 CST
Fri Jan 13 12:49:12 UTC 2006  Johnny Willemsen  <jwillemsen@remedy.nl>

        * tao/Messaging/ExceptionHolder_i.{h,cpp}:
        * tao/Messaging/Messaging_ORBInitializer.{h,cpp}:
          Added a OBV Factory for the ExceptionHolder. At the moment we use
          AMI with collocation disabled the ExceptionHolder is marshaled
          and then tried to be demarshaled and then we need an OBV factory.
          For system exceptions things work fine now, for user exceptions
          always an UNKNOWN exception occurs in the _excep method, the
          meta data which user exceptions we could throw is not available
          in the current callstack so we just can't recreate the correct
          user exception, have to see how we could fix that but
          this is at least a good step in the direction. This only works
          for the new AMI mapping. This is part of the fix for bugzilla
          bug 2350. Thanks to Alan Stokes <alan at alanstokes dot org dot uk>
          for reporting this.
Comment 6 Johnny Willemsen 2006-08-04 05:37:12 CDT
Added depends on another ami collocation bug
Comment 7 Nanbor Wang 2006-08-08 01:38:49 CDT
Changed component to AMI
Comment 8 Johnny Willemsen 2006-08-09 05:55:18 CDT
still valid in 1.5.2
Comment 9 Phil Mesnier 2006-11-09 19:52:17 CST
I took a look at this problem with the current (TAO 1.5.3+) code and was able to
work out a solution by adding some additional context to the generated AMI
skeleton code. It is possible to supply the exception data to the
ExceptionHolder at the moment before invoking the *_excep() method so that that
method can invoke ExceptionHolder::raise_exception() and get the expected result.

I don't yet know how to modify the IDL compiler to generate the necessary code
in the skeleton, but since it is basically the same as what is already generated
on the stub side, it shouldn't be difficult. The following patch includes
changes to the ExceptionHolder to take the data after creation time, as well as
a modified ami_test skeleton from the tests/AMI directory.
Comment 10 Phil Mesnier 2006-11-09 19:53:14 CST
Created attachment 622 [details]
Patch illustrating how I was able to get the test working
Comment 11 Johnny Willemsen 2006-11-10 02:33:46 CST
Phil, I was thinking about a change like this also, seems some work to get this
in tao_idl, would be some testing to see how this could go in the best way. The
other option would be to have some kind of user exception registry that could be
used by the exception holder.
Comment 12 Chad Elliott 2007-01-05 12:40:16 CST
The following attachment is a set of changes to TAO_IDL that correct this problem.
There are a couple of drawbacks to this change:

1) All S.cpp now include tao/Exception_Data.h and
tao/Messaging/ExceptionHolder_i.h if AMI is enabled even if no method throws an
exception.
2) All _excep methods in the C.cpp now have the same exception list as the
corresponding non _excep method.
Comment 13 Chad Elliott 2007-01-05 12:40:50 CST
Created attachment 645 [details]
TAO_IDL patch to correct this bug
Comment 14 Johnny Willemsen 2007-01-05 12:45:18 CST
Chad, what if the user has a method ending with _excep and is not using AMI,
what happens then? 
Comment 15 Chad Elliott 2007-01-08 08:21:58 CST
Good catch.  That would definitely cause problems.  I'll rework this.
Comment 16 Johnny Willemsen 2007-01-08 08:36:10 CST
Chad, any possibility to get an updated patch soon, would really like to see
this fixed in the upcoming x.5.5, it is a bug that is outstanding for some time
now and fixing this one will at least get the test stats a little bit higher again
Comment 17 Chad Elliott 2007-01-08 10:09:46 CST
I reworked the patch and included an additional idl file in the IDL_Test. 
Coincidentally, I fixed a problem with naming a struct "ExceptionHolder".
Comment 18 Chad Elliott 2007-01-08 10:10:43 CST
Created attachment 647 [details]
A revision of my previous patch
Comment 19 Johnny Willemsen 2007-01-08 13:12:33 CST
looks good, lot of diffs in the generated file, hopefully that doesn't have side
effects
Comment 20 Chad Elliott 2007-01-09 07:23:06 CST
After some more testing, I'm going to revert my change to keywords.dat and
fe_lookup.cpp.  I will also need to change my test idl file.

The ExceptionHolder change causes problems with the Messaging.pidl file.
Comment 21 Chad Elliott 2007-01-10 12:53:16 CST
Changes have been checked in.

Tue Jan  9 19:56:41 UTC 2007  Chad Elliott  <elliott_c@ociweb.com>

        * TAO_IDL/be/be_codegen.cpp:
        * TAO_IDL/be/be_visitor_ami_pre_proc.cpp:
        * TAO_IDL/be/be_visitor_operation/upcall_command_ss.cpp:
        * tao/Messaging/ExceptionHolder_i.h:
        * tao/Messaging/ExceptionHolder_i.cpp:

          Modified the tao_idl code to emit code to set the exception data
          in the Messaging::ExceptionHolder in the AMI _excep operation.  
          This has the effect of allowing supporting code to raise the    
          correct user defined exception.  Previously, the user defined   
          exception would not be recognized and a CORBA::UNKNOWN would be 
          raised in it's place.  This fixes bug 2350.

        * tests/IDL_Test/Bug_2350_Regression.idl:
        * tests/IDL_Test/IDL_Test.mpc:

          Added an idl file to ensure that the code to fix bug 2350 does
          not incorrectly recognize user methods that end in _excep, that
          take a single parameter ending in ExceptionHolder and raises a 
          user defined exception.