Skip to content

Commit

Permalink
Merge pull request #4291 from oasisprotocol/kostko/stable/21.2.x/back…
Browse files Browse the repository at this point in the history
…port-4290

[BACKPORT/21.2.x] go/worker/storage: Fix potential memory leak through context
  • Loading branch information
kostko authored Oct 1, 2021
2 parents d1b69f5 + 935093b commit e6bd05f
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
1 change: 1 addition & 0 deletions .changelog/4290.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
go/worker/storage: Fix potential memory leak through context
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docker/development/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ARG GO_PROTOC_GEN_GO_VERSION=1.21.0
ARG GOLANGCILINT_VERSION=1.41.1
ARG GOCOVMERGE_VERSION=b5bfa59ec0adc420475f97f89b58045c721d761c
ARG GOFUMPT_VERSION=v0.1.1
ARG RUST_NIGHTLY_VERSION=2021-05-20
ARG RUST_NIGHTLY_VERSION=2021-08-17
ARG JEMALLOC_VERSION=5.2.1
ARG JEMALLOC_CHECKSUM=34330e5ce276099e2e8950d9335db5a875689a4c6a56751ef3b1d8c537f887f6

Expand Down
5 changes: 4 additions & 1 deletion go/worker/storage/committee/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -529,9 +529,12 @@ func (n *Node) fetchDiff(round uint64, prevRoot, thisRoot storageApi.Root) {
"new_root", thisRoot,
)

ctx, cancel := context.WithCancel(n.ctx)
defer cancel()

// Prioritize committee nodes.
var selectedNode *node.Node
ctx := storageApi.WithNodeSelectionCallback(n.ctx, func(n *node.Node) {
ctx = storageApi.WithNodeSelectionCallback(ctx, func(n *node.Node) {
selectedNode = n
})
if committee := n.commonNode.Group.GetEpochSnapshot().GetStorageCommittee(); committee != nil {
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2021-05-20
nightly-2021-08-17

0 comments on commit e6bd05f

Please sign in to comment.