Open BurtonQin opened 3 years ago
Describe the bug https://github.com/mimblewimble/grin/blob/35740204a1b212131afea502b49af4632aec8913/p2p/src/protocol.rs#L260-L265 Perhaps we can use compare_exchange() to replace the separate load() and store() to avoid atomicity violation ( load() and store() interleaved by another store() from another thread).
compare_exchange()
load()
store()
To Reproduce Found it through static analysis.
Relevant Information None
Screenshots None
Desktop (please complete the following information):
Additional context None
Hi @BurtonQin thanks for the issue! Let us look into this but I think your suggestion makes a lot of sense.
Describe the bug https://github.com/mimblewimble/grin/blob/35740204a1b212131afea502b49af4632aec8913/p2p/src/protocol.rs#L260-L265 Perhaps we can use
compare_exchange()
to replace the separateload()
andstore()
to avoid atomicity violation (load()
andstore()
interleaved by anotherstore()
from another thread).To Reproduce Found it through static analysis.
Relevant Information None
Screenshots None
Desktop (please complete the following information):
Additional context None