eos icon indicating copy to clipboard operation
eos copied to clipboard

nodeos 1.7.4 will not connect to nodeos 1.8.0 with allowed-connection = specified

Open matthewdarwin opened this issue 7 years ago • 9 comments

If you have a nodeos 1.7.4 server and try to connect to a 1.8.0 server with allowed-connection = specified, it will fail. (1.8.0 to 1.7.4 also fails)

This is seen in the log:

Jul  1 13:03:24 mainnet-peer8 nodeos[42247]: info  2019-07-01T13:03:24.246 thread-0  net_plugin.cpp:1827           connect              ] host: 192.168.122.37 port: 9876
Jul  1 13:03:24 mainnet-peer8 nodeos[42247]: info  2019-07-01T13:03:24.246 thread-0  net_plugin.cpp:1827           connect              ] host: 192.168.122.131 port: 9876
Jul  1 13:03:24 mainnet-peer8 nodeos[42247]: info  2019-07-01T13:03:24.246 thread-0  net_plugin.cpp:1827           connect              ] host: 192.168.122.157 port: 9876
Jul  1 13:03:24 mainnet-peer8 nodeos[42247]: info  2019-07-01T13:03:24.247 thread-0  net_plugin.cpp:1827           connect              ] host: 192.168.122.175 port: 9876
Jul  1 13:03:24 mainnet-peer8 nodeos[42247]: error 2019-07-01T13:03:24.249 thread-0  net_plugin.cpp:1108           operator()           ] sent a go away message: authentication failure, closing connection to 192.168.122.175:9876
Jul  1 13:03:24 mainnet-peer8 nodeos[42247]: error 2019-07-01T13:03:24.249 thread-0  net_plugin.cpp:1108           operator()           ] sent a go away message: authentication failure, closing connection to 192.168.122.131:9876
Jul  1 13:03:24 mainnet-peer8 nodeos[42247]: error 2019-07-01T13:03:24.249 thread-0  net_plugin.cpp:1108           operator()           ] sent a go away message: authentication failure, closing connection to 192.168.122.37:9876
Jul  1 13:03:24 mainnet-peer8 nodeos[42247]: error 2019-07-01T13:03:24.250 thread-0  net_plugin.cpp:1108           operator()           ] sent a go away message: authentication failure, closing connection to 192.168.122.157:9876

The servers will connect to each other fine if allowed-connections = any They also connect fine if they are all on 1.8 or all on 1.7.

matthewdarwin avatar Jul 01 '19 13:07 matthewdarwin

have you set the peer-key and peer-private-key correctly? for example:

node 0: peer-key = public key of node 1 peer-private-key = [public key of node 0, private key of node 0]

node 1: peer-key = public key of node 0 peer-private-key = [public key of node 1, private key of node 1]

I tested between v1.8 and v1.7 and it works for me.

taokayan avatar Jul 02 '19 08:07 taokayan

Let me play with it some more...

matthewdarwin avatar Jul 02 '19 20:07 matthewdarwin

Ok, is there an issue if multiple peer-key are set? This is the difference between my actual configuration and your test.

p2p-peer-address = 192.168.106.190:9876
peer-key = "X1"

p2p-peer-address = 192.168.106.193:9876
peer-key = "X2"

peer-private-key = ["XXXXX"]

It seems that maybe only one 'peer-key' is kept and the others are ignored? (whereas in 1.7 all peer-key are kept)

matthewdarwin avatar Jul 06 '19 14:07 matthewdarwin

Ok, so I reduce this to only 1 peer... I still see the problem.

matthewdarwin avatar Jul 06 '19 19:07 matthewdarwin

Enabling debug logging gives no real further info.

Jul  6 20:32:25 mainnet-sh8 nodeos[46908]: info  2019-07-06T20:32:25.575 thread-0  net_plugin.cpp:1827           connect              ] host: mainnet-peer8 port: 9876
Jul  6 20:32:25 mainnet-sh8 nodeos[46908]: debug 2019-07-06T20:32:25.576 thread-0  net_plugin.cpp:909            send_handshake       ] Sending handshake generation 1 to mainnet-peer8:9876
Jul  6 20:32:25 mainnet-sh8 nodeos[46908]: info  2019-07-06T20:32:25.578 thread-0  net_plugin.cpp:2208           handle_message       ] ["mainnet-peer8:9876" 172.20.4.28:9876]received handshake_message
Jul  6 20:32:25 mainnet-sh8 nodeos[46908]: debug 2019-07-06T20:32:25.578 thread-0  net_plugin.cpp:2228           handle_message       ] checking for duplicate
Jul  6 20:32:25 mainnet-sh8 nodeos[46908]: error 2019-07-06T20:32:25.578 thread-0  net_plugin.cpp:2745           authenticate_peer    ] Peer mainnet-peer8:9876 - 0f596e4 sent a handshake with a timestamp skewed by more than 1 second.
Jul  6 20:32:25 mainnet-sh8 nodeos[46908]: error 2019-07-06T20:32:25.578 thread-0  net_plugin.cpp:2276           handle_message       ] Peer not authenticated.  Closing connection.
Jul  6 20:32:25 mainnet-sh8 nodeos[46908]: error 2019-07-06T20:32:25.578 thread-0  net_plugin.cpp:1108           operator()           ] sent a go away message: authentication failure, closing connection to mainnet-peer8:9876
Jul  6 20:32:25 mainnet-sh8 nodeos[46908]: debug 2019-07-06T20:32:25.578 thread-0  net_plugin.cpp:823            close                ] canceling wait on mainnet-peer8:9876

here are the config files from my 2 test nodes. "mainnet-sh8" is on 1.7.4. "mainnet-peer8" is on 1.8.0

config.ini-1.7-mainnet-sh8.txt config.ini-1.8-mainnet-peer8.txt

matthewdarwin avatar Jul 06 '19 20:07 matthewdarwin

The root cause is a difference in the default resolution of std::chrono:duration between 1.8.x and older versions of eosio. In 1.8.x the default resolution is microseconds and in older versions it is nanoseconds.

The peering handshake verifies that time skew between peers is less than 1 second. This is where the handshake was failing.

I explicitly cast duration nanaseconds in the handshake in the Worbli fork to fix the issue.

rdewilder avatar Jul 21 '19 16:07 rdewilder

Is there any workaround or mitigation for this issue for base EOSIO software?

matthewdarwin avatar Jul 25 '19 13:07 matthewdarwin

@rdewilder Can you create a pull request to release/1.8.x and develop for your fix.

heifner avatar Jul 25 '19 13:07 heifner

Fix merged to 1.8.x and develop

heifner avatar Jul 29 '19 17:07 heifner