openvcash / vcash

A decentralized currency for the internet.
https://vcash.info
GNU Affero General Public License v3.0
36 stars 35 forks source link

Only 1 TCP connection during initial sync #44

Open whphhg opened 6 years ago

whphhg commented 6 years ago

I tried a fresh sync today and the node doesn't get the 3 connections like it did before, only 1 while logging the message below.

[INFO] - tick: TCP connection manager attempted to connect to IP:34621 too soon, last try = 34 seconds.
[INFO] - tick: TCP connection manager attempted to connect to IP:35409 too soon, last try = 34 seconds.
[INFO] - tick: TCP connection manager attempted to connect to IP:34621 too soon, last try = 35 seconds.
sum01 commented 6 years ago

Maybe something wrong with the bootstrap nodes? Not sure...

sum01 commented 6 years ago

So during its attempts to make tcp connections, it rate-limits attempts to every 60 seconds. It logs this message if it hasn't been 60 seconds yet.

I don't think this is a bug, unless you're seeing the message non-stop, or it's failing to get more than your set minimum TCP connections (in config.dat) after a long time.

whphhg commented 6 years ago

I guess it was non-stop for that one hour window when I've tried to sync from genesis. I've started a fresh sync again and it's working as expected.

Did you mean maximum TCP connections in config.dat? I've tried adding minimum and it gets removed from config.dat after starting the daemon.

sum01 commented 6 years ago

Ah, sorry. It's apparently a minimum TCP set in the code itself. Depending on some conditions, it get set to 1, 3, or 8.

edit: Code here https://github.com/openvcash/vcash/blob/de691df5ead425a7dc3e2fe4643b8d9d54272063/coin/src/tcp_connection_manager.cpp#L403-L426

whphhg commented 6 years ago

Thanks for clearing that out. There is a small issue at the end of the genesis sync, on the last or second to last set_best_chain. It gets stuck on 99.98% and starts to log a lot of send_getdata_message.

A restart solves the issue and it reaches the correct height (last ~500 blocks).

[INFO] - set_best_chain: Block, set best chain, new best = 00000000000045057a5ecf9ff5adeb9f8a3deb78f117e6928900201ded3dbb1c, height = 892500, trust = 1485043126051210, date = 1517262727.
[INFO] - operator(): Incentive manager has 0 collateralised nodes.
[INFO] - operator(): Incentive manager has 0 collateralised nodes.
[INFO] - send_getdata_message: TCP connection 2224903687 is sending getdata, count = 132.
[INFO] - send_getdata_message: TCP connection 2224903687 is sending getdata, count = 68.
[INFO] - send_getdata_message: TCP connection 1093474187 is sending getdata, count = 132.
[INFO] - operator(): Incentive manager has 0 collateralised nodes.
[INFO] - send_getdata_message: TCP connection 2224903687 is sending getdata, count = 74.
[INFO] - send_getdata_message: TCP connection 2224903687 is sending getdata, count = 75.
[INFO] - send_getdata_message: TCP connection 1093474187 is sending getdata, count = 68.
[INFO] - send_getdata_message: TCP connection 1441983207 is sending getdata, count = 132.
[INFO] - send_getdata_message: TCP connection 2224903687 is sending getdata, count = 76.
[INFO] - send_getdata_message: TCP connection 1093474187 is sending getdata, count = 74.
[INFO] - send_getdata_message: TCP connection 1093474187 is sending getdata, count = 75.
[INFO] - send_getdata_message: TCP connection 1441983207 is sending getdata, count = 68.
[INFO] - send_getdata_message: TCP connection 2224903687 is sending getdata, count = 77.
[INFO] - send_getdata_message: TCP connection 1093474187 is sending getdata, count = 76.
[INFO] - send_getdata_message: TCP connection 1441983207 is sending getdata, count = 74.
[INFO] - send_getdata_message: TCP connection 2224903687 is sending getdata, count = 79.
[INFO] - send_getdata_message: TCP connection 1441983207 is sending getdata, count = 75.
sum01 commented 6 years ago

I don't think there's anything to worry about the [INFO] messages, but that "stuck on 99.98%" thing sounds like a different issue.