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

backoff times must be integer values despite documentation saying otherwise #36638

Closed
sand7000 opened this issue May 16, 2024 · 2 comments
Closed

Comments

@sand7000
Copy link

What version of gRPC and what language are you using?

grpcio 1.62.1
grpcio-tools 1.62.1

What operating system (Linux, Windows,...) and version?

ubuntu 22

What runtime / compiler are you using (e.g. python version or version of gcc)

Python 3.10.12

What did you do?

I set the options for my insecure channel like this:

service_config_json = json.dumps(
    {
        "methodConfig": [
            {
                # To apply retry to all methods, put [{}] in the "name" field
                "name": [
                    {"service": "helloworld.Greeter", "method": "SayHello"}
                ],
                "retryPolicy": {
                    "maxAttempts": 5,
                    "initialBackoff": "0.01s",
                    "maxBackoff": "0.06s",
                    "backoffMultiplier": 1.5,
                    "retryableStatusCodes": ["UNAVAILABLE"],
                },
            }
        ]
    }
)

I see the error:

INVALID_ARGUMENT: errors validating service config: [field:methodConfig[0].retryPolicy.initialBackoff error:Not a duration (not a number of seconds); field:methodConfig[0].retryPolicy.maxBackoff error:Not a duration (not a number of seconds)]

I tried several values for initialBackoff and only integer values run without error. This contradicts this provided example:

https://github.com/grpc/grpc/blob/master/examples/python/retry/retry_client.py

@gnossen
Copy link
Contributor

gnossen commented May 16, 2024

Hi @sand7000 . Thanks for the report!

We can't actually reproduce on our end -- non-integers work just fine with this example. In fact, by copy-pasting your json above, it still works. I'm wondering if you have a weird character accidentally added. For example, if a zero-width space ends up in your duration string somehow, this is the error you will see. Please take another look and see if there are weird characters hanging around.

@sand7000
Copy link
Author

Verified and corrected. Thanks very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants