-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Use NonMMappedSPVBlockStore on windows. #2403
Use NonMMappedSPVBlockStore on windows. #2403
Conversation
@devinbileck Could you give this bug fix a test? |
@@ -0,0 +1,341 @@ | |||
/* | |||
* Copyright 2013 Google Inc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this Google copyright clause necessary at this point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The class is based on SPVBlockStore.java from bitcoinj that contains the copyright.
I was not sure what to do with it.
In any case, we expect to remove NonMMappedSPVBlockStore.java once we update to bitcoinj 0.15 in the next few months.
@freimair Could you review that? |
I verified this works on Windows 10! To confirm the issue, I tested on testnet without the fix and encountered the following error: With this fix, it worked and showed: However, the UI became unresponsive and had lots of errors in the log. Any ideas? I ended up killing the application. But upon restart my wallet balance was restored. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The contents of the PR seem fine to me.
As for the error log:
- at which line of the log does the application become unresponsive (approximately)?
- is there excessive CPU usage when the app is unresponsive?
As I commented on the PR upstream bitcoinj/bitcoinj#1695, stop using memory mapped files implies a performance degradation. Whether the performance degradation is tiny or huge is something that has to be found out during testing. This kind of testing may be hard and confusing, because the conclusions may not be definitive. It would be important to see if the unresponsive @devinbileck experienced is related to this PR or not. Maybe he or someone else can do another test and see if the UI becomes unresponsive again. |
About the exception seen on the @devinbileck log, I don't understand why it happened. Let's see what happens when it is tested again. |
@oscarguindzberg The performance degradation is experienced always or only at restore from seed words case? We should get some rough test to see what is the difference. Maybe one other option would be to use for the receover from seed words use case a different approach and not delete the wallet file but rename and manage the new name somehow (and or rename at next restart if possible)? |
@devinbileck Did you use a old wallet? If so what was the wallet date? If it is old it is expected that resync takes a lot of time and CPU. Can be a few hours if the wallet is very old and has lots of transactions. |
The errors could be caused because BitcoinJ takes all CPU and then network connections drop and causing errors. |
@devinbileck Could you try to run Bisq with an older wallet with that branch and see if you see any issues or performance degradation? Maybe regtest would work as well at least for a first test. So not testing the recovery use case buy just to see if there are any issues in standard use case. |
@ManfredKarrer Accessing the blockchain file is expected to be slower. The performance degradation should be experienced always, but we can expect it to be worse when the blockchain file is used a lot. During blockchain sync, the blockchain file is written a lot, so that could be an interesting point to look at for performance degradation. Blockchain sync happens in 3 cases:
|
I think I'd use wallet-tool to do the performance test. Something like
To test again, remove the wallet file and the blockstore file and re-execute the above steps. |
@schildbach probably you wanted to post that comment on bitcoinj/bitcoinj#1695 instead. |
I put this here because you guys are testing this. Thanks! I've just added a performance test. You could probably almost copy&paste it for testing. |
I did some very basic test with an older not synced app on mainnet with using NonMMappedSPVBlockStore and SPVBlockStore. 2318 blocks where downloaded. I had Bitcoin core locally to avoid too much influence from network conditions. SPVBlockStore: 51417 ms, 68965 ms, 68922 ms So NonMMappedSPVBlockStore is a bit slower but not too critical. I would prefer to not apply that to all OS but keep it as it is only for Windows. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK
Sorry for the delayed response. I have tried several times on testnet and the majority of those attempts ended up with the app not responding. My wallet is from 12/6/2018. |
@devinbileck could you try with mainnet? I could send you a data directory with the wallet I used for my tests where it was at least missing a few weeks of blocks. |
Maybe also try a delete spv file to get a full resync. |
I tried with that app again with resync spv file and worked all ok. |
Just an update. I only seem to encounter the issue on testnet, not on mainnet. |
I can reproduce an issue with the testnet directory you sent me. But it is not related to the NonMMappedSPVBlockStore as I get the same problem with or without using it. |
@devinbileck |
@ManfredKarrer I am still encountering the issue. I wonder if the issue is that the Tor settings popup is failing to render for me. I do see this warning, but not sure if it is related:
|
Ah you tested seed word restore, I tested SPV file resync. Will try that as well... |
I could restore the wallet but could not close the app at the end and it was under heavy load for very long time. I tested with and without the NonMMappedSPVBlockStore and both have been the same, so it seems it is an unrelated issue. I will create a new issue for investigating and fixing that. |
Issue is at #2425 |
Fixes #2402