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

fix(p2p): log user agent on banning a peer #5056

Merged
merged 2 commits into from
Dec 10, 2024
Merged

Conversation

hanabi1224
Copy link
Contributor

@hanabi1224 hanabi1224 commented Dec 9, 2024

Summary of changes

We occasionally see a lot of expected banning peer PEER for REASON logs, it'd help troubleshooting the issue to add user agent to the log

Changes introduced in this pull request:

Sample logs:

2024-12-10T00:41:20.357572Z  DEBUG forest_filecoin::libp2p::service: Banning peer peer=12D3KooWJe3QWBUFPa7DBaYLq1BXWcK2LVM39VBawuVz3ePHT45K user_agent= reason=Hello protocol unsupported
2024-12-10T00:41:20.357801Z  DEBUG forest_filecoin::libp2p::service: Banning peer peer=12D3KooWJe3QWBUFPa7DBaYLq1BXWcK2LVM39VBawuVz3ePHT45K user_agent=sophon-messager reason=hello protocol unsupported
2024-12-10T00:41:20.435089Z  DEBUG forest_filecoin::libp2p::service: Banning peer peer=12D3KooWQtcfpAhnu89D3YkyA1ZVXmDBmCLwA62LEfHinfLcHzoL user_agent= reason=Hello protocol unsupported

Reference issue to close (if applicable)

Closes

Other information and links

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation. All new code adheres to the team's documentation standards,
  • I have added tests that prove my fix is effective or that my feature works (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

@hanabi1224 hanabi1224 marked this pull request as ready for review December 9, 2024 12:54
@hanabi1224 hanabi1224 requested a review from a team as a code owner December 9, 2024 12:54
@hanabi1224 hanabi1224 requested review from lemmih and LesnyRumcajs and removed request for a team December 9, 2024 12:54
@LesnyRumcajs
Copy link
Member

LesnyRumcajs commented Dec 9, 2024

What would be the sample log output now? Let's embed it into the PR description.

@@ -451,10 +451,12 @@ where
// Internal libp2p error, score failure for peer and potentially disconnect
match e {
RequestResponseError::UnsupportedProtocols => {
// refactor this into Networkevent if user agent logging is critical here
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's have a tracking issue, otherwise it's unlikely anyone will pick it up when browsing the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hanabi1224
Copy link
Contributor Author

What would be the sample log output now? Let's embed it into the PR description.

@LesnyRumcajs Done.

@hanabi1224 hanabi1224 added this pull request to the merge queue Dec 10, 2024
Merged via the queue into main with commit 40eb3f2 Dec 10, 2024
34 checks passed
@hanabi1224 hanabi1224 deleted the hm/log-user-agent branch December 10, 2024 01:04
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