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
NIFI-6926: Fixed memory leak in NiFiAtlasHook #3915
Conversation
notificationSender.send(messages, this::notifyEntities); | ||
messages.clear(); |
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 fact that the send
method accepts a function makes me think that the send happens asynchronously. Are you sure that send
is a blocking method? If not, clearing the messages will cause a ConcurrentModificationException
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.
Good point, I've checked it now: the items from list are streamed / collected into other data structures at the beginning of send() and the list itself never used later, so it shouldn't be a problem.
Though, just to be on the safe side, I'll change it to create a new list after every commit.
Hello @turcsanyip I hope you will consider another solution: I have implemented this change with a |
@belugabehr Thanks for your suggestion and in a concurrent environment it would be perfect. |
@turcsanyip Thank you for the review! I actually liked your first solution of using |
@turcsanyip Also, does the list of messages need to be flushed in the |
@belugabehr Passing a copy and clear the list sounds reasonable, pls. check my last commit. Regarding flushing (calling commit) in Lines 218 to 223 in 41fef55
So even if close() gets called with uncommitted messages in the list, the next execution of the reporting task will continue where it left off and reloads the uncommitted messages from the provenance repository and process them again. The at-least-once delivery is guaranteed.If I understand correctly, this was your concern. |
@turcsanyip Yes. You understand my concern. Thanks for the collaboration and running down all of my concerns. Looks good to me. |
Thanks @turcsanyip for the PR! Thanks @belugabehr for the review! This has been merged to master. |
NIFI-6926: Use new instance of list instead of clearing it NIFI-6926: Logging the number of messages to be sent to Atlas. NIFI-6926: Pass a copy of the messages list to send() and clear the original list. This closes apache#3915
NIFI-6926: Use new instance of list instead of clearing it NIFI-6926: Logging the number of messages to be sent to Atlas. NIFI-6926: Pass a copy of the messages list to send() and clear the original list. This closes apache#3915
NIFI-6926: Use new instance of list instead of clearing it NIFI-6926: Logging the number of messages to be sent to Atlas. NIFI-6926: Pass a copy of the messages list to send() and clear the original list. This closes apache#3915
Thank you for submitting a contribution to Apache NiFi.
Please provide a short description of the PR here:
Description of PR
Enables X functionality; fixes bug NIFI-YYYY.
In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:
For all changes:
Is there a JIRA ticket associated with this PR? Is it referenced
in the commit message?
Does your PR title start with NIFI-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
Has your PR been rebased against the latest commit within the target branch (typically
master
)?Is your initial contribution a single, squashed commit? Additional commits in response to PR reviewer feedback should be made on this branch and pushed to allow change tracking. Do not
squash
or use--force
when pushing to allow for clean monitoring of changes.For code changes:
mvn -Pcontrib-check clean install
at the rootnifi
folder?LICENSE
file, including the mainLICENSE
file undernifi-assembly
?NOTICE
file, including the mainNOTICE
file found undernifi-assembly
?.displayName
in addition to .name (programmatic access) for each of the new properties?For documentation related changes:
Note:
Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.