fix data race in bft deliverer#5464
Conversation
|
@pfi79 Can you share the race detector output? |
There is a "data race", but it is not detected by the detector. |
|
@pfi79 Yes, very well! We are dealing with a similar issue in fabric-x, I'll keep an eye on what is going on here. In fabric-x the race detector in unit tests complains some time. Not sure if it is a test flake or a production code issue, though. I assume test flake. |
Signed-off-by: Fedor Partanskiy <fredprtnsk@gmail.com>
Figured it out. I added a description above |
The logs in the test
TestBFTDeliverer_CensorshipMonitorEvents/repeated censorship events, with exponential backoffshow that theFetchBlocksfunction can be run simultaneously in 2 instances (see marked * - entrance and exit).This results in several fields of the
BFTDelivererstructure (fetchErrorsCandblockReceiver) being compromised.Solution:
fetchErrorsCchannel to FetchBlocksblockReceiver.Stop()testing.Tis not output immediately, but accumulates and is output at the end of the test. Consequently, the logs output by different packages are spread out over the output out of time.