-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Safely register ClusterStateListener #38560
Labels
:Core/Infra/Core
Core issues without another label
help wanted
adoptme
Meta
>refactoring
Team:Core/Infra
Meta label for core/infra team
v8.15.0
Comments
Pinging @elastic/es-core-infra |
talevy
added a commit
to talevy/elasticsearch
that referenced
this issue
Aug 13, 2019
These two classes were leaking a reference to themselves when adding themselves as listeners to the cluster service prior to being completely initialized these two instances were fixed by leveraging doStart/doStop to represent start/stop lifecycle points for when these objects are registered listeners. Relates elastic#38560
Pinging @elastic/es-core-infra (Team:Core/Infra) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
:Core/Infra/Core
Core issues without another label
help wanted
adoptme
Meta
>refactoring
Team:Core/Infra
Meta label for core/infra team
v8.15.0
This is a follow up from #37861 discussed on core-infra sync meeting on 6th of Feb19 . See the original issue for reasoning behind this.
The goal is to find usages of
ClusterStateListener
and make sure it is not publishing itsthis
reference during construction. There might be multiple possible ways to fix that.The easiest fix is to just extract a factory method. However when there is multiple overloaded constructors, it might be tempted to remove the ClusterService parameter and register in a place where the instance is created.
In some cases where constructor parameters are provided with
@Inject
the registration could be done inAbstractLifecycleComponent.start/doStart
.Or refactored to factory method with @Inject (that annotation might work with methods, although couldn't find usages.
AbstractLifecycleComponent.doStart
The text was updated successfully, but these errors were encountered: