Your go-to microservice framework for any situation, from the creator of Netty et al. You can build any type of microservice leveraging your favorite technologies, including gRPC, Thrift, Kotlin, Retrofit, Reactive Streams, Spring Boot and Dropwizard.
Normally, this isn't an issue since refreshEndpoints will be called after the call to updateEndpoints which will in turn complete the select call. However, XdsEndpointGroup is composed of multiple internal EndpointGroups and only selectNow is called. Because the initialization event is never propagated to the XdsEndpointSelector occasional failures can occur.
Motivation:
https://github.com/line/armeria/issues/5749
While re-investigating this issue, I found that the probably cause is the changes introduced by https://github.com/line/armeria/pull/5693
Previously, when
updateEndpoints
is called theendpointSelector
was initialized from the same threadhttps://github.com/line/armeria/blob/da7f76a7eebf9b03a51ff68a9245269eee4a5a6d/core/src/main/java/com/linecorp/armeria/client/endpoint/WeightRampingUpStrategy.java#L147-L150
However after the PR above,
updateEndpoints
doesn't update theendpointSelector
immediately and instead schedules an update taskhttps://github.com/line/armeria/blob/191fb7db981d1d47de8ce50be0b0f6d5d9dfa8ee/core/src/main/java/com/linecorp/armeria/client/endpoint/WeightRampingUpStrategy.java#L150
For this reason, even if
updateEndpoints
is called theendpointSelector
will remain as theEMPTY_SELECTOR
.https://github.com/line/armeria/blob/191fb7db981d1d47de8ce50be0b0f6d5d9dfa8ee/core/src/main/java/com/linecorp/armeria/client/endpoint/WeightRampingUpStrategy.java#L128
Normally, this isn't an issue since
refreshEndpoints
will be called after the call toupdateEndpoints
which will in turn complete theselect
call. However,XdsEndpointGroup
is composed of multiple internalEndpointGroup
s and onlyselectNow
is called. Because the initialization event is never propagated to theXdsEndpointSelector
occasional failures can occur.https://github.com/line/armeria/blob/191fb7db981d1d47de8ce50be0b0f6d5d9dfa8ee/xds/src/main/java/com/linecorp/armeria/xds/client/endpoint/DefaultLoadBalancer.java#L61-L84
Modifications:
updateEndpoints
Result:
WeightRampingUpStrategy
succeeds before the first call toupdateEndpoints
forXdsEndpointGroup
.