Skip to content

Fractions of a second are handled incorrectly when configuring gRPC service config durations - #51957

Merged
snicoll merged 2 commits into
spring-projects:4.1.xfrom
NotAFlightRisk:grpc-service-config-duration
Oct 7, 2026
Merged

snicoll merged 2 commits into
spring-projects:4.1.xfrom
NotAFlightRisk:grpc-service-config-duration

Conversation

@NotAFlightRisk

Copy link
Copy Markdown
Contributor

Durations in a channel's service-config get handed to gRPC as seconds, a dot, then the nanos, and the nanos aren't padded out to nine digits. So timeout: 50ms goes over as 0.50000000s and gRPC treats it as half a second. Same goes for any fraction under 100ms (1050ms comes out as 1.5s), and that's retry backoffs and hedging delays too.

They're zero-padded now. Locale.ROOT because %d follows the default locale's digits, and gRPC cant read Arabic or Persian ones. The retry test has a 50ms initial backoff instead of 1m, and fails without the fix.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue that has not yet been triaged. Contributions will not be accepted. label Oct 6, 2026
@wilkinsona wilkinsona changed the title Zero-pad nanos in gRPC service config durations Fractions of a second are handled incorrectly when configuring gRPC service config durations Oct 6, 2026
@wilkinsona wilkinsona added type: bug A general bug and removed status: waiting-for-triage An issue that has not yet been triaged. Contributions will not be accepted. labels Oct 6, 2026
@snicoll snicoll added this to the 4.1.x milestone Oct 6, 2026
@snicoll snicoll self-assigned this Oct 7, 2026
NotAFlightRisk and others added 2 commits October 7, 2026 15:49
See gh-51957

Signed-off-by: Iain <iain1970@protonmail.com>
Use the short "<seconds>s" format when nanos are equal to 0. This
prevents extra padding for the most frequent use case.

See gh-51957
@snicoll snicoll modified the milestones: 4.1.x, 4.1.2 Oct 7, 2026
@snicoll
snicoll force-pushed the grpc-service-config-duration branch from b70b577 to 5508957 Compare October 7, 2026 14:05
@snicoll
snicoll merged commit 20548c0 into spring-projects:4.1.x Oct 7, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug A general bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants