Closed joey-coleman closed 10 years ago
Obvious question: any chance you can provide a minimal example?
Below; running Version: 0.3.3-SNAPSHOT Build date: 2014 Jul 03 15:24 CEST Git commit description: Dev/0.3.3-117-g1931a74
The call to an operation in process INT does not update the state.
The call to the same operation in process INT2 does.
channels
debug : nat * nat
process simple = id : nat @ begin
state
s : nat := 0
operations
add: nat ==> ()
add(n) == s:= s+n
actions
P = debug!id!s -> add(3);debug!id!s -> Skip
@ P
end
process INT = ||| i in set {1} @ simple(i)
process INT2 = simple(1) -- ||| simple(2) ||| simple(3)
sorry - trying to submit; still very much open!
The general issue here is that:
process INT = ||| i in set {1} @ op(i)
generates a context for op as:
ctxt (delayed write) [i=1]
but since this is a replication of 1 then there is not replicated node to handle the "replication" and thus no where to terminate it e.g. writing the changes.
A solution that seems to work is to only use delayed contexts when there is more than one in a replication. If the replication is done only once then there for e.g. [] is no need for a roll back.
Changing the context to be a plain context as:
ctxt [i=1]
seems to do the job. It makes any change that happens to state visible immediately. (this of cause only affects the current construct. If nested then the assignment might still be nested from its parent
||| i in set {1,2,...} @ ||| j in set {1}@ var:=op(i,j)
Quick question: what are delayed/plain contexts? Is this something that we need to sort out in the model, or an interpreter bug?
Also, the issue appears irrespective of the cardinality of the replication set. So for example:
process INT = ||| i in set {1,2,3} @ op(i)
also has the same issue.
No, this is internal; that was mostly a comment between Kenneth and I, as we try to untangle the problem in the code.
Ah -- thanks Joey -- it had me baffled ;-)
Still broken in aca6238 — this may be a regression at this point.
This is indeed a regression from fixing something else (related, but not directly connected).
I should also note that the expected behaviour here is only correct because the interleaving operator is used in a process context rather than an action context. If it were in an action context, you would have to give namesets (and you wouldn't be able to use replication, because we don't have indexed namesets).
This will appear in development build 81 on the buildserver; it's pending as I post this.
[Submitting for @JeremyBryans, who wasn't able to submit for some reason]
I think I’ve got a case where the operation isn’t updating the state as it should, but I may be wrong.
I have different behaviour from two processes,
Election
andElection2
. The traces from each are below, as is the CML source.From the debug traces, the difference is whether or not the variable
myCS
is updated. (This variable is debugged on the channelDebugClaim.i.j.claim
, wherei
is the node id, &j
is a marker for the position within processUndecided
where the debug is taking place. )myCS
is updated by the operationchangeClaim(newc)
, which is called between position 1 and position 2 in the traces below.myCS
is updated only inElection2
.If I make the change directly as an assignment within the process things behave as I'd expect.
The top level definitions:
Trace from Election:
Trace from Election2:
The CML source is below.