Commit 0326918
authored
fix: Set PooledConnectionLifetime for DNS re-resolution on long-lived connections (#17)
GrpcChannel.ForAddress creates long-lived HTTP/2 connections via
SocketsHttpHandler. By default, PooledConnectionLifetime is infinite,
meaning connections are never recycled and DNS is never re-resolved.
For clients connecting to load-balanced endpoints (e.g. AWS ALBs),
backend IPs can change while the HTTP/2 connection remains healthy,
leaving the client stuck on a stale IP.
Set PooledConnectionLifetime to 5 minutes so that connections are
periodically recycled, triggering fresh DNS resolution.1 parent 5fc6e77 commit 0326918
1 file changed
Lines changed: 12 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
60 | 65 | | |
61 | 66 | | |
62 | 67 | | |
| |||
74 | 79 | | |
75 | 80 | | |
76 | 81 | | |
77 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
78 | 88 | | |
79 | 89 | | |
80 | 90 | | |
| |||
0 commit comments