[omniORB] debugging proxy problem

Stefan Seefeld seefeld@sympatico.ca
Tue, 30 Jan 2001 15:56:04 -0500


Hello,

I'm trying to debug some code of mine, and since it appears
the problem is related to proxy request forwarding, I'd like
to ask for your feedback. The situation is this:

class TransformImpl : public virtual POA_Warsaw::Transform,
		      public virtual ServantBase
{
public:
  virtual void store_matrix(Warsaw::Transform::Matrix);
  Warsaw::Transform_ptr _this()
  {
    if (!_this_valid)
      {
	__this = POA_Warsaw::Transform::_this ();
	_this_valid = true;
      }
    return Warsaw::Transform::_duplicate (__this);
  }

//...
private:
  Warsaw::Transform_var __this;
};

The above is part of the TransformImpl class, which implements the Warsaw::Transform
interface. Since we need to access its '_this()' pointer quite a lot, we cache the proxy 
inside after the first request.

>From within another class, I'm calling the 'store_matrix' method, which writes
'this' to cerr, as a way to identify the servant on which the method is being called.

Here is some more code:

Lease_var<TransformImpl> cumulative(Provider<TransformImpl>::provide());
//...
Transform_var t_ptr = cumulative->_this();
Transform::Matrix newmat1;
t_ptr->store_matrix(newmat1);
Transform::Matrix newmat2;
cumulative->store_matrix(newmat2);

(Lease/Provider are helper templates that implement a smart allocator. Provider<T>
allocates Ts, and Lease_var takes care of returning it to the provider, just a smart pointer.
Provider takes care for activation...)

In the code snippet I call store_matrix twice, once over the proxy, once directly.
However, it appears that

a) the 'this' output generated by the store_matrix() method differs, i.e. the calls
   aren't done on the same servant

b) as a result of a), the actual matrices differ

I'm totally lost with this. Does anybody see a problem with the code ?

Using -ORBtraceLevel 10 I can see that the proxy is generated upon the first call
to cumulative->_this(), just what I would expect. However, the 't_ptr' in the
example above seems to point always to the same servant, no matter what 'cumulative'
is. In other words, from the two 'this' pointers that are written to cerr, the one
from 't_ptr->store_matrix(newmat1);' stays the same over the whole run, as if it was
a static variable.

Any help would be highly appreciated !

Best regards,	Stefan