Closed dnkolegov closed 2 years ago
The bug is reproduced when Mir runs in the rootnet and in a subnet on the same machine with 4 eudico full nodes. After my investigation, I found two things.
First, is that there is the case when a user can run the HC in the following setting: /root -> EC /root/A ->Mir /root/A/B ->Mir In this case, peer ID will be the same in both subnets, and a data race can happen.
The second is that I changed the key mutex to the traditional mutex and the bug disappeared. If I change Keymutex to github.com/im7mortal/kmutex then the bug is still reproduced. So despite the fact that keymutex
is suitable here, the race detector doesn't know about that semantics and will report a bug.
I would suggest using sync.Map or sync.RWMutex.
P.S. In the Mir reconfiguration draft I have implemented sync.Map.
@adlrocha what do you think?
I am suggesting this fix - https://github.com/filecoin-project/eudico/pull/234/commits/bdd2590ae5258ddd5fddef0f26734b4483a38aed#diff-100f0122618ed5b5f4e40838698391b594f842011d057c947a39e5cdf1ec92b2
@adlrocha what do you think?
Yes, I think this definitely fixes it. I completely missed that race. Good catch, thanks! Feel free to close this issue once the PR is merged.
Fixed in #234
Describe the Bug
Data race: read at
eudico/chain/consensus/hierarchical/subnet/submgr/exchange.go:62
ref and write ateudico/chain/consensus/hierarchical/subnet/submgr/exchange.go:69
refLogging Information
Repo Steps
No response