Advertisement
Guest User

Dash 0.11.2.22

a guest
Aug 12th, 2015
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.28 KB | None | 0 0
  1. https://bitcointalk.org/index.php?topic=421615.msg12126233#msg12126233
  2. by old c coder
  3.  
  4. Hello,
  5.  
  6. I'm built dash 0.11.2.22 daemon on Windows in MSVS Express, so that I could full screen debug it! Yeah, I did the videos on building the static libraries for all *coins, see https://www.youtube.com/channel/UCytoaHvG3H1y9CnxZS819eQ.
  7.  
  8. When I succeeded, the daemon would crash erratically or sometimes popup a Windows "needs to close" message and the program would keep running! One of the network threads bombed.
  9.  
  10. Interestingly, I caught it in the full screen debugger. The boost FOREACH() was 'error-ing' (!) or a vector exception, always on the CMasternodeMan class private member, the vector vMasternodes.
  11.  
  12. In masternodeman.cpp, the vector was changing while the various class methods were FOREACH-ing the vector! I kept adding LOCK(cs); to all those methods that didn't have it already, and when I added the last one, it stopped "exception-ing"!
  13.  
  14. I actually put "assert-ish" code like this:
  15. int CMasternodeMan::CountMasternodesAboveProtocol(int protocolVersion)
  16. {
  17. int
  18. nSize = (int)vMasternodes.size(),
  19. i = 0;
  20.  
  21. {
  22. LOCK(cs);
  23.  
  24. BOOST_FOREACH(CMasternode& mn, vMasternodes)
  25. {
  26. bool
  27. fTest = ((int)vMasternodes.size() == nSize);
  28. #ifdef _MSC_VER
  29. #ifdef _DEBUG
  30. assert(fTest);
  31. #else
  32. if( !fTest )
  33. releaseModeAssertionfailure( __FILE__, __LINE__, __PRETTY_FUNCTION__ );
  34. #endif
  35. #endif
  36. mn.Check();
  37. ...
  38. just to see, and sure enough one of them "tripped".
  39.  
  40. And in
  41. void CMasternodeMan::Remove(CTxIn vin)
  42. {
  43. LOCK(cs);
  44.  
  45. vector<CMasternode>::iterator it = vMasternodes.begin();
  46. while(it != vMasternodes.end())
  47. {
  48. if((*it).vin == vin)
  49. {
  50. if(fDebug)
  51. LogPrintf(
  52. "CMasternodeMan: Removing Masternode %s - %i now\n",
  53. (*it).addr.ToString().c_str(), size() - 1
  54. );
  55. vMasternodes.erase(it);
  56. break;
  57. }
  58. ++it; // don't we need this???
  59. }
  60. }
  61. I added that final ++it;. It just seemed appropriate!? Roll Eyes Don't know if it's correct or not Huh
  62.  
  63. Seems to run OK now...
  64.  
  65. Ron
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement