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

fix(dns): resolv.conf options timeout: 0 is ignored #12640

Merged
merged 1 commit into from
Mar 13, 2024

Conversation

bungle
Copy link
Member

@bungle bungle commented Feb 26, 2024

Summary

The options timeout: 0 has a specific meaning in resolv.conf. It means that the request will be sent to all nameservers without waiting and whoever answers first, will be accepted.

In Kong the options timeout: 0 cause actually all the DNS queries themselves to timeout. This is bad as some platforms tend to follow options timeout: 0 as a good practice when having more than one resolver.

Kong should in future support parallel thread based resolving from multiple resolvers, but first we need to get this fix to stop it causing issues.

Checklist

  • The Pull Request has tests
  • A changelog file has been created under changelog/unreleased/kong or skip-changelog label added on PR if changelog is unnecessary. README.md
  • There is a user-facing docs PR against https://github.com/Kong/docs.konghq.com - PUT DOCS PR HERE

Fix FTI-5791

@bungle bungle force-pushed the fix/dns-client-options-timeout branch from 651b44c to 2ec79ab Compare February 26, 2024 17:22
@bungle bungle requested a review from chobits February 26, 2024 17:23
kong/resty/dns/client.lua Outdated Show resolved Hide resolved
@chobits chobits requested a review from outsinre February 27, 2024 02:16
@chobits chobits force-pushed the fix/dns-client-options-timeout branch from 2ec79ab to 5f2324b Compare February 27, 2024 02:19
@bungle bungle force-pushed the fix/dns-client-options-timeout branch from aa0c3fb to a23379f Compare February 27, 2024 16:19
@chobits chobits force-pushed the fix/dns-client-options-timeout branch from a23379f to 3796a6b Compare February 28, 2024 02:24
Copy link
Contributor

@outsinre outsinre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with misc notes.

@chobits chobits force-pushed the fix/dns-client-options-timeout branch from 3796a6b to 9fcb019 Compare March 6, 2024 02:10
@windmgc
Copy link
Member

windmgc commented Mar 6, 2024

Just out of curiosity, is there any doc describing the special behaviour of options timeout: 0 in /etc/resolv.conf?
I tried searching but could not find anything useful, except an anonymous user answer

@outsinre outsinre force-pushed the fix/dns-client-options-timeout branch from 9fcb019 to 9ed3a29 Compare March 6, 2024 08:39
@outsinre
Copy link
Contributor

outsinre commented Mar 7, 2024

Seems different implementations behave not exactly the same. Regarding Kong DNS, reset 0 to default timeout 2000ms is reasonable, before we support concurrently resolve against multiple nameservers.

@bungle bungle added the cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee label Mar 13, 2024
### Summary

The `options timeout: 0` has a specific meaning in `resolv.conf`. It means that the request
will be sent to all nameservers without waiting and whoever answers first, will be accepted.

In Kong the `options timeout: 0` cause actually all the DNS queries themselves to timeout.
This is bad as some platforms tend to follow `options timeout: 0` as a good practice when
having more than one resolver.

Kong should in future support parallel thread based resolving from multiple resolvers,
but first we need to get this fix to stop it causing issues.

Signed-off-by: Aapo Talvensaari <[email protected]>
@bungle bungle force-pushed the fix/dns-client-options-timeout branch from 352e16b to 43fa876 Compare March 13, 2024 14:19
@bungle bungle merged commit cea6f24 into master Mar 13, 2024
26 checks passed
@bungle bungle deleted the fix/dns-client-options-timeout branch March 13, 2024 14:40
@team-gateway-bot
Copy link
Collaborator

Successfully created cherry-pick PR for master:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants