Skip to content

core: add perAttemptRecvTimeout to retry policy - #8301

Merged
dapengzhang0 merged 2 commits into
grpc:masterfrom
dapengzhang0:per-try-timeout
Jul 12, 2021
Merged

core: add perAttemptRecvTimeout to retry policy#8301
dapengzhang0 merged 2 commits into
grpc:masterfrom
dapengzhang0:per-try-timeout

Conversation

@dapengzhang0

Copy link
Copy Markdown
Contributor

No description provided.

@dapengzhang0

Copy link
Copy Markdown
Contributor Author

cc @ericgribkoff

Set<Code> retryableCodes =
ServiceConfigUtil.getRetryableStatusCodesFromRetryPolicy(retryPolicy);
checkArgument(
perAttemptRecvTimeout != null || !retryableCodes.isEmpty(),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No new tests? Seems we need tests for these cases.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Why do we need tests for assertions. They will throw if the app is in wrong state and people will notice.

@dapengzhang0 dapengzhang0 Jul 2, 2021

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Say if I had a bug here and the code is like

checkArgument(
     perAttemptRecvTimeout != null && !retryableCodes.isEmpty()

with && not ||. Then existing code going through this code path would throw.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Then existing code going through this code path would throw.

The unit tests don't look like they would fail. If we can pass one or the other, it seems there should be tests for passing one or the other. I wouldn't be such a stickler but this is for service config and a bug in the logic can poison the well.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

Comment thread core/src/main/java/io/grpc/internal/ServiceConfigUtil.java
}

// For now we allow perAttemptRecvTimeout being zero although it does not make sense.
// TODO(zdapeng): disallow zero perAttemptRecvTimeout if hedging is not enabled once we support

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Once retries are no longer experimental, we can't be adding a restriction. Right? And it sounded like your plan was to try to get retries stable here before supporting hedging.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Once retries are no longer experimental, we can't be adding a restriction. Right?

That's right.

And it sounded like your plan was to try to get retries stable here before supporting hedging.

Why? I'm not.

I'm currently allowing zero perAttemptRecvTimeout, because in the future, we have usecase for hedging.
Once hedge_on_per_try_timeout is supported, we will add restriction for zero perAttemptRecvTimeout without hedge_on_per_try_timeout=true. The planned change is still before getting retries stable.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Oh, I see.

@dapengzhang0
dapengzhang0 merged commit 4429ec2 into grpc:master Jul 12, 2021
@dapengzhang0
dapengzhang0 deleted the per-try-timeout branch July 12, 2021 21:53
YifeiZhuang pushed a commit to YifeiZhuang/grpc-java that referenced this pull request Jul 25, 2021
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Oct 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants