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

temporary diagnostics for peer investigation #7894

Closed
wants to merge 17 commits into from
Closed

Conversation

teor2345
Copy link
Contributor

@teor2345 teor2345 commented Nov 2, 2023

Motivation

This PR shows extra peer connection information in the getpeerinfo RPC and Zebra's logs.

It is just for investigating ticket #7787, these fields are not standard and should not be merged.

@teor2345 teor2345 added the do-not-merge Tells Mergify not to merge this PR label Nov 2, 2023
@teor2345 teor2345 self-assigned this Nov 2, 2023
@teor2345
Copy link
Contributor Author

teor2345 commented Nov 2, 2023

This PR generates logs like:

2023-11-02T01:56:32.233521Z  INFO {zebrad="6858fd4" net="Main"}:add_initial_peers: zebra_network::peer_set::initialize: an initial peer connection failed successes=0 errors=1 addr=v6redacted:8233 e=Netwo
rk is unreachable (os error 101)                                                                                                                                                                           
2023-11-02T01:56:35.230658Z  INFO zebra_state::service::finalized_state::disk_format::upgrade: database format is valid running_version=25.3.0 inital_disk_version=25.3.0                                  
2023-11-02T01:56:35.834470Z  INFO {zebrad="6858fd4" net="Main"}:add_initial_peers: zebra_network::peer_set::initialize: an initial peer connection failed successes=22 errors=2 addr=v4redacted:8233 e=requ
est timed out

And RPC responses like:

$ zcash-cli -rpcport=28232 getpeerinfo
  {
    "addr": "IPv6:8233",
    "state": "NeverAttemptedGossiped",
    "remote_last_seen": "None",
    "last_response": "None",
    "last_failed": "None"
  },
  {
    "addr": "IPv6:8233",
    "state": "NeverAttemptedGossiped",
    "remote_last_seen": "None",
    "last_response": "None",
    "last_failed": "None"
  },
  {
    "addr": "IPv6:8233",
    "state": "NeverAttemptedGossiped",
    "remote_last_seen": "None",
    "last_response": "None",
    "last_failed": "None"
  },
  {
    "addr": "IPv6:8233",
    "state": "NeverAttemptedAlternate",
    "remote_last_seen": "None",
    "last_response": "None",
    "last_failed": "None"
  },
  {
    "addr": "IPv6:8233",
    "state": "NeverAttemptedAlternate",
    "remote_last_seen": "None",
    "last_response": "None",
    "last_failed": "None"
  }

@teor2345
Copy link
Contributor Author

teor2345 commented Nov 2, 2023

IP addresses are redacted in the logs, that is implemented here:
https://github.com/ZcashFoundation/zebra/blob/main/zebra-network/src/meta_addr/peer_addr.rs

@teor2345
Copy link
Contributor Author

teor2345 commented Nov 3, 2023

I added the last version message (and connection version) to the getpeerinfo RPC. This should tell us what user_agent those peers have, if they send a Bitcoin Version message.

@teor2345
Copy link
Contributor Author

teor2345 commented Nov 3, 2023

Now the output looks like:

 {
    "addr": "IPv4:8233",
    "state": "Failed",
    "negotiated_version": "Version(170100)",
    "last_version_message": "VersionMessage { version: Version(170100), services: PeerServices(NODE_NETWORK), timestamp: 2023-11-03T05:14:36Z, address_recv: AddrInVersion { untrusted_services: PeerServices(NODE_NETWORK), addr: DifferentIPv4:31708 }, address_from: AddrInVersion { untrusted_services: PeerServices(NODE_NETWORK), addr: 0.0.0.0:8233 }, nonce: Nonce(2083055191835223851), user_agent: \"/MagicBean:5.7.0/\", start_height: Height(2283660), relay: true }",
    "last_response": "DateTime32 { timestamp: 1698989303, calendar: 2023-11-03T05:28:23Z }",
    "last_failure": "Instant { tv_sec: 19722863, tv_nsec: 288455831 }"
  },
  {
    "addr": "IPv4:8233",
    "state": "Failed",
    "negotiated_version": "Version(170100)",
    "last_version_message": "VersionMessage { version: Version(170100), services: PeerServices(NODE_NETWORK), timestamp: 2023-11-03T05:14:37Z, address_recv: AddrInVersion { untrusted_services: PeerServices(NODE_NETWORK), addr: DifferentIPv4:31532 }, address_from: AddrInVersion { untrusted_services: PeerServices(NODE_NETWORK), addr: 0.0.0.0:8233 }, nonce: Nonce(18138978616707281022), user_agent: \"/MagicBean:5.7.0/\", start_height: Height(2283660), relay: true }",
    "last_response": "DateTime32 { timestamp: 1698989304, calendar: 2023-11-03T05:28:24Z }",
    "last_failure": "Instant { tv_sec: 19722863, tv_nsec: 923423357 }"
  },
  {
    "addr": "[IPv6]:8233",
    "state": "Failed",
    "remote_last_seen": "DateTime32 { timestamp: 1698988478, calendar: 2023-11-03T05:14:38Z }",
    "last_failure": "Instant { tv_sec: 19721980, tv_nsec: 176347278 }"
  },
  {
    "addr": "IPv4:8233",
    "state": "Failed",
    "remote_last_seen": "DateTime32 { timestamp: 1698987600, calendar: 2023-11-03T05:00:00Z }",
    "last_failure": "Instant { tv_sec: 19722224, tv_nsec: 702493361 }"
  },
  {
    "addr": "IPv4:8233",
    "state": "Failed",
    "remote_last_seen": "DateTime32 { timestamp: 1698987600, calendar: 2023-11-03T05:00:00Z }",
    "last_failure": "Instant { tv_sec: 19722227, tv_nsec: 704088569 }"
  },
  {
    "addr": "IPv4:8233",
    "state": "Failed",
    "remote_last_seen": "DateTime32 { timestamp: 1698987600, calendar: 2023-11-03T05:00:00Z }",
    "last_failure": "Instant { tv_sec: 19722654, tv_nsec: 178262353 }"
  },
  {
    "addr": "IPv4:8233",
    "state": "Failed",
    "negotiated_version": "Version(170100)",
    "last_version_message": "VersionMessage { version: Version(170100), services: PeerServices(NODE_NETWORK), timestamp: 2023-11-03T05:25:00Z, address_recv: AddrInVersion { untrusted_services: PeerServices(NODE_NETWORK), addr: DifferentIPv4:31626 }, address_from: AddrInVersion { untrusted_services: PeerServices(NODE_NETWORK), addr: 0.0.0.0:8233 }, nonce: Nonce(15080595378646283320), user_agent: \"/Zebra:1.3.0/\", start_height: Height(2283675), relay: true }",
    "last_response": "DateTime32 { timestamp: 1698989214, calendar: 2023-11-03T05:26:54Z }",
    "last_failure": "Instant { tv_sec: 19722775, tv_nsec: 27109102 }"
  }
]

@teor2345
Copy link
Contributor Author

teor2345 commented Nov 5, 2023

This PR has served its purpose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge Tells Mergify not to merge this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant