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.
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
grpclb: include fallback reason in error status of failing to fallback #8035
grpclb: include fallback reason in error status of failing to fallback #8035
Changes from 1 commit
4558b74
1618401
177236b
c9bd7e1
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
This may not be UNAVAILABLE. We need to create a new Status.
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.
What about the
propagateError(error)
two lines above? I was wanting to delete that line. That line fails RPCs for a short time window between balancer RPC closed and trying fallback. Right after fallback is attempted, if failing to fallback, RPCs will change to fail withfallbackReason
(which is the same status for the balancer's failure plus a "fail to fallback" message).So I am wondering if we should remove the
propagateError(error)
line here and fall RPCs with a single status, after attempting fallback.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.
propagateError()
is called two places. On of them isn't as it seems.InetAddress.getByAddress()
only throws UnknownHostException "if IP address is of illegal length" so the error string "Host for server not found" is wrong.propagateError()
does two things: log and adjust the picker. For logging, we really want to log the original Status, soerror
here. But we can't useerror
directly for the picker, even if it is for a short period of time.That's a functional change, as you no longer cause failures if fallback succeeds. I don't think we'd chose the behavior based on what makes the implementation easiest. I think we want it to behave a certain way in this case. I thought grpclb was supposed to try fallback before failing RPCs, at least when starting up. I honestly don't know where to look up the expected behavior in this case.
Calling @markdroth to help inform us of when gRPC-LB should begin failing RPCs.
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.
I don't have enough context here to know which specific cases you're asking about.
In general, there are two types of grpclb fallback, fallback at startup and fallback after startup.
Fallback at startup is triggered in the following cases:
Fallback after startup occurs only after we receive an initial response from the balancer. It is triggered in the following cases:
None of these cases have anything to do with the status of individual data plane calls. However, there are two cases above where fallback is triggered by receiving status on the balancer call, but only when other conditions are also met.
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.
This still did not directly answer the question if we should fail RPCs before trying fallback. The specific case we are talking about is when the balancer RPC finishes (regardless of status) and none of the connections to any backends received previously has been READY. Do we fail RPCs immediately while trying to use fallback addresses (which implies RPCs may succeed back again if connections to fallback succeeds)? Or do we wait until fallback has been attempted?
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.
In the fallback-at-startup case, we should be in state CONNECTING until we either get connected or go into fallback mode, so we should not fail data plane RPCs until one of those two things happens.
In the fallback-after-startup case, the "get an explicit response from the balancer telling us go into fallback" case should not depend on whether there are currently any READY connections to balancer-given backends, since it's intended to force clients to go to fallback regardless of whether they are currently connected to backends, and you should fix your implementation if it's not doing that. Given that, there are several cases here:
@apolcyn may want to weigh in here as well.
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.
+1 to everything @markdroth just described.
Also note that go/grpclb-explicit-fallback describes the expected behavior of clients when receiving a fallback response from a balancer.
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.
I just realized that sounded similar to b/138458426. I had found a path through the code that could cause that but #6657 looked like it'd fix it. Maybe there was a second path through the code? And apparently Go might still have this problem?
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.
From the description of "the client enters transient failure because all subchannels are "connecting", and one has entered "transient failure", so the pending pick fails." in b/138458426#comment4, I'd suspect that was due to the issue described in #7959, which was fixed recently.
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.
Sorry sorry, what I mentioned in #8035 (comment) was wrong. Balancer forcing entering fallback is correct. It will stop using balancer-provided backends immediately, even if there are READY connections.
Actually our implementation looks fine for handling the grey area: