Skip to content

Enforce minimum DNS resolution interval#1272

Merged
Sushisource merged 2 commits into
temporalio:mainfrom
brucearctor:fix/dns-min-resolution-interval
May 14, 2026
Merged

Enforce minimum DNS resolution interval#1272
Sushisource merged 2 commits into
temporalio:mainfrom
brucearctor:fix/dns-min-resolution-interval

Conversation

@brucearctor

Copy link
Copy Markdown
Contributor

What

Adds validation to reject dns_load_balancing.resolution_interval values below 1 second.

Why

Without a floor, setting resolution_interval to Duration::ZERO causes spawn_dns_reresolution() to run a tight loop — tokio::time::sleep(Duration::ZERO) yields immediately, hammering DNS with unrestricted re-resolution.

How

  • Added a MIN_DNS_RESOLUTION_INTERVAL (1s) constant and a check in validate_and_get_dns_lb(), returning ClientConnectError::InvalidConfig for sub-minimum values. This follows the existing pattern for conflicting option validation in the same function.
  • Added two unit tests: one for Duration::ZERO, one for a sub-minimum value (500ms).

Fixes #1266

Reject dns_load_balancing.resolution_interval values below 1 second
in validate_and_get_dns_lb() to prevent a tight re-resolution loop
when set to Duration::ZERO.

Fixes temporalio#1266
@brucearctor
brucearctor requested a review from a team as a code owner May 14, 2026 03:32

@Sushisource Sushisource left a comment

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.

Thanks!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] DNS load balancer can be configured to run resolution interval at 0

2 participants