Closed emil14 closed 8 months ago
Actually it wasn't
// warning: it's not clear whether it's safe to move on before all receivers processed
I think this might be the reason why this example sometimes terminates before we print 2
- because 2 reaches receiver before 1, cuz we have 2 goroutines concurrent to each-other.
component Main(start) (stop) {
nodes {
Mod
Range
Match<int>
Unwrap<int>
Printer<any>
Blocker<int>
}
net {
:start -> (
1 -> range:from,
3 -> range:to
)
range:data -> unwrap:data
unwrap:some -> [mod:data, blocker:data]
15 -> mod:case[0]
3 -> mod:case[1]
5 -> mod:case[2]
mod:then[0] -> printer:data
mod:then[1] -> printer:data
mod:then[2] -> printer:data
mod:else -> printer:data
printer:sig -> blocker:sig
blocker:data -> match:data
2 -> match:case[0]
match:then[0] -> :stop
}
}
virtual_emitter_5/out:msg[0] -> mod/in:case[2] 5
virtual_emitter_2/out:msg[0] -> virtual_blocker_2/in:data[0] 3
in:start[0] -> [ virtual_blocker_1/in:sig[0], virtual_blocker_2/in:sig[0] ] <empty>
virtual_emitter_6/out:msg[0] -> match/in:case[0] 2
virtual_emitter_1/out:msg[0] -> virtual_blocker_1/in:data[0] 1
virtual_emitter_3/out:msg[0] -> mod/in:case[0] 15
virtual_emitter_1/out:msg[0] -> virtual_blocker_1/in:data[0] 1
virtual_emitter_4/out:msg[0] -> mod/in:case[1] 3
virtual_blocker_1/out:data[0] -> range/in:from[0] 1
virtual_emitter_2/out:msg[0] -> virtual_blocker_2/in:data[0] 3
virtual_blocker_2/out:data[0] -> range/in:to[0] 3
range/out:data[0] -> unwrap/in:data[0] 1
range/out:data[0] -> unwrap/in:data[0] 2
range/out:data[0] -> unwrap/in:data[0] <nil>
unwrap/out:some[0] -> [ mod/in:data[0], blocker/in:data[0] ] 1
unwrap/out:some[0] -> [ mod/in:data[0], blocker/in:data[0] ] 2
virtual_emitter_3/out:msg[0] -> mod/in:case[0] 15
unwrap/out:none[0] -> __destructor__/in:msg[0] map[]
virtual_emitter_4/out:msg[0] -> mod/in:case[1] 3
virtual_emitter_5/out:msg[0] -> mod/in:case[2] 5
mod/out:else[0] -> printer/in:data[0] 1
1
printer/out:sig[0] -> blocker/in:sig[0] 1
virtual_emitter_3/out:msg[0] -> mod/in:case[0] 15
blocker/out:data[0] -> match/in:data[0] 2
virtual_emitter_6/out:msg[0] -> match/in:case[0] 2
virtual_emitter_4/out:msg[0] -> mod/in:case[1] 3
match/out:then[0] -> out:stop[0] 2
Fixed in https://github.com/nevalang/neva/pull/525
But the new (old) issue is https://github.com/nevalang/neva/issues/529
Weird behaviour in connector causes freeze in 99 bottles example.
As we can see from this log from connector's
distribute
function, we send first msg 99 to looper/virtual_blocker_20/in:sig[0], then to looper/fprinter1/in:args[0]But when second msg 98 arrives we send it to
looper/fprinter1/in:args[0]
only. Where is the other receiverlooper/virtual_blocker_20/in:sig[0]
? Why it's replaced with anotherlooper/fprinter1/in:args[0]
?Probably this causes endless loop, we try to send to first receiver, it's busy (because it needs signal first), we go to next one and... that's actually the same receiver! Which is... well... still busy.