Homework 1 forum

Problem with test Topo5_10Nodes

 
Picture of Francesco Intoci
Problem with test Topo5_10Nodes
by Francesco Intoci - Tuesday, 27 October 2020, 12:59
 

Hello,

When I run this test I always get "Expected node X to have received Msg n from Y" (it varies every run). I studied a bit the test and noted that in order to see the packets received by a node the test uses the callback function of the node. So I added debug prints to check whether or not the missing message is being processed by calling correctly the callback, and that's the case for me. If for example I get "Node J is missing message 2 from E", I will see in my logs "J processing msg 2 from E" and "J processed msg 2 from E" ,before and after calling g.Callback with the rumor message. I also added a mutex to manage concurrent calls of the callback, suspecting this was a form of race condition.

Any ideas on the possible problem?

Regards!

Picture of Pasindu Nivanthaka Tennage
Re: Problem with test Topo5_10Nodes
by Pasindu Nivanthaka Tennage - Tuesday, 27 October 2020, 13:18
 

Dear Intoci ,

I am a little bit surprised about this behavior. 

If I understood it correctly, you check (using prints) before and after the callback. To dive more, did you check what happens in the receiving side (the entity which receives the callback)?

Regards

 

Picture of Francesco Intoci
Re: Problem with test Topo5_10Nodes
by Francesco Intoci - Tuesday, 27 October 2020, 13:29
 

Hello,

Thanks for the reply. You indeed have understood correctly: I print so that I am sure I am calling the callback. Talking about the entity, I am not sure I have understood what you mean. Do you mean that I should put some prints inside the test?

Picture of Francesco Intoci
Re: Problem with test Topo5_10Nodes
by Francesco Intoci - Tuesday, 27 October 2020, 14:04
 

Hello again,

I don't know if I have understood your suggestion correctly, but I have put a print inside the function that is registered as callback in the streamIncomingGossips function (so before sending the gossip packet the node passed as parameter to the callback, in the channel). Then I have put another print in the go routine that is called for every node, to set the flag inside the result map of the node, at the entry of the message received, to true. Basically sometimes it happens that: the callback is called, the message is sent into the channel, but the go routine in the test does not receive the message. It's a very odd behaviour that manifests itself when there is a lot of traffic. The only possible reason for not printing would be to receive a gossip with field rumor == nil.

I have investigate that and I found something very odd.

For example I am getting "node J missing msg 0 from E". In the logs the following is stated:

- J calls callback with msg 0 from E

- message 0 from E is sent to the channel

-message 0 from E is never received. The channel does not even contain a packet with rumor == nil (I put a print before checking if rumor is nil).