-
Notifications
You must be signed in to change notification settings - Fork 164
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
GH-5159 close child of GroupIterator #5160
GH-5159 close child of GroupIterator #5160
Conversation
try { | ||
cf.close(); | ||
} finally { | ||
argumentsIter.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.
Looks like you need to add:
var argumentsIter = this.argumentsIter;
if(argumentsIter != null) argumentsIter.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.
Obviously! Thanks Håvard.
Thanks for this fix. Very good catch and a nice and clean solution! |
Yes, that's good to add. |
9f6e7e9
to
6d97c2a
Compare
LGTM! thank you @frensjan |
cf.close(); | ||
} finally { | ||
if (argumentsIter != null) { | ||
argumentsIter.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.
Cant argumentsIter still be null? It could be set to null between this line and the null check above.
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.
Yes, indeed. Missed that in your initial comment.
iteratorThread.start(); | ||
assertThat(iterating.await(5, TimeUnit.SECONDS)).isTrue(); | ||
groupIterator.close(); | ||
assertThat(closed.await(5, TimeUnit.SECONDS)).isTrue(); |
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.
Can we also assert that the iteratorThread is no longer alive? So we are sure that we're not leaking a thread.
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.
The test was in fact leaking a Thread. Just fixed it.
6d97c2a
to
c58c287
Compare
c58c287
to
384d1b5
Compare
Thanks @frensjan ! I've merged the PR and it'll ve part of the next bug fix release which is due any day now. |
GitHub issue resolved: #5159
Briefly describe the changes proposed in this PR:
I've added the child argument's iterator as (volatile) field in the GroupIterator so that it can be closed while building entires.
PR Author Checklist (see the contributor guidelines for more details):
mvn process-resources
to format from the command line)