libp2p / libp2p/go-libp2p-pubsub

Unclosed reader in github.com/libp2p/go-libp2p-pubsub.(*PubSub).handleNewStream

Open
#186 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/bug
Dominant language
Go
Stars
364
Forks
221
PR merge metrics
No merged PRs in 30d

Description

This ReaderCloser is never closed. We are seeing high memory usage on the heap from this line and I suspect it is because `r.Close()` is never called.

https://github.com/libp2p/go-libp2p-pubsub/blob/49274b0e8aecdf6cad59d768e5702ff00aa48488/comm.go#L33

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in comm.go at line 33 and inspect PubSub.handleNewStream, where the ReaderCloser is created. Ensure the reader is closed on the relevant path, then run the repository's existing tests and confirm the unclosed-reader and memory-usage concern is addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
networking
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.