Skip to content

refactor: Improve logging for failed p2p connection #5379

Merged
dima74 merged 2 commits intohyperledger-iroha:mainfrom
dima74:diralik/improve-logging-for-failed-p2p
Mar 25, 2025
Merged

refactor: Improve logging for failed p2p connection #5379
dima74 merged 2 commits intohyperledger-iroha:mainfrom
dima74:diralik/improve-logging-for-failed-p2p

Conversation

@dima74
Copy link
Contributor

@dima74 dima74 commented Mar 21, 2025

Currently if peer can't establish connection with another peer, we will have such warning in logs:

  WARN iroha_p2p::peer::run: Failure during handshake., error: Io(Os { code: 111, kind: ConnectionRefused, message: "Connection refused" })
at crates/iroha_p2p/src/peer.rs:133
in iroha_p2p::peer::run::run with conn_id: 0
in iroha_p2p::network::run with listen_addr: 127.0.0.1:1337, public_key: ed012003415E0E516BE83870CE5A2165605E8719216B5ECCCE4AEDFB0B2B77862B3798

Note that there is no information about the remote peer, only about current peer (127.0.0.1:1337 is current peer address). This PR adds remote address to the log message:

  WARN iroha_p2p::peer::run: Failure during handshake., error: Io(Os { code: 111, kind: ConnectionRefused, message: "Connection refused" })
at crates/iroha_p2p/src/peer.rs:133
in iroha_p2p::peer::run::run with connection: "outgoing to 127.0.0.1:1338", conn_id: 0
in iroha_p2p::network::run with listen_addr: 127.0.0.1:1337, public_key: ed012003415E0E516BE83870CE5A2165605E8719216B5ECCCE4AEDFB0B2B77862B3798

Also slightly refactored logic of PeersGossiper so that NetworkBase::current_peers_addresses will not contain current peer address (no behaviour changes, but improves debugging)

@s8sato s8sato self-assigned this Mar 21, 2025
dima74 added 2 commits March 25, 2025 11:07
Signed-off-by: Dmitry Murzin <diralik@yandex.ru>
Signed-off-by: Dmitry Murzin <diralik@yandex.ru>
@dima74 dima74 force-pushed the diralik/improve-logging-for-failed-p2p branch from 6b4ac8f to cf1a95d Compare March 25, 2025 08:07
@dima74 dima74 merged commit 2c5e055 into hyperledger-iroha:main Mar 25, 2025
12 of 14 checks passed
@dima74 dima74 deleted the diralik/improve-logging-for-failed-p2p branch March 25, 2025 09:28
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

Successfully merging this pull request may close these issues.

3 participants