xdsclient: do not process updates from closed server channels #8389
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The xDS client is currently making an incorrect assumption that can lead to panics.
When an xDS client authority receives a response from a server, it checks to see if the response is from the currently active channel. If not, it assumes that it is from a higher priority server (because when a response is received from a server, all lower priority servers are closed), and therefore expects that a channel to that server exists. This need not be true because the responses are not handled inline, but are handled in the serializer. Here is a possible sequence:
A, B, C
(in priority order).A
andB
are DOWN, andC
is UP. Therefore the active channel is nowC
.T0
, the authority receives a message from serverB
. This is not handled inline, but is queued in the serializer for handling.T1
, the authority receives a message from serverC
. This is not handled inline, but is queued in the serializer for handling.T2
, the serializer handles the message from serverB
and as part of this handling, releases the reference to serverC
as it has now seen a response from a higher priority server. Also, the active channel now becomesB
.T3
, the serializer handles the message from serverC
, and implicitly (wrongly) assumes that since it is not from the currently active channelB
, it must be from a higher priority server and expects a channel to be present for that server.This fix ensures what when the authority receives a response from a server that is not currently the active channel, it must ensure that it is from a higher priority server before proceeding with handling that response. If it is not from a higher priority server, it should drop the response on the floor and move on.
RELEASE NOTES: