Skip to content
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

DNS peer discovery not working properly #66

Open
rafa-js opened this issue Jul 12, 2018 · 7 comments
Open

DNS peer discovery not working properly #66

rafa-js opened this issue Jul 12, 2018 · 7 comments

Comments

@rafa-js
Copy link

rafa-js commented Jul 12, 2018

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:

  • Found in Android devices.
  • The device has connection and other the apps work fine.
  • It happens with both WiFi and mobile connection.
  • I have experienced some times it.
  • Finally it finds the peers after a long time without restart the application.
  • I don't know how to replicate this behavior, just occurs randomly.

Example of log file:

W/MultiplexingDiscovery: Seed seed.bitcoinabc.org: timed out
W/MultiplexingDiscovery: Seed seed-abc.bitcoinforks.org: timed out
W/MultiplexingDiscovery: Seed btccash-seeder.bitcoinunlimited.info: timed out
W/MultiplexingDiscovery: Seed seed.bitprim.org: timed out
W/MultiplexingDiscovery: Seed seed.deadalnix.me: timed out
W/MultiplexingDiscovery: Seed seeder.criptolayer.net: timed out
E/PeerGroup: Peer discovery failure org.bitcoinj.net.discovery.PeerDiscoveryException: No peer discovery returned any results in 5000ms. Check internet connection?
at org.bitcoinj.net.discovery.MultiplexingDiscovery.getPeers(MultiplexingDiscovery.java:116)
at org.bitcoinj.core.PeerGroup.discoverPeers(PeerGroup.java:1051)
at org.bitcoinj.core.PeerGroup$6.go(PeerGroup.java:546)
at org.bitcoinj.core.PeerGroup$6.run(PeerGroup.java:512)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:272)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at org.bitcoinj.utils.ContextPropagatingThreadFactory$1.run(ContextPropagatingThreadFactory.java:49)
at java.lang.Thread.run(Thread.java:761)
I/PeerGroup: Peer discovery didn't provide us any more peers, will try again in 6010ms.

Have you experienced anything similar? Any ideas or alternatives?

Regards,

@rafa-js rafa-js changed the title DnsPeerDiscovery not working properly DNS peer discovery not working properly Jul 12, 2018
@Danconnolly
Copy link
Collaborator

I've not seen this before but it's interesting. I'll try and have a look at it later.

@Danconnolly
Copy link
Collaborator

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.

@Danconnolly
Copy link
Collaborator

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

@rafa-js
Copy link
Author

rafa-js commented Jul 15, 2018

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?

@Danconnolly
Copy link
Collaborator

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.

@HashEngineering
Copy link
Collaborator

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.

@rafa-js
Copy link
Author

rafa-js commented Jul 16, 2018

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants