-
Notifications
You must be signed in to change notification settings - Fork 4
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
shared client: Fix global timeout not being respected #11
Conversation
This fixes a bug where the shared client did not respect `c.Client.Timeout`, resulting in DNS requests timing out too soon. A per Go docs, `Client.Timeout` is supposed to also apply to the write timeout. This is implemented in the regular client by using `Client.getTimeoutForRequest` to determine the actual timeout. This commit adapts the shared client code to do the same. Signed-off-by: Sebastian Wicki <sebastian@isovalent.com>
Not sure who owns this repo, so I've just added the few people who have contributed in the past |
Shouldn't that be something like this? |
Not sure what you are suggesting. Using |
Ah, I was referring to the fact that we are adding two timeouts there - one for write and the other for read, so in theory we should do the same here I think, no? |
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.
ok, nvm. This only applies to writing requests so it's fine.
I'm honestly not sure how to implement the read timeout with the shared client. The logic is very convoluted. The way I understand the code, the Line 294 in ee3124a
Is passed via Line 241 in ee3124a
Which then actually splits the passed in context into write and read timeouts. But I guess given the way it's implemented, if the write timeout is lower than the read timeout, then it will use our timeout created here as the read timeout too. |
I did do some local testing and at least with this patch, the library now does respect the 10 second timeout Cilium configures, rather than falling back on the default |
yup, makes sense, that is my understanding as well. |
This pulls in cilium/dns#11 which fixes a bug where the `SharedClient` logic did not respect the `c.Client.Timeout` field. Signed-off-by: Sebastian Wicki <sebastian@isovalent.com>
This pulls in cilium/dns#11 which fixes a bug where the `SharedClient` logic did not respect the `c.Client.Timeout` field. Signed-off-by: Sebastian Wicki <sebastian@isovalent.com>
[ upstream commit c76677d ] This pulls in cilium/dns#11 which fixes a bug where the `SharedClient` logic did not respect the `c.Client.Timeout` field. Signed-off-by: Sebastian Wicki <sebastian@isovalent.com>
[ upstream commit c76677d ] This pulls in cilium/dns#11 which fixes a bug where the `SharedClient` logic did not respect the `c.Client.Timeout` field. Signed-off-by: Sebastian Wicki <sebastian@isovalent.com>
[ upstream commit c76677d ] This pulls in cilium/dns#11 which fixes a bug where the `SharedClient` logic did not respect the `c.Client.Timeout` field. Signed-off-by: Sebastian Wicki <sebastian@isovalent.com>
[ upstream commit c76677d ] This pulls in cilium/dns#11 which fixes a bug where the `SharedClient` logic did not respect the `c.Client.Timeout` field. Signed-off-by: Sebastian Wicki <sebastian@isovalent.com>
[ upstream commit c76677d ] This pulls in cilium/dns#11 which fixes a bug where the `SharedClient` logic did not respect the `c.Client.Timeout` field. Signed-off-by: Sebastian Wicki <sebastian@isovalent.com>
[ upstream commit c76677d ] This pulls in cilium/dns#11 which fixes a bug where the `SharedClient` logic did not respect the `c.Client.Timeout` field. Signed-off-by: Sebastian Wicki <sebastian@isovalent.com>
This fixes a bug where the shared client did not respect
c.Client.Timeout
, resulting in DNS requests timing out too soon.A per Go docs,
Client.Timeout
is supposed to also apply to the write timeout. This is implemented in the regular client by usingClient.getTimeoutForRequest
to determine the actual timeout. This commit adapts the shared client code to do the same.Ref: cilium/cilium#31999