hyperledger-labs / SmartBFT

Implementation of the SmartBFT consensus library (https://arxiv.org/abs/2107.06922)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use of reentrant lock in test framework

HagarMeir opened this issue · comments

When the node broadcasts a state transfer request the test framework takes a read lock to serve this message. Then it calls the handleMessage which in this case will send a state transfer response. In the test framework this calls send where the read lock is taken again. This is where we use the reentrant lock.
If we try to take a write lock in between the read locks then we get a deadlock. This scenario appears for example when we disconnect a node to create a partition in the test. The disconnect method takes a write lock.