Use DeadlineExceeded error when creating stream failed by timeout #334

Merged
dstepanov-yadro merged 1 commit from dstepanov-yadro/frostfs-sdk-go:fix/api_client_timeout_error into master 2025-02-17 15:11:16 +00:00

According to https://pkg.go.dev/context#pkg-variables, context.Cancelled should be returned when the context is canceled for some reason other than its deadline passing. So creating gRPC stream with dial timeout fits better for context.DeadlineExceeded.

This also affects failover scenarios, as context.Cancelled does not lead to attempts to use other node addresses:

success := err == nil || errors.Is(err, context.Canceled) || errors.As(err, &siErr) || errors.As(err, &eiErr)

According to https://pkg.go.dev/context#pkg-variables, context.Cancelled should be returned when the context is canceled for some reason other than its deadline passing. So creating gRPC stream with dial timeout fits better for context.DeadlineExceeded. This also affects failover scenarios, as context.Cancelled does not lead to attempts to use other node addresses: https://git.frostfs.info/TrueCloudLab/frostfs-node/src/commit/fe0cf86dc681e221706d9dcb4b25413bfdf065e9/pkg/network/cache/multi.go#L187
dstepanov-yadro added 1 commit 2025-02-17 13:05:18 +00:00
[#9999] rpc: Use DeadlineExceeded error when creating stream failed by timeout
All checks were successful
DCO / DCO (pull_request) Successful in 29s
Code generation / Generate proto (pull_request) Successful in 36s
Tests and linters / Tests (pull_request) Successful in 48s
Tests and linters / Lint (pull_request) Successful in 1m35s
81bc841ba3
According to https://pkg.go.dev/context#pkg-variables, ContextCancelled
should be returned when the context is canceled for some reason other
than its deadline passing. So creating gRPC stream with dial timeout fits
better for context.DeadlineExceeded.

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
requested reviews from storage-core-committers, storage-core-developers, storage-services-committers, storage-services-developers 2025-02-17 13:05:18 +00:00
dstepanov-yadro force-pushed fix/api_client_timeout_error from 81bc841ba3 to 56892e48ac 2025-02-17 13:06:44 +00:00 Compare
a-savchuk approved these changes 2025-02-17 13:25:00 +00:00
achuprov approved these changes 2025-02-17 13:37:13 +00:00
acid-ant approved these changes 2025-02-17 13:38:11 +00:00
Author
Member
Also https://git.frostfs.info/TrueCloudLab/frostfs-node/pulls/1589#issuecomment-63706
aarifullin approved these changes 2025-02-17 15:10:41 +00:00
dstepanov-yadro merged commit 56892e48ac into master 2025-02-17 15:11:16 +00:00
dstepanov-yadro deleted branch fix/api_client_timeout_error 2025-02-17 15:11:18 +00:00
Sign in to join this conversation.
No reviewers
TrueCloudLab/storage-services-committers
TrueCloudLab/storage-services-developers
No milestone
No project
No assignees
5 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-sdk-go#334
No description provided.