Skip to content

dns: set timeout to 1000ms when timeout <= 0 #58441

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

theanarkh
Copy link
Contributor

c-ares set timeout to DEFAULT_TIMEOUT(2000ms) When timeout is <= 0, so we should schedule timer every 1000ms.

if (optmask & ARES_OPT_TIMEOUTMS) {
    /* Apparently some integrations were passing -1 to tell c-ares to use
     * the default instead of just omitting the optmask */
    if (options->timeout <= 0) {
      optmask &= ~(ARES_OPT_TIMEOUTMS);
    } else {
      channel->timeout = (unsigned int)options->timeout;
    }
}

if (channel->timeout == 0) {
  channel->timeout = DEFAULT_TIMEOUT;
}

cc @jasnell

  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@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 May 23, 2025
@theanarkh theanarkh force-pushed the optimize_dns_timeout_with_0 branch from 47e17b5 to 1a25e88 Compare May 23, 2025 19:54
@theanarkh theanarkh changed the title dns: set timeout to 1000ms when timeout < 0 dns: set timeout to 1000ms when timeout <= 0 May 23, 2025
Copy link

codecov bot commented May 23, 2025

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 90.19%. Comparing base (cd68e35) to head (1a25e88).
Report is 39 commits behind head on main.

Files with missing lines Patch % Lines
src/cares_wrap.cc 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #58441      +/-   ##
==========================================
- Coverage   90.19%   90.19%   -0.01%     
==========================================
  Files         635      635              
  Lines      187224   187223       -1     
  Branches    36765    36763       -2     
==========================================
- Hits       168876   168867       -9     
- Misses      11131    11133       +2     
- Partials     7217     7223       +6     
Files with missing lines Coverage Δ
src/cares_wrap.cc 54.35% <0.00%> (-0.04%) ⬇️

... and 28 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.

@theanarkh theanarkh added the request-ci Add this label to start a Jenkins CI on a PR. label May 25, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label May 25, 2025
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@theanarkh theanarkh added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label May 28, 2025
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. 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.

3 participants