Veil-Project / veil

Veil-Project
MIT License
118 stars 91 forks source link

Bugfix: race condition of two threads using same RandomX VM #1021

Closed us77ipis closed 1 year ago

us77ipis commented 1 year ago

Race condition between https://github.com/Veil-Project/veil/blob/4107c99a2029a07f89ad0b1e0f68c03ec55b7350/src/pow.cpp#L462 and https://github.com/Veil-Project/veil/blob/4107c99a2029a07f89ad0b1e0f68c03ec55b7350/src/chain.cpp#L304 which use the same RandomX VM but the first one correctly acquires the lock cs_randomx_validator before, while the second doesn't acquire the lock.

This bug caused the daemon / wallet to randomly crash.

seanPhill commented 1 year ago

I have been running this for some weeks, but haven't done a lot of RandomX mining. I am stepping up this mining on testnet.

seanPhill commented 1 year ago

I ran this on testnet and mined a lot of RandomX without any problems. Debug log entries look fine.