-
Notifications
You must be signed in to change notification settings - Fork 908
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
Issue 4134: Fixing memory leak error when using DirectEntryLogger #4135
Conversation
a6c92ed
to
6f7edcd
Compare
.../src/main/java/org/apache/bookkeeper/bookie/storage/directentrylogger/DirectEntryLogger.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a question about this change.
The issue is fixed by line_255, right? That means the entry logger file already be dirty.
If the code reaches line_266, the buf
should be null.
Yes it has been fixed by line_255, should I remove line_266? |
I think it can be removed. |
6f7edcd
to
28379ac
Compare
line_266 has been removed, thanks~ |
As I said, although this PR could fix the memory leak, the entry log file already be dirty, it can't read data correctly. There is an issue with the entry log file about dirty. #4040 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch !
.../src/main/java/org/apache/bookkeeper/bookie/storage/directentrylogger/DirectEntryLogger.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to move the ByteBuf out of the try-catch code block.
Fixed it |
…ache#4135) ### Motivation When we use DirectIO and a catch up read occurs, a memory leak occurs because the ByteBuf is not released. Because although in the `internalReadEntry` method in `DirectEntryLogger`, even if the upper layer `fillReadAheadCache` uses the `ReferenceCountUtil.release(entry)` method in the finally block to release ByteBuf, it will still cause an exception thrown by `internalReadEntry`, and the `entryLogger.readEntry` method happens to be in try. ..catch unexpected, causing ByteBuf to not be released correctly ### Changes Master Issue: apache#4134 (cherry picked from commit cc1c2e0)
…ache#4135) ### Motivation When we use DirectIO and a catch up read occurs, a memory leak occurs because the ByteBuf is not released. Because although in the `internalReadEntry` method in `DirectEntryLogger`, even if the upper layer `fillReadAheadCache` uses the `ReferenceCountUtil.release(entry)` method in the finally block to release ByteBuf, it will still cause an exception thrown by `internalReadEntry`, and the `entryLogger.readEntry` method happens to be in try. ..catch unexpected, causing ByteBuf to not be released correctly ### Changes Master Issue: apache#4134
Descriptions of the changes in this PR:
Motivation
When we use DirectIO and a catch up read occurs, a memory leak occurs because the ByteBuf is not released.
Because although in the
internalReadEntry
method inDirectEntryLogger
, even if the upper layerfillReadAheadCache
uses theReferenceCountUtil.release(entry)
method in the finally block to release ByteBuf, it will still cause an exception thrown byinternalReadEntry
, and theentryLogger.readEntry
method happens to be in try. ..catch unexpected, causing ByteBuf to not be released correctlyChanges
Master Issue: #4134