-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
[Streaming] Results from nodes with streaming set header X-Consul-Knownleader: false #9776
Comments
This is not a real fix but will avoid breaking clients relying on this header Fix hashicorp#9776
This is not a real fix but will avoid breaking clients relying on this header Fix hashicorp#9776
@pierresouchay I encountered a situation in a very small production DC where I saw your issue and was curious if anyone else has seen the above behavior. |
@chuckyz Unlikely, in such case, the Consul agent does not return HTTP 500, it does return HTTP 200, but with such header wrongly set (which is interpreted by Orbitz as no-result). So, if you are sure it was an HTTP 500, it was not the same thing. You could have however hit another but fixed (in our case) by #9555 when a service is not changing too much (I mean less than every 10min), which is likely the case if you are using a vanilla Consul without any patch. See https://medium.com/criteo-engineering/consul-streaming-whats-behind-it-6f44f77a5175 |
This is not a real fix but will avoid breaking clients relying on this header Fix hashicorp#9776
Cross posting from #9778, The Consistency Modes docs for this header say:
A false value for this header does not mean "there is no leader", it simply means that the leader status was not verified. There are plenty of places where we return It does not seem appropriate to error when this header is false. |
Hello @dnephin , I highly disagree with your analysis of the doc and about who is wrong/right. From an implementor POV, this field means : the data you see is not correct, hence the choice of Orbitz to say: this data cannot be trusted. So it seems reasonable to make the choice of failing.
That's not my experience : it happens only IIRC where there are some calls to Consul Servers, even so, having this field set, from an implementor POV means don't trust this data. I think implementors of SDKs cannot be blamed for that, because it sounds reasonable. This field not being set in Consul internals is not an valid excuse IMHO. Either set it to true, either discard it. But having it false in API responses is a breaking change to me, blowing away existing semantics. It simply means that streaming breaks the API (and it did for us at large scale when I was working at Criteo) in some kind of subtle ways, and this is really dangerous. Cc @yfouquet |
I am not sure how it implies the data is incorrect. At most it seems like it could imply the data is maybe stale. It can't even say definitely if it is stale or not, because if the data hasn't changed on the leader it is not stale. I can definitely say that it is misleading in many cases. If any response is returned from the cache this value could be true, but the value in the cache could be up to 3 days old, so a leader could have been lost any time during those 3 days and it will still say I agree with you that subtle changes like this to the API are a problem. A safer approach would be to completely remove the header from the API entirely, since it can't be used safely. That would require a change to any SDK anyway, so probably ignoring the header for now is a good approach until it can be removed. |
This is not a real fix but will avoid breaking clients relying on this header Fix hashicorp#9776
When Streaming is running, the header
X-Consul-Knownleader: false
is set to false.Some SDKs such as Orbitz, use this field to throw an error, thus, it fails to retrieve data.
This header should be set to true with streaming activated
The text was updated successfully, but these errors were encountered: