[e-lang] Lamport slots with PBC (please ignore duplicate msg if exists)
Martin_Scheffler
martinscheffler at googlemail.com
Tue Feb 6 09:47:36 CST 2007
Mark S. Miller wrote:
>
> I just SVN committed what I think is a correct fix for this bug. Your
> src/esrc/de/flowdev/testObj.e now seems to run correctly. Please see if
> this
> allows you to get LamportSlot Unums working without this hack. If it looks
> good to you, I'll close out the bug and release 0.9.1c with this fix.
> Thanks!
>
Yes, it works! I feel cleaner already :) Thanks!
Mark S. Miller wrote:
>
> I think you should do it the other way around.
>
I agree, this way round is nicer. My new readOnly() function:
to readOnly() :Slot {
def lamportReporterPBC extends lamportReporter implements pbc{
to __optUncall() :any {
return [makeLamportSlot, "localShadow", [lamportReporter.get(),
lamportReporter]]
}
}
lamportReporterPBC
}
Mark S. Miller wrote:
>
>> When I pass PBC objects between VATs, the __optUncall function is
>> executed
>> twice or more, and on the other side the constructor is called twice or
>> more, too.
>>(...)
>
> I suspect this is because whenUpdated/2 eventual-sends the lamportReporter
> as
> an argument of an inter-vat reactToUpdate/3 message. Now that you've made
> lamportReporter pbc, passing it as a parameter over captp does more work
> than
> it should. In fact, I'm surprised it didn't cause an infinite regress.
> Within
> your current code, the fix would be to pass npbc instead. If you do
> pbc-ness
> the other way around, the required changes would be elsewhere.
>
Actually I passed it npbc, I just forgot to mention that.
This bug affects me more than I thought, when I pass a slot by pbc, there
are now 2-3 reactors attached to that slot. This slows down my app quite a
lot.
Sorry for the giant test case, I don't know how to analyze this better.
5 parts:
server.e - creates a sturdy ref to an object that returns a pbc object,
saves cap-url to file
client.e - loads cap-url, opens connection to server, fetches pbc object
makeTestEPBC.emaker - plain pbc object
output server.e - traces calls to __optUncall. Gets called 3 times.
output client.e - ditto for the maker
# ------------------------------- server.e -------------------------------
def makeURIFromObject(obj) :String {
# This implementation assumes a non-persistent single incarnation
def [sr, _, _] := identityMgr.makeKnown(obj)
def bracketed := introducer.sturdyToURI(sr)
if (bracketed =~ `<@uri>`) {return uri}
return bracketed
}
def pbcthing:=<import:de.flowdev.emonkey.makeTestEPBC>()
def connector {
to connect() :any{return pbcthing}
}
introducer.onTheAir()
def [sturdyObj, _, _] :=identityMgr.makeKnown(connector)
def connectorReceiver := makeSturdyRef.temp(sturdyObj)
def uri := introducer.sturdyToURI(sturdyObj)
<file:mycap.txt>.setText(uri)
println(`server.e: listening on $uri`)
interp.blockAtTop()
#---------------------------- client.e -------------------------
def getObjectFromURI(uri) :any {
return introducer.sturdyFromURI(uri).getRcvr()
}
introducer.onTheAir()
def uri := <file:mycap.txt>.getText()
println("Client.e: Connecting to "+uri)
def connectorRcvr := getObjectFromURI(uri)
when(connectorRcvr) -> {
def pbcthingy:=connectorRcvr<-connect()
when(pbcthingy) -> {
println(`Client.e: Connected to $pbcthingy`)
} catch err {
println(`Client.e: Could not connect to server: $err`)
}
}
interp.blockAtTop()
# ----------------------- makeTestEPBC.emaker ---------------------------
def makeTestEPBC implements pbc {
to run() :any {
traceln("Constructing TestPBC")
def testEPBC implements pbc {
to __optUncall() :any {
traceln("__optUncall testEPBC")
return [ makeTestEPBC, "run", [] ]
}
}
return testEPBC
}
to __optUncall() :any {
traceln("__optUncall makeTestEPBC")
return [<import>, "get", ["de.flowdev.emonkey.makeTestEPBC"]]
}
}
# -------------------------- output server.e ----------------------------
? rune(["c:\\e\\server.e"])
# value: <Promise>
? ["3DES_SDH_M2", "3DES_SDH_M"]
=== 2007-02-04T19:42:16.265Z (Traceln.traceit:Traceln.java:89) WRN
de.flowdev.emonkey.makeTestEPBC:
> Constructing TestPBC
: (traceln)
@ Traceln#run(String)
@ run/1:
<file:/C:/Dokumente%20und%20Einstellungen/martin/Desktop/workspace/emo
nkey/de/flowdev/emonkey/makeTestEPBC.emaker#:span::3:10::3:10>
server.e: listening on
captp://*ahqyjwzdkrpeh3uyifrpy6zczv5sz43r@192.168.178.23:
1301/tljdhjd6g6fuu4g4jaztwgafhx6az6bl
=== 2007-02-04T19:42:50.625Z (Traceln.traceit:Traceln.java:89) WRN
de.flowdev.emonkey.makeTestEPBC:
> __optUncall testEPBC
: (traceln)
@ Traceln#run(String)
@ run/1:
<file:/C:/Dokumente%20und%20Einstellungen/martin/Desktop/workspace/emo
nkey/de/flowdev/emonkey/makeTestEPBC.emaker#:span::6:15::6:15>
=== 2007-02-04T19:42:50.640Z (Traceln.traceit:Traceln.java:89) WRN
de.flowdev.emonkey.makeTestEPBC:
> __optUncall makeTestEPBC
: (traceln)
@ Traceln#run(String)
@ run/1:
<file:/C:/Dokumente%20und%20Einstellungen/martin/Desktop/workspace/emo
nkey/de/flowdev/emonkey/makeTestEPBC.emaker#:span::15:11::15:11>
=== 2007-02-04T19:42:50.640Z (Traceln.traceit:Traceln.java:89) WRN
de.flowdev.emonkey.makeTestEPBC:
> __optUncall testEPBC
: (traceln)
@ Traceln#run(String)
@ run/1:
<file:/C:/Dokumente%20und%20Einstellungen/martin/Desktop/workspace/emo
nkey/de/flowdev/emonkey/makeTestEPBC.emaker#:span::6:15::6:15>
=== 2007-02-04T19:42:50.640Z (Traceln.traceit:Traceln.java:89) WRN
de.flowdev.emonkey.makeTestEPBC:
> __optUncall makeTestEPBC
: (traceln)
@ Traceln#run(String)
@ run/1:
<file:/C:/Dokumente%20und%20Einstellungen/martin/Desktop/workspace/emo
nkey/de/flowdev/emonkey/makeTestEPBC.emaker#:span::15:11::15:11>
=== 2007-02-04T19:42:50.703Z (Traceln.traceit:Traceln.java:89) WRN
de.flowdev.emonkey.makeTestEPBC:
> __optUncall testEPBC
: (traceln)
@ Traceln#run(String)
@ run/1:
<file:/C:/Dokumente%20und%20Einstellungen/martin/Desktop/workspace/emo
nkey/de/flowdev/emonkey/makeTestEPBC.emaker#:span::6:15::6:15>
=== 2007-02-04T19:42:50.703Z (Traceln.traceit:Traceln.java:89) WRN
de.flowdev.emonkey.makeTestEPBC:
> __optUncall makeTestEPBC
: (traceln)
@ Traceln#run(String)
@ run/1:
<file:/C:/Dokumente%20und%20Einstellungen/martin/Desktop/workspace/emo
nkey/de/flowdev/emonkey/makeTestEPBC.emaker#:span::15:11::15:11>
# ---------------------------- output client.e
-----------------------------------
? rune(["c:\\e\\client.e"])
# value: <Promise>
? Client.e: Connecting to
captp://*ahqyjwzdkrpeh3uyifrpy6zczv5sz43r@192.168.178.
23:1301/tljdhjd6g6fuu4g4jaztwgafhx6az6bl
Importer getting de.flowdev.emonkey.makeTestEPBC
=== 2007-02-04T19:42:50.656Z (Traceln.traceit:Traceln.java:89) WRN
de.flowdev.emonkey.makeTestEPBC:
> Constructing TestPBC
: (traceln)
@ Traceln#run(String)
@ run/1:
<file:/C:/Dokumente%20und%20Einstellungen/martin/Desktop/workspace/emo
nkey/de/flowdev/emonkey/makeTestEPBC.emaker#:span::3:10::3:10>
Importer getting de.flowdev.emonkey.makeTestEPBC
=== 2007-02-04T19:42:50.718Z (Traceln.traceit:Traceln.java:89) WRN
de.flowdev.emonkey.makeTestEPBC:
> Constructing TestPBC
: (traceln)
@ Traceln#run(String)
@ run/1:
<file:/C:/Dokumente%20und%20Einstellungen/martin/Desktop/workspace/emo
nkey/de/flowdev/emonkey/makeTestEPBC.emaker#:span::3:10::3:10>
Importer getting de.flowdev.emonkey.makeTestEPBC
=== 2007-02-04T19:42:50.734Z (Traceln.traceit:Traceln.java:89) WRN
de.flowdev.emonkey.makeTestEPBC:
> Constructing TestPBC
: (traceln)
@ Traceln#run(String)
@ run/1:
<file:/C:/Dokumente%20und%20Einstellungen/martin/Desktop/workspace/emo
nkey/de/flowdev/emonkey/makeTestEPBC.emaker#:span::3:10::3:10>
Client.e: Connected to <testEPBC>
--
View this message in context: http://www.nabble.com/Lamport-slots-with-PBC-tf3157110.html#a8828306
Sent from the E Lang mailing list archive at Nabble.com.
More information about the e-lang
mailing list