Connection timeout vs Deadline
- Dominant language
- C#
- Stars
- 4.5k
- Forks
- 836
- Avg merge
- 6d 3h
- Merged PRs (30d)
- 7
Description
Hello,
How can I configure socket connection timeout for grpc client?
If grpc server is down the connection will timeout after some time, according my measurements it is almost 23sec.
If I setup Deadline < 23sec the gRPC client call will return RpcException with `DeadlineExceeded` status code.
(Deadline = 22sec in this example)

If I setup Deadline >= 23sec the gRPC client call will return `Unavailable` status code.
(Deadline = 23sec in this example)

I need to control also socket connection timeout in order to get always the same behavior. Right now I get 2 different RpcExceptions based on Deadline.
This is my grpc client registration.
```csharp
serviceCollection
.AddGrpcClient(option =>
{
option.Address = new Uri(configuration.EndpointAddress);
option.CallOptionsActions.Add(ctx =>
ctx.CallOptions =
ctx.CallOptions
.WithDeadline(DateTime.UtcNow.Add(configuration.Deadline)))
;
})
```
Contributor guide
Research direction
Start with the gRPC client registration shown in the issue and investigate how connection timeout and CallOptions deadlines interact when the server is unavailable. The issue names no repository files or tests, so first identify the relevant client transport configuration and existing coverage, then determine whether consistent RpcException behavior is documented or reproducible.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100