-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm wondering whether we need these locks while trying to stake #183
Comments
In Qt, this sort of situation works fine without lockers/mutexes. I'm sure boost is the same. Not sure why that's there at all unless it also locks the db from being written? Alternatively, you could lock the db during write operations elsewhere, and then remove those locks and use a semaphore. In Qt this is expressed as semaphores and read/write mutexes but I'm sure boost has something similar yet completely differently worded. |
Removing those locks should be fine. It is only reading. There's also plenty of usage in the code that implements ReadTxIndex and ReadFromDisk without applying any locks. I'm compiling now will test if for the evening but the change looks good and should be good to push to master |
dooglus, Have you been running this live since this conversation? |
No, I took the locks out for a while, but I see they're back in place now. I don't know how long I tested without them since I didn't intentionally put them back in place. |
@dooglus, Update? |
In wallet.cpp, inside the loop that runs through all staking outputs looking for opportunities to stake a new block, we see:
The two LOCK2() calls are causing staking to hang up quite regularly, as the wallet is doing other things at the same time.
I am wondering whether we need to obtain locks before doing read-only operations on the wallet. I've tried commenting them both out, and things seem to be working fine (and staking no longer hangs for minutes at a time). But am I missing something? What's the worst that can happen if the txdb changes just as I'm trying to read it?
The text was updated successfully, but these errors were encountered: