novitski / bitcoinj

Automatically exported from code.google.com/p/bitcoinj
Apache License 2.0
0 stars 0 forks source link

peer discovery goes crazy if network is down at startup #519

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I’ve noticed that bitcoinj goes totally crazy when the network is down when 
the app is started - it starts printing a lot of logs about DNS discovery very 
fast.

I tracked this in code, and it looks like there’s some exponential backoff 
class there that theoretically handles this, but not in this case. PeerGroup 
calls it with trackSuccess and trackFailure, but the backoff time is only used 
if the exception is *not* thrown there. So if a PeerDiscoveryException is 
thrown, it doesn’t reach the code that does sleep() with the specified 
backoff time, and it basically runs the discovery in an infinite loop without 
any delay.

From what I can tell, reworking PeerGroup.connectToAnyPeer a bit would fix 
this, but I don’t know how exactly.

Original issue reported on code.google.com by jakub.su...@gmail.com on 13 Feb 2014 at 12:05

GoogleCodeExporter commented 9 years ago
Should be fixed by a2afe470c2ac. Please let me know if you still see this. 
Replicating "network down" conditions in all cases is a bit hard.

Original comment by mh.in.en...@gmail.com on 1 Apr 2014 at 2:53

GoogleCodeExporter commented 9 years ago
Actually this one was pretty easy to test - turn off the wifi and start the app 
again. I'll give it a try.

Original comment by jakub.su...@gmail.com on 1 Apr 2014 at 3:35

GoogleCodeExporter commented 9 years ago
Looks like it works fine now on 0.11.2, thanks.

Original comment by jakub.su...@gmail.com on 29 Apr 2014 at 4:17

GoogleCodeExporter commented 9 years ago
Thanks for the feedback.

Original comment by andreas....@gmail.com on 29 Apr 2014 at 8:27