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

serviceconfig: Return errors instead of skipping invalid retry policy config #7905

Merged
merged 2 commits into from
Dec 5, 2024

Conversation

dfawley
Copy link
Member

@dfawley dfawley commented Dec 5, 2024

According to A21 and A6, an invalid retry policy should result in full service config rejection instead of just skipping the policy. This is a behavior change but also a bug fix.

RELEASE NOTES:

  • client: reject service configs containing an invalid retryPolicy in accordance with gRFCs A21 and A6. Note that it is possible this is a breaking change for some users using an invalid configuration, but continuing to allow this behavior would violate our cross-language compatibility requirements.

@dfawley dfawley added the Type: Behavior Change Behavior changes not categorized as bugs label Dec 5, 2024
@dfawley dfawley added this to the 1.70 Release milestone Dec 5, 2024
@dfawley dfawley requested a review from easwars December 5, 2024 22:00
@@ -278,8 +278,7 @@ func convertRetryPolicy(jrp *jsonRetryPolicy, maxAttempts int) (p *internalservi
jrp.MaxBackoff <= 0 ||
jrp.BackoffMultiplier <= 0 ||
len(jrp.RetryableStatusCodes) == 0 {
logger.Warningf("grpc: ignoring retry policy %v due to illegal configuration", jrp)
return nil, nil
return nil, fmt.Errorf("invalid retry policy (%v): ", jrp)
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this is existing code, but this seems to violate the style guide and is clearly hard to read given that the return statement is indented at the same width corresponding to the above conditional. See: go/go-style/decisions#conditional-formatting

Could we just move all the conditions into a single line?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, should we use pretty.JSON or a different formatting directive like %+v or %#v?

Comment on lines 477 to 488
scjs: `{
"methodConfig": [{
"name": [{"service": "foo"}],
"retryPolicy": {
"maxAttempts": 2,
"initialBackoff": "2s",
"maxBackoff": "10s",
"backoffMultiplier": 2,
"retryableStatusCodes": ["UNAVAILABLE"]
}
}]
}`,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we have this indented like how it is in other subtests.

"retryableStatusCodes": ["UNAVAILABLE"]
}
}]
}`, wantErr: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Here and elsewhere, can we have wantErr on a separate line so that it is more readily visible.

Copy link

codecov bot commented Dec 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.07%. Comparing base (645aadf) to head (ea725f5).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #7905   +/-   ##
=======================================
  Coverage   82.07%   82.07%           
=======================================
  Files         377      377           
  Lines       38179    38180    +1     
=======================================
+ Hits        31335    31336    +1     
- Misses       5545     5547    +2     
+ Partials     1299     1297    -2     
Files with missing lines Coverage Δ
service_config.go 86.39% <100.00%> (+4.84%) ⬆️

... and 21 files with indirect coverage changes

@dfawley dfawley merged commit f53724d into grpc:master Dec 5, 2024
15 checks passed
@dfawley dfawley deleted the scval branch December 5, 2024 23:16
purnesh42H pushed a commit to purnesh42H/grpc-go that referenced this pull request Dec 18, 2024
tpapagian added a commit to cilium/tetragon that referenced this pull request Jan 24, 2025
grpc/grpc-go#7905 requires that the number of retres
to greater than 1. This is part of google.golang.org/[email protected] and this
update makes tests to fail.

Signed-off-by: Anastasios Papagiannis <[email protected]>
tpapagian added a commit to cilium/tetragon that referenced this pull request Jan 24, 2025
grpc/grpc-go#7905 requires that the number of retres
to greater than 1. This is part of google.golang.org/[email protected] and this
update makes tests to fail.

Signed-off-by: Anastasios Papagiannis <[email protected]>
olsajiri added a commit to cilium/tetragon that referenced this pull request Jan 24, 2025
The grpc update to v1.70.0 and especially [1] requires retries to be > 1
in order to have a valid retry policy.

As we already do +1 later, let's set the default to 1.

[1] grpc/grpc-go#7905
Suggested-by: Anastasios Papagiannis <[email protected]>
Signed-off-by: Jiri Olsa <[email protected]>
olsajiri added a commit to cilium/tetragon that referenced this pull request Jan 24, 2025
The grpc update to v1.70.0 and especially [1] requires retries to be > 1
in order to have a valid retry policy.

As we already do +1 later, let's set the default to 1.

[1] grpc/grpc-go#7905
Suggested-by: Anastasios Papagiannis <[email protected]>
Signed-off-by: Jiri Olsa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Behavior Change Behavior changes not categorized as bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants