[omniORB] Please help me - omniORB ERROR - -- an invalid buff er to pointer is passed you freebuf of string or object sequence

Alfonso Tames alfonso@tames.com
Tue Feb 25 00:04:02 2003


Pedro,

I've made a server that accepts client object references to make
callbacks.

As far as I understand, you have to duplicate the object reference so
when it gets released by the ORB your method invocations do not step in
released memory.

This works for me:

idl:
interface monitorClient {
...
}
interface monitorServer {
   void registerClient(in monitorClient mc);
};

----------------- Client ---------------------
* You first obtain a ptr for your client

// monitorClient_i is your class implementation
// of monitorClient

monitorClient_i *monit = new monitorClient_i(); 
monitorClient_ptr monptr;
monptr = monit->_this;
monit->_remove_ref();

* And then the client registers itself with the server:

// suppose you have already narrowed a server reference
// to serv.

serv->registerClient(monitorClient::_duplicate(monptr);

------------------ Server ------------------------


void registerClient(monitorClient_ptr mc) {

monitorClient_var client;
client = monitorClient::_duplicate(mc);
string ior;
ior = orb->object_to_string(mc);
cout << "Client registered: " << ior << endl;
// do not try to make this: mc->someMethod()
// until you are sure your client has reached
// orb->run();
}


Make sure your SERVER DOES NOT invoke any method on the client until you
are sure your client has reached the orb->run() statement.

Hope this helps.

Alfonso Tamés





On Mon, 2003-02-24 at 13:56, Pedro Machado wrote:
> The reference is the returned of one method, or either, the customer invokes
> a method of one object, and receives the reference of another object.  The
> reference of object is the same in the server and in the customer, and the
> customer can invoke the methods of this object.  However, when he finishes
> this invocation occurs the error.
> 
> To perceive better:
> 
> The customer invoke the following method:
> 
> Tp_ListServiceAnnounce[i].x_ref->createServiceManager(Tp_AppID,Tp_ListServic
> es[i].ServiceDescription.ServicePropertyList,Tp_ServInstID);
> 
> This function returns:
> structure TpSignatureAndServiceMgr{
> 	digitalSignature: TpOctetSet;
> 	serviceMgrInterface: IpServiceRef;
> };
> The problem is in the 'serviceMgrInterface'
> 
> The reference of the object in the server is:
> Service...
> IOR:010000001c00000049444c3a6f72672f63736170692f4970536572766963653a
> 312e3000010000000000000064000000010102000e00000031302e3131322e39362e
> 3232370074920e000000febf625a3e0000160c000000000400000200000000000000
> 080000000100000000545441010000001c0000000100000001000100010000000100
> 0105090101000100000009010100
> 
> After the invocation of the method, in the customer we have:
> IOR:010000001c00000049444c3a6f72672f63736170692f4970536572766963653a
> 312e3000010000000000000064000000010102000e00000031302e3131322e39362e
> 3232370074920e000000febf625a3e0000160c000000000400000200000000000000
> 080000000100000000545441010000001c0000000100000001000100010000000100
> 0105090101000100000009010100
> 
> Now, I go to try to acced to the methods of this object, and...
> omniORB: ERROR -- an invalid buffer pointer is passed to freebuf
>  of string or object sequence
> Segmentation fault
> 
> I dont understand!Can you help me?
> 
> 
> -----Original Message-----
> From: Alfonso Tames [mailto:alfonso@tames.com]
> Sent: segunda-feira, 24 de Fevereiro de 2003 19:21
> To: Pedro Machado
> Subject: Re: [omniORB] Please help me - omniORB ERROR - -- an invalid
> buffer to pointer is passed you freebuf of string or object sequence
> 
> 
> 
> Can you post some code showing when you return de Object Reference and
> how you receive that reference ?
> 
> 
> On Mon, 2003-02-24 at 11:19, Pedro Machado wrote:
> > Hi,
> > 
> > My name is Peter and I am using omniORB4.0 for the construction of a API
> of
> > mobility. I pass the IOR of one object as return of a function. The
> returned
> > IOR is the same, on the side of the customer and the server.
> > I can use the methods of this object, but in the end of this use the
> > following error occurs:
> > "omniORB:  ERROR -- an invalid buffer to pointer is passed you freebuf of
> > string or object sequence"
> > 
> > If someone can help me, it will be great.
> > 
> > 
> > _______________________________________________
> > omniORB-list mailing list
> > omniORB-list@omniorb-support.com
> > http://www.omniorb-support.com/mailman/listinfo/omniorb-list
-- 
Alfonso Tames <alfonso@tames.com>
Mercadio