Skip to content

p2p: fix logspam (backport #9756)#9764

Merged
thanethomson merged 3 commits intov0.34.xfrom
thane/bp/v0.34.x/pr-9756
Nov 30, 2022
Merged

p2p: fix logspam (backport #9756)#9764
thanethomson merged 3 commits intov0.34.xfrom
thane/bp/v0.34.x/pr-9756

Conversation

@thanethomson
Copy link
Contributor

Backports #9756 to v0.34.x.


PR checklist

  • Tests written/updated, or no tests needed
  • CHANGELOG_PENDING.md updated, or no changelog entry needed
  • Updated relevant documentation (docs/) and code comments, or no documentation updates needed

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
@thanethomson thanethomson added the S:automerge Automatically merge PR when requirements pass label Nov 29, 2022
@thanethomson thanethomson merged commit e941ad9 into v0.34.x Nov 30, 2022
@thanethomson thanethomson deleted the thane/bp/v0.34.x/pr-9756 branch November 30, 2022 17:56
@moul moul mentioned this pull request Mar 6, 2025
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S:automerge Automatically merge PR when requirements pass

Projects

Status: Done/Merged

Development

Successfully merging this pull request may close these issues.

3 participants