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

dns: restore dns query cache ttl #57640

Merged

Conversation

Ethan-Arrowood
Copy link
Contributor

@Ethan-Arrowood Ethan-Arrowood commented Mar 26, 2025

Fixes: #57636

When c-ares was updated the default caching behavior changed.

As of c-ares 1.31.0, the query cache is enabled by default with a TTL of 1hr. To disable the query cache, specify this option with a TTL of 0. The query cache is based on the returned TTL in the DNS message.

This PR restores the caching behavior by setting qcache_max_ttl to 0.

This change in c-ares is reasonable; thus, as a follow up to this fix, we should implement a cache management API for DNS queries and then re-enable the new default cache value. Tracking issue for follow up work: #57641

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. cares Issues and PRs related to the c-ares dependency or the cares_wrap binding. needs-ci PRs that need a full CI run. labels Mar 26, 2025
Fixes: nodejs#57636

Co-authored-by: Robert Nagy <ronagy@icloud.com>
@Ethan-Arrowood Ethan-Arrowood force-pushed the fix-dns-resolve-cache branch from da48077 to 61f93c1 Compare March 26, 2025 17:47
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

Can you open the follow-up issue to track that work?

Copy link

codecov bot commented Mar 26, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.22%. Comparing base (1123585) to head (61f93c1).
Report is 77 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #57640      +/-   ##
==========================================
- Coverage   90.22%   90.22%   -0.01%     
==========================================
  Files         630      630              
  Lines      185055   185056       +1     
  Branches    36216    36218       +2     
==========================================
- Hits       166975   166963      -12     
- Misses      11042    11047       +5     
- Partials     7038     7046       +8     
Files with missing lines Coverage Δ
src/cares_wrap.cc 63.05% <100.00%> (+0.02%) ⬆️

... and 21 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Ethan-Arrowood Ethan-Arrowood added the request-ci Add this label to start a Jenkins CI on a PR. label Mar 26, 2025
@Ethan-Arrowood Ethan-Arrowood added backport-requested-v20.x PRs awaiting manual backport to the v20.x-staging branch. backport-requested-v22.x PRs awaiting manual backport to the v22.x-staging branch. backport-requested-v23.x PRs awaiting manual backport to the v23.x-staging branch. backport-requested-v24.x PRs awaiting manual backport to the v24.x-staging branch. author ready PRs that have at least one approval, no pending requests for changes, and a CI started. labels Mar 26, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Apr 1, 2025
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@mcollina mcollina added the commit-queue Add this label to land a pull request using GitHub Actions. label Apr 7, 2025
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Apr 7, 2025
@nodejs-github-bot nodejs-github-bot merged commit b85505d into nodejs:main Apr 7, 2025
79 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in b85505d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. backport-requested-v20.x PRs awaiting manual backport to the v20.x-staging branch. backport-requested-v22.x PRs awaiting manual backport to the v22.x-staging branch. backport-requested-v23.x PRs awaiting manual backport to the v23.x-staging branch. backport-requested-v24.x PRs awaiting manual backport to the v24.x-staging branch. c++ Issues and PRs that require attention from people who are familiar with C++. cares Issues and PRs related to the c-ares dependency or the cares_wrap binding. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Breaking Change - DNS Caching
8 participants