> On Dec 17, 2022, at 1:46 PM, Kenton Varda <ken...@cloudflare.com> wrote:
> 
> To clarify, when I say "Carol lives in Vat A, i.e. next to Alice", I am 
> saying that Alice and Carol are two objects living in the same process. So a 
> capability pointing to Carol was passed across the network and then back 
> again, over the same connection. 

Thanks. I then spent some time trying to figure out why this scenario occurs — 
when the local peer received the capability Carol from the remote one, 
shouldn’t it have been marked in the protocol as being a peer exported by the 
recipient?

I think this can happen as follows; is this correct?

0. I’ve already sent the capability Carol to the remote peer earlier in the 
connection, so the peer has a reference to Carol.
1. I send an RPC call to acquire a remote capability, and allocate a (negative) 
remote capability # to it. Call it X. (I think this is what the protocol calls 
a promise?)
2. Before the response arrives, I pipeline some more RPC calls addressed to X.
3. I get a response to the first RPC call, identifying X as my capability Carol.

At this point I can remap X to point to Carol, but I’ve already got some 
messages in flight addressed to remote capability X. I assume what happens to 
these is the peer just sends them back to me, substituting Carol for X, and 
then forwards my reply back to me? Thus the problem that I might send local 
messages to Carol that would arrive before the echoed messages to X even though 
I sent them later.

A different architectural solution to this problem might be for a peer to 
reject an incoming request addressed to a capability that isn’t local. Instead 
it would return an error indicating “X isn’t mine, it’s your Carol, so forward 
it there”.

But either way, isn’t there still a race condition if, in a new step 2.5, I 
send a message to local Carol? This message was sent after the message to X but 
arrives before I discover X is Carol, so it’s received out of order.

—Jens

-- 
You received this message because you are subscribed to the Google Groups 
"Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to capnproto+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/capnproto/CAD166FA-FF9E-4496-B127-2F226C58307C%40mooseyard.com.

Reply via email to