-
Notifications
You must be signed in to change notification settings - Fork 98
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
A long delay in CAddrMan::Select() causes p2p messages to be blocked #423
Comments
A possible solution is to move the max retries loop outside the lock. This will slow down the P2P stuff, but not stop it. Note that link is totally untested code. A note here is that it appears a mock RNG is necessary for testing. A possible option is to make this class a template, and apply the appropriate RNG at compile time. This would move the code for testing into the test and out of the implementation. |
I thought we could simply use the Select_() from bitcoin source, it is actually the same but has no any delays |
more findings on this issue: |
yet more info about connection management: |
The issue is even worse though: |
Just some info from where it comes:
I guess we should revert ZCash jl777#929 changes and try to reproduce 100% CPU load when offline and investigate what Bitcoin had to do with that issue. |
A higher cpu load which described by zcash, I believe, occurs only on small chains. On big chains the connection number quickly reaches the limit and the node stops trying connecting, so I think for bitcoin (or kmd) this is not an issue |
I return back to this issue as it is a bit annoying on test chains, preventing nodes from connection. As it was suggested above I tried to check if the same issue is addressed somehow in bitcoin (namely CConnman::ThreadOpenConnections): I also investigated what happens on a small chain with the delay in Select_() removed: I would not say that any extra heady load was seen. BTW I saw an extra load and frequent connections on test asset chains, in past, when we had invalid seeds left in our code. Obviously, we should not any unneeded seeds for komodo or asset chain, to avoid extra conn tries. I still think we should remove this delay in Select_ anyway, because I think it is in fact dangerous code when p2p pump is stopped for minutes, which probably may be exploited. |
There is a problem with addrman locks in komodod.
A delay exists in addrman.Select() function (
komodo/src/addrman.cpp
Line 361 in 9df2abc
This is most noticeable for nspv clients which might timeout waiting for response from a nspv server.
The reason for this delay is explained in this zcash fix zcash#929.
However I checked the current bitcoin code, they do not seem to have such delays in addrman. Suggest removing it.
The addman.Select() is called quite regularly when the node is trying to maintain connections to peers.
The text was updated successfully, but these errors were encountered: