p2p: fix logspam (backport #9756)#9764
Merged
thanethomson merged 3 commits intov0.34.xfrom Nov 30, 2022
Merged
Conversation
Since starting off as a wee validator, I've been mystified by the volume of p2p logspam, which often makes it impossible to monitor other tasks. Thus, routine p2p events, have been cast into the land of debug.
---
#### PR checklist
- [x] Tests written/updated, or no tests needed
- [x] `CHANGELOG_PENDING.md` updated, or no changelog entry needed
- [x] Updated relevant documentation (`docs/`) and code comments, or no
documentation updates needed
lasarojc
approved these changes
Nov 28, 2022
Closed
evan-forbes
added a commit
to celestiaorg/celestia-core
that referenced
this pull request
Jul 4, 2025
## Problem
During block syncing and heavy p2p activity, the terminal gets flooded
with verbose INFO-level log messages from p2p and addrbook components,
making it difficult to see important information. Users reported log
spam like:
```
6:18PM INF new bucket is full, expiring new book=/Users/rootulp/.celestia-app/config/addrbook.json module=p2p
6:18PM INF Connection is closed @ recvRoutine (likely by the other side) conn=MConn{65.109.83.40:28656} module=p2p
6:18PM INF Saving AddrBook to file size=100
6:18PM INF Ignoring inbound connection: already have enough inbound peers address=192.168.1.1:26656
```
## Solution
Changed specific p2p and addrbook log messages from INFO to DEBUG level
to reduce log spam while preserving important error and lifecycle
information.
### Changes Made
1. **p2p/pex/addrbook.go**: `"new bucket is full, expiring new"` - INFO
→ DEBUG
2. **p2p/conn/connection.go**: `"Connection is closed @ recvRoutine
(likely by the other side)"` - INFO → DEBUG
3. **p2p/pex/file.go**: `"Saving AddrBook to file"` - INFO → DEBUG
4. **p2p/switch.go**: `"Ignoring inbound connection: already have enough
inbound peers"` - INFO → DEBUG
### Impact
- **Reduces log spam** during block syncing and peer discovery
- **Preserves important logs** - service lifecycle and error messages
remain at appropriate levels
- **Minimal change** - only 4 lines modified across 4 files
- **Consistent with previous fixes** - follows pattern established in
[#9764](tendermint/tendermint#9764)
### Testing
- All p2p tests pass
- Build successful
- Verified log level changes work correctly (messages now show
`D[timestamp]` instead of `I[timestamp]`)
Fixes #2130.
> [!WARNING]
>
> <details>
> <summary>Firewall rules blocked me from connecting to one or more
addresses</summary>
>
> #### I tried to connect to the following addresses, but was blocked by
firewall rules:
>
> - `126.101.171.250`
> - Triggering command: `/tmp/go-build3427852302/b571/pex.test
-test.testlogfile=/tmp/go-build3427852302/b571/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -test.short=true` (packet block)
> - `167.42.4.173`
> - Triggering command: `/tmp/go-build3367807797/b001/pex.test
-test.testlogfile=/tmp/go-build3367807797/b001/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -test.v=true -test.short=true`
(packet block)
> - `179.222.23.223`
> - Triggering command: `/tmp/go-build3427852302/b571/pex.test
-test.testlogfile=/tmp/go-build3427852302/b571/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -test.short=true` (packet block)
> - `192.0.2.1`
> - Triggering command: `/tmp/go-build3427852302/b571/pex.test
-test.testlogfile=/tmp/go-build3427852302/b571/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -test.short=true` (packet block)
> - Triggering command: `/tmp/go-build3367807797/b001/pex.test
-test.testlogfile=/tmp/go-build3367807797/b001/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -test.v=true -test.short=true`
(packet block)
> - `195.21.4.91`
> - Triggering command: `/tmp/go-build3367807797/b001/pex.test
-test.testlogfile=/tmp/go-build3367807797/b001/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -test.v=true -test.short=true`
(packet block)
> - `20.230.104.91`
> - Triggering command: `/tmp/go-build3367807797/b001/pex.test
-test.testlogfile=/tmp/go-build3367807797/b001/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -test.v=true -test.short=true`
(packet block)
> - `246.45.68.141`
> - Triggering command: `/tmp/go-build3427852302/b571/pex.test
-test.testlogfile=/tmp/go-build3427852302/b571/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -test.short=true` (packet block)
> - `30.72.37.142`
> - Triggering command: `/tmp/go-build3427852302/b571/pex.test
-test.testlogfile=/tmp/go-build3427852302/b571/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -test.short=true` (packet block)
> - `93.110.115.172`
> - Triggering command: `/tmp/go-build3367807797/b001/pex.test
-test.testlogfile=/tmp/go-build3367807797/b001/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -test.v=true -test.short=true`
(packet block)
> - `anotherbad.network.addr`
> - Triggering command: `/tmp/go-build3427852302/b571/pex.test
-test.testlogfile=/tmp/go-build3427852302/b571/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -test.short=true` (dns block)
> - `bad.network.addr`
> - Triggering command: `/tmp/go-build3427852302/b571/pex.test
-test.testlogfile=/tmp/go-build3427852302/b571/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -test.short=true` (dns block)
> - `ya.ru`
> - Triggering command: `/tmp/go-build3427852302/b552/p2p.test
-test.testlogfile=/tmp/go-build3427852302/b552/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -test.short=true` (dns block)
>
> If you need me to access, download, or install something from one of
these locations, you can either:
>
> - Configure [Actions setup
steps](https://gh.io/copilot/actions-setup-steps) to set up my
environment, which run before the firewall is enabled
> - Add the appropriate URLs or hosts to my [firewall allow
list](https://gh.io/copilot/firewall-config)
>
> </details>
<!-- START COPILOT CODING AGENT TIPS -->
---
💬 Share your feedback on Copilot coding agent for the chance to win a
$200 gift card! Click
[here](https://survey.alchemer.com/s3/8343779/Copilot-Coding-agent) to
start the survey.
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: evan-forbes <42654277+evan-forbes@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backports #9756 to
v0.34.x.PR checklist
CHANGELOG_PENDING.mdupdated, or no changelog entry neededdocs/) and code comments, or no documentation updates needed