Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Make TCPNeighbor send() synchronized to prevent queue overflows #940
The sendQueue which is used in #TCPNeighbor.send() is a ArrayBlockingQueue with a capacity of 10. I think this method needs a lock so that the poll() and add() are done synchronized (to prevent queue full exceptions), since three threads are calling this send method:
Although #Node.sendPacket() also contains a lock, the spawnTipRequesterThread does not provide such a mechanism. This can also explain that sometimes intermediate milestones are skipped (because of these dropouts).
It also might be useful to increase the size of this queue, so when people are syncing not too many are dropped.
Type of change
How Has This Been Tested?
Please delete items that are not relevant.
ok i set the capacity back to 10 and added some log statements to see how this queue behaves.
i guess it can start dropping msgs if you have more tcp neighbors and when you startup with a more out-of-sync node.
@grittibaenz (he has 5 tcp neighbors) will test this patch as well and report on the findings.
@gjeee asked me to run IRI 1.5.3 + 940.patch. I left the node running for 20 minutes. It produced
I have 8 neighbors, 5 with TCP and 3 UDP. Please let me know if you need more details.