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

lease: fix memory leak in LeaseGrant #11731

Merged
merged 1 commit into from
Mar 29, 2020

Conversation

tangcong
Copy link
Contributor

@tangcong tangcong commented Mar 29, 2020

fix issue #11730 #11495

@tangcong
Copy link
Contributor Author

tangcong commented Mar 29, 2020

leader can call leaseExpiredNotifier.Unregister() to pop item when lessor is revoked, but follower node has no way to pop it. it is not necessary to register it into the queue when lessor is not primary. if leader change, promote method can rebuild it in new leader and demote method can clear leaseExpiredNotifier in old leader.
other methods,it can also solve issues by removing item from leaseExpiredNotifier when executing lease revoking commands.

@codecov-io
Copy link

codecov-io commented Mar 29, 2020

Codecov Report

Merging #11731 into master will decrease coverage by 0.38%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #11731      +/-   ##
==========================================
- Coverage   66.58%   66.19%   -0.39%     
==========================================
  Files         403      403              
  Lines       36763    36787      +24     
==========================================
- Hits        24477    24351     -126     
- Misses      10779    10942     +163     
+ Partials     1507     1494      -13     
Impacted Files Coverage Δ
lease/lessor.go 88.00% <100.00%> (+0.08%) ⬆️
auth/store.go 52.61% <0.00%> (-22.78%) ⬇️
client/client.go 69.60% <0.00%> (-14.38%) ⬇️
proxy/grpcproxy/register.go 72.50% <0.00%> (-10.00%) ⬇️
clientv3/concurrency/election.go 79.68% <0.00%> (-2.35%) ⬇️
clientv3/maintenance.go 40.81% <0.00%> (-2.05%) ⬇️
etcdserver/api/v3rpc/watch.go 85.61% <0.00%> (-1.41%) ⬇️
etcdserver/cluster_util.go 64.18% <0.00%> (-0.94%) ⬇️
proxy/grpcproxy/lease.go 79.18% <0.00%> (-0.91%) ⬇️
clientv3/watch.go 90.60% <0.00%> (-0.84%) ⬇️
... and 15 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3ac7a11...b1da829. Read the comment docs.

@tangcong tangcong force-pushed the fix-lease-memory-leak branch from 855d492 to b1da829 Compare March 29, 2020 02:15
@tangcong tangcong changed the title lease: fix memory leak in LeaseGrant when node is follower lease: fix memory leak in LeaseGrant Mar 29, 2020
Copy link
Contributor

@gyuho gyuho left a comment

Choose a reason for hiding this comment

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

great find. thanks for the fix

@gyuho gyuho merged commit 2ffbde8 into etcd-io:master Mar 29, 2020
@tangcong tangcong deleted the fix-lease-memory-leak branch February 26, 2021 18:59
@ahrtr
Copy link
Member

ahrtr commented Mar 24, 2021

The fix is included in v3.4.6 (2020-03-29).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants