-
Notifications
You must be signed in to change notification settings - Fork 484
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
HDDS-10134. ManagedReadOptions is not closed properly #6013
Conversation
Is the error happening with the latest code on master? I don't think we're comfortable not understanding how this happens, tbh (I tried, but I couldn't comprehend it either). Also, is there a full log file of the test failure? There may be something else, e.g. error closing the resource. |
Yes.
Attached to HDDS-10134. I don't see any errors in it, but please double-check. |
I suspect the case is in Lines 33 to 36 in 737598c
If |
@adoroszlai , are we able to reproduce the failure by repeatedly running it? If yes, we can test whether |
Thanks @szetszwo for the idea about try-finally, I'll add it. I was not able to reproduce the problem yet by repeated runs. |
Updated the PR to ensure The original change (to keep |
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.
+1 the change looks good.
Thanks @duongkame, @szetszwo for the review. |
try { | ||
super.close(); | ||
} finally { | ||
leakTracker.close(); |
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.
Sorry for the late comment @adoroszlai. We could've just put leakTracker before the main close
. This would mean that leakTracker is meant to track if resource closure is invoked by the application code, regardless of the result (success or failure).
public void close() {
leakTracker.close();
super.close();
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.
Thanks @duongkame for the suggestion. I had the same idea, but preferred the one in the PR: a problem in leakTracker.close()
might prevent release of the underlying (real) resource. try-finally
is not that much more complex.
(cherry picked from commit 0fa0671)
What changes were proposed in this pull request?
RocksDatabase.newIterator(ColumnFamily, boolean)
returns an iterator whosereadOptions
is closed right after creating the iterator. This seems wrong, since closing it invalidates the native handle. I'm not sure how this can result in leakage of thereadOptions
object as reported by the leak detector:from:
This patch proposes to keep track of the
ReadOptions
(and possibly other objects, e.g. lower/upper boundarySlice
) with theManagedIterator
, and close them at the same time when the iterator is closed.https://issues.apache.org/jira/browse/HDDS-10134
How was this patch tested?
TestRootedDDSWithFSO
passed in 10x10 runs (but it also passed withmaster
, so more repetitions may be needed).Regular CI:
https://github.com/adoroszlai/ozone/actions/runs/7539928782