Open rafa-js opened 6 years ago
I've not seen this before but it's interesting. I'll try and have a look at it later.
I had this today, not sure if its relevant but putting it here for later analysis:
2018-07-15 14:28:36.793 [PeerGroup Thread] INFO org.bitcoinj.core.PeerGroup - Peer discovery took 3.751 s and returned 77 items
2018-07-15 14:28:36.794 [PeerGroup Thread] INFO org.bitcoinj.core.PeerGroup - Waiting 1000 msec before next connect attempt to [2607:5300:120:9ac:0:0:0:0]:8333
2018-07-15 14:28:37.795 [PeerGroup Thread] INFO org.bitcoinj.core.PeerGroup - Waiting 1000 msec before next connect attempt to [119.23.173.138]:8333
There was then 10 minutes of just trying these two addresses, no others.
Interesting, travis had the same problem:
2018-07-15 12:07:05.376 [PeerGroup Thread] INFO org.bitcoinj.core.PeerGroup - Peer discovery took 1.209 s and returned 63 items
2018-07-15 12:07:05.376 [PeerGroup Thread] INFO org.bitcoinj.core.PeerGroup - Waiting 1000 msec before next connect attempt to [67.207.85.98]:8333
2018-07-15 12:07:06.377 [PeerGroup Thread] INFO org.bitcoinj.core.PeerGroup - Waiting 1000 msec before next connect attempt to [186.136.138.196]:8333
I think this is the normal behaviour for the PeerGroup::discoverPeers()
method in case the response is obtained in less time than the vPeerDiscoveryTimeoutMillis
, which is 5 seconds by default.
The question is, why does it takes 5 seconds and don't get a response? Part of the implementation or part of the DNS servers?
You're right, not related. I think its part of the underlying OS, network, or DNS servers. To be honest, I'd probably recommend just increasing the timeout.
Various types of connectivity issues are common. What I see from users of my app are transactions that are not sent due to insufficient peers. This is from not finding enough peers from the DNS servers, in addition to the minimum number of peers required to broadcast setting.
One thing that is missing from this library is getting addresses from other peers and storing them to use later when there are not enough connections or when dns was failing.
@HashEngineering I also came up with your last insight of remembering connected peers, but not sure how this would speed up the process. Anyway this is an optimization more than fix.
Will try with increasing the timeout and report back. Since this is an intermittent issue is both hard to replicate and hard to verify.
I have noticed sometimes the
MultiplexingDiscovery
is not able to find peers. This issue occurs randomly and is very confusing for the user: Can't see the balance increasing after send some funds. Some additional details:Example of log file:
Have you experienced anything similar? Any ideas or alternatives?
Regards,