Skip to content

fix evidence db iter leak#2516

Merged
melekes merged 4 commits intotendermint:developfrom
goolAdapter:fix_evidence_leak
Oct 2, 2018
Merged

fix evidence db iter leak#2516
melekes merged 4 commits intotendermint:developfrom
goolAdapter:fix_evidence_leak

Conversation

@goolAdapter
Copy link
Contributor

fix #2515

  • Updated all relevant documentation in docs
  • Updated all code comments where relevant
  • Wrote tests
  • Updated CHANGELOG_PENDING.md

@codecov-io
Copy link

codecov-io commented Sep 29, 2018

Codecov Report

Merging #2516 into develop will increase coverage by 0.01%.
The diff coverage is 100%.

@@             Coverage Diff             @@
##           develop    #2516      +/-   ##
===========================================
+ Coverage    61.31%   61.33%   +0.01%     
===========================================
  Files          202      202              
  Lines        16710    16655      -55     
===========================================
- Hits         10246    10215      -31     
+ Misses        5599     5576      -23     
+ Partials       865      864       -1
Impacted Files Coverage Δ
evidence/store.go 90.36% <100%> (ø) ⬆️
libs/clist/clist.go 66.49% <0%> (-1.53%) ⬇️
libs/db/prefix_db.go 55.75% <0%> (-0.8%) ⬇️
consensus/reactor.go 73.12% <0%> (+0.51%) ⬆️

l2 := make([]types.Evidence, len(l))
for i := range l {
l2[i] = l[len(l)-1-i]
for i := len(l)/2 - 1; i >= 0; i-- {
Copy link
Contributor

Choose a reason for hiding this comment

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

i, j := 0, len(l)-1; i < j; i, j = i+1, j-1 {
  l[i], l[j] = l[j], l[i]
}

How about ^^^?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think both is ok,respect your prefrence.

func (store *EvidenceStore) listEvidence(prefixKey string, maxBytes int64) (evidence []types.Evidence) {
var bytes int64
iter := dbm.IteratePrefix(store.db, []byte(prefixKey))
defer iter.Close()
Copy link
Contributor

@melekes melekes Sep 29, 2018

Choose a reason for hiding this comment

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

Whoops. Not sure how we missed this. Thanks for spotting.

Copy link
Contributor

@melekes melekes left a comment

Choose a reason for hiding this comment

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

🍰 🌮 🍉

@melekes melekes merged commit 5c6999c into tendermint:develop Oct 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants