ProcessMessage() in net.cpp calls "Misbehaving()", which requires the cs_main lock. However, the lock is not aquired in ProcessMessage.
Missing cs_main lock in ProcessMessage() #5678
issue johannes87 opened this issue on January 19, 2015-
johannes87 commented at 2:23 PM on January 19, 2015: none
-
laanwj commented at 3:12 PM on January 19, 2015: member
Good catch.
The most straightforward solution would be for the function to do the locking itself, e.g. add a LOCK(cs_main) at the top of that function.
- laanwj added the label P2P on Jan 19, 2015
-
johannes87 commented at 3:24 PM on January 19, 2015: none
On a side note: wouldn't it be better, performance-wise, to use a separate lock for the mapNodeState data structure, instead of using the global cs_main lock?
- laanwj added the label Bug on Jan 19, 2015
-
laanwj commented at 3:36 PM on January 19, 2015: member
Yes, more granular locking would help performance. The cs_main lock is heavily contended. But be careful not to introduce deadlocks. Which is easier if the locks are properly encapsulated inside data structures, which is the direction things should be moving anyhow.
-
johannes87 commented at 5:41 PM on January 22, 2015: none
It looks like the lock in "ProcessBlockAvailability()" is missing, too?
- fanquake closed this on Oct 10, 2016
- MarcoFalke locked this on Sep 8, 2021
Contributors