Skip to content
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

Return clear dial errors #445

Merged
merged 3 commits into from
Feb 28, 2024
Merged

Return clear dial errors #445

merged 3 commits into from
Feb 28, 2024

Conversation

cthulhu-rider
Copy link
Contributor

No description provided.

Copy link

codecov bot commented Feb 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 51.70%. Comparing base (fb2ed14) to head (e99341f).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #445      +/-   ##
==========================================
+ Coverage   51.65%   51.70%   +0.05%     
==========================================
  Files         159      159              
  Lines       19840    19841       +1     
==========================================
+ Hits        10248    10259      +11     
+ Misses       8820     8807      -13     
- Partials      772      775       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

cthulhu-rider added a commit to nspcc-dev/neofs-sdk-go that referenced this pull request Feb 28, 2024
Fix came from nspcc-dev/neofs-api-go#445 for the
problem described in nspcc-dev/neofs-node#2561.
Фlso now any irreparable errors like invalid address will be returned
immediately, not upon reaching the deadline.

Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
cthulhu-rider added a commit to nspcc-dev/neofs-sdk-go that referenced this pull request Feb 28, 2024
Fix came from nspcc-dev/neofs-api-go#445 for the
problem described in nspcc-dev/neofs-node#2561.
Фlso now any irreparable errors (like invalid net address or TLS
handshake) will be returned immediately, not upon reaching the deadline.

Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
rpc/client/connect.go Outdated Show resolved Hide resolved
@cthulhu-rider cthulhu-rider force-pushed the client-ret-conn-error branch 2 times, most recently from 9392e16 to 2844227 Compare February 28, 2024 12:16
rpc/client/connect.go Outdated Show resolved Hide resolved
Inspired by nspcc-dev/neofs-node#2561.

Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
Since 2b89b7e, RPC client used
`grpc.WithBlock` option to dial the server. This option make dialer to
return either `nil` or `context.DeadlineExceeded` errors, with any
connection error resulting in the latter. In particular, TLS handshake
failures were shadowed by deadline error.

Now `WithReturnConnectionError` option is used instead:
 * it still blocks similar to `WithBlock`;
 * it adds connection failure to the deadline error.

As a result, TLS unit test passes now. This should fix the problem
originally posted in nspcc-dev/neofs-node#2561.

Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
Previously, RPC client unconditionally blocked by context passed into
`WithContext` (e.g. for 15s). In particular, it definitely stuck on
non-temporary error encounter. An example of such errors could be an
incorrect network address or connection refusal.

Now client instantly fails with any irreparable error in which it is
pointless to wait for a change in the connection state. This is achieved
with `grpcstd.FailOnNonTempDialError(true)` option.

Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
Copy link
Member

@carpawell carpawell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you found what exact reason of behavior changes is? It is just WithBlock? We did not use it in v0.32.0 but used in 0.33.0?

@roman-khimov roman-khimov merged commit cb87bbd into master Feb 28, 2024
7 checks passed
@roman-khimov roman-khimov deleted the client-ret-conn-error branch February 28, 2024 16:32
@cthulhu-rider
Copy link
Contributor Author

It is just WithBlock?

yes it is. Unit test emulates problem behavior. Explained in the commit

cthulhu-rider added a commit to nspcc-dev/neofs-sdk-go that referenced this pull request Feb 28, 2024
Fix came from nspcc-dev/neofs-api-go#445 for the
problem described in nspcc-dev/neofs-node#2561.
Фlso now any irreparable errors (like invalid net address or TLS
handshake) will be returned immediately, not upon reaching the deadline.

Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
cthulhu-rider added a commit to nspcc-dev/neofs-sdk-go that referenced this pull request Feb 28, 2024
Fix came from nspcc-dev/neofs-api-go#445 for the
problem described in nspcc-dev/neofs-node#2561.
Also now any irreparable errors (like invalid net address or TLS
handshake) will be returned immediately, not upon reaching the deadline.

Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants