clientv3: don't log warn/error for expected context cancellation on shutdown#21739
clientv3: don't log warn/error for expected context cancellation on shutdown#21739c-tonneslan wants to merge 1 commit into
Conversation
|
Hi @c-tonneslan. Thanks for your PR. I'm waiting for a etcd-io member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
…hutdown When client.Close() is called, the context gets canceled and any in-flight or retried calls fail with codes.Canceled. This is expected, but the retry interceptor was logging these as Warn/Error: - "retrying of unary invoker failed" (Warn) - "clientv3/retry_interceptor: getToken failed" (Error) - "streamer failed to create ClientStream" (Error) These log entries fire during normal shutdown and aren't actionable, just noise. Fix by checking if the parent context is already done before logging. If it is, the cancellation is expected and we skip the log. If it isn't, it's a real failure and we still log at the original level. Fixes etcd-io#21643 Signed-off-by: Charlie Tonneslan <cst0520@gmail.com>
b0c105d to
d9ade6c
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: c-tonneslan The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Fixes #21643
When
client.Close()is called, the context gets canceled and any in-flight or retried calls fail withcodes.Canceled. This is completely expected, but the retry interceptor was logging these at Warn/Error level:These entries fire during normal application shutdown and aren't actionable. Three changes:
"retrying of unary invoker failed"(Warn): move theisContextErrorcheck before the log. If the parent context is done, return immediately without logging. If it's a call-level context timeout, continue retrying without logging (it's already retried). Only log Warn for genuine non-context errors."getToken failed"(Error): skip the Error log if the error is a context error and the parent context is already canceled."streamer failed to create ClientStream"(Error): same treatment.The behavior for actual failures (non-context errors) is unchanged.