concord-bft icon indicating copy to clipboard operation
concord-bft copied to clipboard

Fix data race on ClientsInfo's requestsInfo and repliesInfo maps.

Open HristoStaykov opened this issue 3 years ago • 1 comments

We need to sync access to those maps, because they get modified/queried by multiple threads. We introduce 2 mutexes that guard each and make sure we never hold them both at the same time for a given ClientInfo object.repliesInfo.

HristoStaykov avatar Jun 16 '21 18:06 HristoStaykov

We need to sync access to those maps, because they get modified/queried by multiple threads. We introduce 2 mutexes that guard each and make sure we never hold them both at the same time for a given ClientInfo object.repliesInfo

Thanks for spotting that!

Out of curiosity, which threads are accessing the clients manager concurrently? I had the same need and, if you remember, we introduced an internal message to only access it from the messaging thread. Can we use the same approach here as well, to avoid locks and reduce complexity?

dartdart26 avatar Aug 13 '21 18:08 dartdart26