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
bitswap/client: memory leak on BlockPresenceManager #574
Comments
Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review.
Finally, remember to use https://discuss.ipfs.io if you just need general support. |
@Dreamacro can you attach or link to a pprof dump for analysis? Also, which versions of boxo and go-libp2p are you using? |
I first provide a few fragments of pprof/heap. I can confirm a memory leak here because the leakage disappears when I replace heap fragments: (Although boxo 0.15 is shown below, it has been upgraded to boxo 0.17)
|
Recently, I observed that when using bitswap for fetching data, there is a large amount of memory consumption and no release after downloading.
I use pprof and find most heap is occupied here.
boxo/bitswap/client/internal/blockpresencemanager/blockpresencemanager.go
Line 40 in 89bceff
I try to print stat after
bpm.presence[c] = make(map[peer.ID]bool)
and I foundbpm.presence
would delete onBlockPresenceManager.RemoveKeys
, so I added some logs.I found that there is a race condition problem here.
BlockPresenceManager.RemoveKeys
has been called and remove the CidABlockPresenceManager.ReceiveFrom
has been called and createdbpm.presence[CidA]
bpm.presence[CidA]
is no longer used or removed, and the map is getting bigger and bigger.The text was updated successfully, but these errors were encountered: