Bug 2351

Summary: AMI calls between collocated client and server do not run asynchronously
Product: TAO Reporter: Alan Stokes <alan>
Component: AMIAssignee: Johnny Willemsen <jwillemsen>
Status: RESOLVED FIXED    
Severity: enhancement CC: hans.utz, n.metchev
Priority: P3    
Version: 1.5.7   
Hardware: x86   
OS: Windows XP   
Bug Depends on: 2805    
Bug Blocks:    

Description Alan Stokes 2006-01-06 08:37:14 CST
If a client uses AMI to make an asynchronous call to a collocated server, with
collocation optimisations enabled, the call is in fact made synchronously (ie
within the call to sendc_foo, the servant's foo method is called).

There are a number of issues with this:

1. It's Just Wrong. The semantics of AMI require asynchronous invocation, and
any optimisation for collocated objects isn't allowed to change that. The
handler function is not called as required.

2. It can't work, because the signatures of foo and sendc_foo are usually
different (sendc_foo always returns void and omits out parameters). In my
testing with a function returning long I saw stack corruption, because the long
result was written to the void retval of the sendc function.

3. Exceptions don't work either - if the server throws a user exception then it
is thrown directly from sendc_foo (which is forbidden by the spec) and the
_excep function is not invoked.

A test program to demonstrate this is fairly easy, but I don't currently have a
standalone one. I'll see if I can produce a stripped down test harness.

Note that disabling collocation (-ORBcollocation no) is not a full workaround
for this, since it breaks AMI exception handling - see bug 2350.
Comment 1 Nikolay 2006-01-09 09:08:47 CST
adding myself to the cc list
Comment 2 Nanbor Wang 2006-08-08 01:38:58 CDT
Changed component to AMI
Comment 3 Johnny Willemsen 2006-11-14 01:15:47 CST
Accept, this is valid. Calling the servant on another thread is at this moment
seen as an extension we don't support. For doing this the data has to be
marshalled/demarshalled but maybe we can reuse the CSD argument cloning
Comment 4 Johnny Willemsen 2007-01-09 07:37:24 CST
changing this to enhancement
Comment 5 Johnny Willemsen 2007-04-09 03:16:12 CDT
added depends on
Comment 6 Johnny Willemsen 2007-04-09 03:17:53 CDT
we would need something like -ORBAMICollocation yes|no that would indicate when
AMI is used whether collocation is allowed or not
Comment 7 Johnny Willemsen 2007-04-10 01:25:57 CDT
reassign
Comment 8 Johnny Willemsen 2007-04-10 14:13:20 CDT
updated version and accept
Comment 9 Johnny Willemsen 2007-04-10 14:13:52 CDT
added cc
Comment 10 Johnny Willemsen 2007-04-20 03:09:31 CDT
Fri Apr 20 08:05:12 UTC 2007 Johnny Willemsen  <jwillemsen@remedy.nl>


        * tao/ORB_Core.cpp:
        * tao/ORB_Core.h:
        * tao/params.cpp:
        * tao/params.h:
        * tao/params.inl:
          Added a new -ORBAMICollication which is default yes. If this is no,
          then when a collocated AMI invocation is made, the call is converted
          to a remote call so that another thread can handle the servant. Also
          the problems with argument corruption are then gone. This is for
          bugzilla 2351.
Comment 11 Johnny Willemsen 2007-05-09 09:13:05 CDT
this is fixed