Thread: [orbitcpp-list] passing a reference to another process
Status: Beta
Brought to you by:
philipd
From: <MHL...@t-...> - 2000-11-18 23:30:08
|
On Son, 19 Nov 2000 00:08:36 Martin Schulze wrote: Hi, I ran into some troubles implementing a signal-slot-technology with CORBA-objects: Given three processes pA, pB, pC. Is it possible to pass a reference retrieved in process pC from the IOR referring to an object in the address space of pB to process pA directly ? In details: Let's say I have interfaces iA, iAA, iB, iBB. class iA_impl contains a class iAA_impl (= oAA), class iB_impl contains a calss iBB_impl (= oBB). Now I have two processes running, pA and pB. pA has an iA_impl on the heap (= oA), pB an iB_impl (= oB). A third process pC is created, retrieving refences to oA and oB through their IORs. A function of iA is called, returning a reference to oAA and a function of iB gives a reference to oBB. Now a function of iAA is called, giving the REFERENCE to oBB AS its ARGUMENT. Another function of oAA is called. It implicitely calls a function of oBB - so process pA uses the reference of oBB that was retrieved in process pC. => A SEGFAULT in pA occurs in the function _orb_get_connection called by the skel of the very last function call mentioned obove. => Bug in orbit or my design error ??? In ASCII: ___________________________________________________________________ Process: pA pB pC ======= ======= ======= Heap: oA <----- oB <----- -oAA <-- | -oBB <-- | | | | | Refs: | | | --(IOR)-- rB | | --(rB->f())- rBB <-- | | | | -----------(IOR)--------- rA | -----------(rA->f1())------- rAA | | -rBB -------------(rA->f2(rBB))------------ (xx->fx(): function calls invoked in pC for retrieving the references) In pA: oA.rBB->callback() segfaults ! ______________________________________________________________________ Sorry for this being a little long! cu Martin. |
From: <MHL...@t-...> - 2000-11-20 17:27:33
|
Hi, I'm sorry to have bothered you that way! After a few hours' debugging session I found I made a silly mistake: I didn't _duplicate() the reference in pA (I thought everything would be fine duplicating it in pB, the prosess that holds the referred object) so it got freed at the end of the cpp-skeleton of the retrieving function and my reference got invalid. However a SEGFAULT in my opinion is a little overreacted; but this is not an orbitcpp- but an orbit-related topic. Cu, Martin. _______________________________________________________________________ On Son, 19 Nov 2000 00:31:21 Martin Schulze wrote: > > On Son, 19 Nov 2000 00:08:36 Martin Schulze wrote: > Hi, > > I ran into some troubles implementing a signal-slot-technology > with CORBA-objects: > > > Given three processes pA, pB, pC. > Is it possible to pass a reference retrieved in process pC from > the IOR referring to an object in the address space of pB > to process pA directly ? > > [snip] > |
From: Phil D. <ph...@us...> - 2000-11-22 11:10:41
|
Hi Martin, Glad you solved your problem - sorry about my reply arriving too late. I agree that it's unfortunate that this sort of mistake results in such a nebulus error - can you think of a way we could trap this in orbitcpp?. Cheers, Phil Martin Schulze writes: > Hi, > > I'm sorry to have bothered you that way! > After a few hours' debugging session I found I made a silly mistake: > > I didn't _duplicate() the reference in pA (I thought everything would > be fine duplicating it in pB, the prosess that holds the referred > object) so it got freed at the end of the cpp-skeleton of the retrieving > function and my reference got invalid. > However a SEGFAULT in my opinion is a little overreacted; but this is > not an orbitcpp- but an orbit-related topic. > > Cu, Martin. > |
From: Phil D. <ph...@us...> - 2000-11-22 11:02:27
|
Hi Martin, Sorry for the late reply - I've been a bit busy recently (and it took me a couple of reads to understand this mail ;-) Martin Schulze writes: > > Hi, > > I ran into some troubles implementing a signal-slot-technology > with CORBA-objects: > > > Given three processes pA, pB, pC. > Is it possible to pass a reference retrieved in process pC from > the IOR referring to an object in the address space of pB > to process pA directly ? > Yes, you can pass the object reference as an idl argument to a corba method. You must ensure that you call the relevant reference '_duplicate' function though. (This duplicates the object reference, not the corba object implementation) e.g. for function returning a reference to interface foo: return foo::_duplicate(myfooreference); > > > In details: > > Let's say I have interfaces iA, iAA, iB, iBB. > class iA_impl contains a class iAA_impl (= oAA), > class iB_impl contains a calss iBB_impl (= oBB). > > Now I have two processes running, pA and pB. > pA has an iA_impl on the heap (= oA), pB an iB_impl (= oB). > With you so far (I think). > A third process pC is created, retrieving refences to oA and oB > through their IORs. A function of iA is called, returning a > reference to oAA and a function of iB gives a reference to oBB. > Now a function of iAA is called, giving the REFERENCE to oBB > AS its ARGUMENT. Yep - sounds okay. (must do your _duplicates though). > > Another function of oAA is called. It implicitely calls a function > of oBB - so process pA uses the reference of oBB that was > retrieved in process pC. > > => A SEGFAULT in pA occurs in the function _orb_get_connection > called by the skel of the very last function call mentioned obove. > => Bug in orbit or my design error ??? > > Unlike EJB, CORBA doesn't have any rules govening callback functions (recursive calls etc), so this should all work AFAIK. It's a little difficult to see what the problem could be without code - could you send me a copy of your idl and impl C++ files? Cheers, Phil |