Homework 2 forum

TestGossiper download parallel multiple

 
Avatar Samuel Jean Michel Jacquier
TestGossiper download parallel multiple
par Samuel Jean Michel Jacquier, dimanche, 15 novembre 2020, 10:55
 
Hey everyone,

I have a strange bug since the begining of my tests, that I wanted to carry alone but it stays unresolved and I really don't understand what it means.

While the test for IndexShares passes, TestGossiper-Download-Parallel-Multiple has an issue for the file of peer B. The Chunk 0 is requested by A, B sends it to A without any issue (B Marshal the packet and send it via its UDP Port, like any other packet sent in the project). But when the packet arrives at A, I can't unmarshal it. It says :
unexpected end of JSON input
Did anyone experienced this error, and have a hint of how it can be resolved ? I know we should not ask for debugging here but since I can transfer large files locally, and as the test for IndexShare passes, I wonder if it is not a specificity of the test case that anyone can explain.

Thanks a lot !
profile
Re: TestGossiper download parallel multiple
par Kirill Nikitin, dimanche, 15 novembre 2020, 11:32
 

Hi,

My guess is that the buffer that you initialize for reading from a UDP socket is too small (i.e., something like buf = make([]byte, X)). X has to be bigger than the default chunk size + other headers. Otherwise, your gossiper reads only a part of a data reply gossip packet and hence it ends up with an incorrect json encoding (since the end is missing).

Does it help?

Kirill

Avatar Samuel Jean Michel Jacquier
Re: TestGossiper download parallel multiple
par Samuel Jean Michel Jacquier, dimanche, 15 novembre 2020, 11:49
 

Oh, yeah, the size of the buffer was 2048 bytes. I raised it to 16384 so it should be enough now.

I will test it later, thanks a lot !