I am also having the same issue with 3b (3a was ok) where it seems like the messages are getting mixed up in transit. Seeing almost everything @james1 mentioned as well.
Iāve created my own message type just so that I donāt mix it with the incoming message accidentally:
type broadcastMsg struct {
Message int `json:"message,omitempty"`
Type string `json:"type"`
}
and I explicitly set msg.type="broadcast"
, yet somehow it arrives to other node as broadcast_ok
:
for _, neighbor := range neighbors {
err := n.Send(toNode, replicationMsg{Type:"broadcast", Message: value})
...
}
at the end the log sequence ends like:
STDERR:
And to STDERR:
2023/02/23 19:05:31 Received {c2 n3 {"type":"init","node_id":"n3","node_ids":["n0","n1","n2","n3","n4"],"msg_id":1}}
2023/02/23 19:05:31 Node n3 initialized
2023/02/23 19:05:31 Sent {"src":"n3","dest":"c2","body":{"in_reply_to":1,"type":"init_ok"}}
2023/02/23 19:05:31 Received {c8 n3 {"type":"topology","topology":{"n0":["n3","n1"],"n1":["n4","n2","n0"],"n2":["n1"],"n3":["n0","n4"],"n4":["n1","n3"]},"msg_id":1}}
2023/02/23 19:05:31 Sent {"src":"n3","dest":"c8","body":{"in_reply_to":1,"type":"topology_ok"}}
2023/02/23 19:05:31 Received {n0 n3 {"type":"broadcast"}}
2023/02/23 19:05:31 Sent {"src":"n3","dest":"n0","body":{"in_reply_to":0,"type":"broadcast_ok"}}
2023/02/23 19:05:31 Sent {"src":"n3","dest":"n4","body":{"type":"broadcast"}}
2023/02/23 19:05:31 Sent {"src":"n3","dest":"n0","body":{"type":"broadcast"}}
2023/02/23 19:05:31 Received {n4 n3 {"in_reply_to":0,"type":"broadcast_ok"}}
2023/02/23 19:05:31 No handler for {"id":31,"src":"n4","dest":"n3","body":{"in_reply_to":0,"type":"broadcast_ok"}}
note that it ends with not finding a handler for "body":{"in_reply_to":0,"type":"broadcast_ok"}
.
Iām inclined to think somethingās wrong with the underlying maelstrom wrapper library or the round trip logic.