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

Fix ByteBuf memory leak problem when setExplicitLac #3577

Merged
merged 4 commits into from
Nov 1, 2022

Conversation

wenbingshen
Copy link
Member

Motivation

org.apache.bookkeeper.bookie.BookieImpl#setExplicitLac did not release the reference to the entry at the end.

@wenbingshen
Copy link
Member Author

ping @dlg99 @eolivelli @hangc0276 @zymap PTAL. Thanks.

Copy link
Contributor

@hangc0276 hangc0276 left a comment

Choose a reason for hiding this comment

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

@wenbingshen Would you please add a test to cover it?

@wenbingshen
Copy link
Member Author

@wenbingshen Would you please add a test to cover it?

@hangc0276 Okay. I will add a test later. Thanks.

@wenbingshen
Copy link
Member Author

@hangc0276 I have added an unit test. PTAL. Thanks.
When I apply the changes from this PR, the tests pass:
image

When I roll back the changes from this PR, the test fails:
image

The effect is as expected.

@wenbingshen wenbingshen changed the title Fix set explicitLac no released entry Fix ByteBuf memory leak problem when setExplicitLac Oct 27, 2022
Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

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

Great work

Copy link
Contributor

@hangc0276 hangc0276 left a comment

Choose a reason for hiding this comment

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

Nice work!

Copy link
Contributor

@StevenLuMT StevenLuMT left a comment

Choose a reason for hiding this comment

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

I think we can update the other old code to replace entry.release() to ReferenceCountUtil.safeRelease(entry)

or else I pick up a new pr to do this ? have a look this @hangc0276 @eolivelli @dlg99 @shoothzj

@zymap
Copy link
Member

zymap commented Oct 31, 2022

@StevenLuMT I think we could use another PR to resolve that.

@wenbingshen
Copy link
Member Author

@StevenLuMT I think we could use another PR to resolve that.

I agree.

@wenbingshen
Copy link
Member Author

@StevenLuMT PTAL. Thanks.

Copy link
Contributor

@StevenLuMT StevenLuMT left a comment

Choose a reason for hiding this comment

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

LGTM

@StevenLuMT StevenLuMT merged commit faaf041 into apache:master Nov 1, 2022
@wenbingshen wenbingshen deleted the FixSetExplicitLacMemLeak branch November 2, 2022 02:37
zymap pushed a commit that referenced this pull request Nov 3, 2022
* fix set explicitLac no released entry

(cherry picked from commit faaf041)
@hangc0276
Copy link
Contributor

@wenbingshen It's hard to cherry-pick this pr to branch-4.14, would you please push a separate Pr to branch-4.14? thanks

@wenbingshen
Copy link
Member Author

wenbingshen commented Nov 7, 2022

@wenbingshen It's hard to cherry-pick this pr to branch-4.14, would you please push a separate Pr to branch-4.14? thanks

@hangc0276 Okay. I will push a pr to 4.14 today.

yaalsn pushed a commit to yaalsn/bookkeeper that referenced this pull request Jan 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants