-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Remove license state listeners on closables #36308
Remove license state listeners on closables #36308
Conversation
We have a few places where we register license state listeners on transient components (i.e., resources that can be open and closed during the lifecycle of the server). In one case (the opt-out query cache) we were never removing the registered listener, effectively a terrible memory leak. In another case, we were not un-registered the listener that we registered, since we were not referencing the same instance of Runnable. This commit does two things: - introduces a marker interface LicenseStateListener so that it is easier to identify these listeners in the codebase and avoid classes that need to register a license state listener from having to implement Runnable which carries a different semantic meaning than we want here - fixes the two places where we are currently leaking license state listeners
Pinging @elastic/es-security |
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.
LGTM, thanks @jasontedor
Oh, thanks @DaveCTurner, I had not seen those! I will add that to the top-level comment so they are closed when this is merged. |
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.
LGTM
@elasticmachine run gradle build tests 1 |
We have a few places where we register license state listeners on transient components (i.e., resources that can be open and closed during the lifecycle of the server). In one case (the opt-out query cache) we were never removing the registered listener, effectively a terrible memory leak. In another case, we were not un-registered the listener that we registered, since we were not referencing the same instance of Runnable. This commit does two things: - introduces a marker interface LicenseStateListener so that it is easier to identify these listeners in the codebase and avoid classes that need to register a license state listener from having to implement Runnable which carries a different semantic meaning than we want here - fixes the two places where we are currently leaking license state listeners
We have a few places where we register license state listeners on transient components (i.e., resources that can be open and closed during the lifecycle of the server). In one case (the opt-out query cache) we were never removing the registered listener, effectively a terrible memory leak. In another case, we were not un-registered the listener that we registered, since we were not referencing the same instance of Runnable. This commit does two things: - introduces a marker interface LicenseStateListener so that it is easier to identify these listeners in the codebase and avoid classes that need to register a license state listener from having to implement Runnable which carries a different semantic meaning than we want here - fixes the two places where we are currently leaking license state listeners
We have a few places where we register license state listeners on transient components (i.e., resources that can be open and closed during the lifecycle of the server). In one case (the opt-out query cache) we were never removing the registered listener, effectively a terrible memory leak. In another case, we were not un-registered the listener that we registered, since we were not referencing the same instance of Runnable. This commit does two things:
Relates #33328
Closes #35627
Closes #35628