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

Upstream patch: fix memory leak issue with diff protocol #8

Merged
merged 1 commit into from
Sep 1, 2022

Conversation

0xe3b0c4
Copy link
Collaborator

@0xe3b0c4 0xe3b0c4 commented Aug 27, 2022

Description

From: #1019

broadcastDiffLayers is not properly closed, the memory accumulates too many resources and causes OOM.

goroutine 8845520 [select, 3426 minutes]:
github.com/ethereum/go-ethereum/eth/protocols/diff.(*Peer).broadcastDiffLayers(0xc081628d20)
	github.com/ethereum/go-ethereum/eth/protocols/diff/peer.go:47 +0xab
created by github.com/ethereum/go-ethereum/eth/protocols/diff.NewPeer
	github.com/ethereum/go-ethereum/eth/protocols/diff/peer.go:41 +0x2f0

goroutine 7119763 [select, 3531 minutes]:
github.com/ethereum/go-ethereum/eth/protocols/diff.(*Peer).broadcastDiffLayers(0xc10bcd4e40)
	github.com/ethereum/go-ethereum/eth/protocols/diff/peer.go:47 +0xab
created by github.com/ethereum/go-ethereum/eth/protocols/diff.NewPeer
	github.com/ethereum/go-ethereum/eth/protocols/diff/peer.go:41 +0x2f0

goroutine 11443031 [select, 3272 minutes]:
github.com/ethereum/go-ethereum/eth/protocols/diff.(*Peer).broadcastDiffLayers(0xc0f9bb3260)
	github.com/ethereum/go-ethereum/eth/protocols/diff/peer.go:47 +0xab
created by github.com/ethereum/go-ethereum/eth/protocols/diff.NewPeer
	github.com/ethereum/go-ethereum/eth/protocols/diff/peer.go:41 +0x2f0

Rationale

broadcastDiffLayers will be started in NewPeer; need to call peer.Close when RunPeer fails. otherwise, this goroutine will not be closed.

Example

panic.log

Changes

Notable changes:

close the peer on failure in RunPeer function.

@0xe3b0c4 0xe3b0c4 changed the title Patch: Cherry pick BSC PR #1019 Upstream patch: fix memory leak issue with diff protocol Aug 27, 2022
@RichardBrown123go RichardBrown123go added the bug fix Fix a bug label Aug 27, 2022
@0xe3b0c4 0xe3b0c4 added the upstream pulling pull and merge from upstream repo label Sep 1, 2022
Copy link
Collaborator

@RichardBrown123go RichardBrown123go left a comment

Choose a reason for hiding this comment

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

LGTM.

@RichardBrown123go RichardBrown123go merged commit 42ccd78 into antimatter-dao:devel Sep 1, 2022
@0xe3b0c4 0xe3b0c4 deleted the cherry-pick-1019 branch September 1, 2022 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fix Fix a bug upstream pulling pull and merge from upstream repo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants