Skip to content

hostip: cache negative name resolves#18157

Closed
bagder wants to merge 1 commit intomasterfrom
bagder/negative-dns-cache
Closed

hostip: cache negative name resolves#18157
bagder wants to merge 1 commit intomasterfrom
bagder/negative-dns-cache

Conversation

@bagder
Copy link
Member

@bagder bagder commented Aug 4, 2025

Hold them for half the normal lifetime. Helps when told to transfer N URLs in quick succession that all use the same non-resolving hostname.

Done by storing a DNS entry with a NULL pointer for 'addr'.

Previously an attempt was made in #12406 by Björn Stenberg (@zagor) that was ultimately never merged.

TODO

  • test case verifying caching works
  • test case verifying negative cache entry pruning
  • documentation

@bagder bagder added feature-window A merge of this requires an open feature window name lookup DNS and related tech labels Aug 4, 2025
@bagder
Copy link
Member Author

bagder commented Aug 4, 2025

shellcheck sure has opinions, and seems to have been updated

@github-actions github-actions bot added the tests label Aug 4, 2025
@bagder bagder marked this pull request as ready for review August 4, 2025 07:11
@bagder bagder force-pushed the bagder/negative-dns-cache branch from fb14853 to 2a8335c Compare August 4, 2025 08:42
@bagder
Copy link
Member Author

bagder commented Aug 4, 2025

Complications to overcome include:

hosts

Probably due to local config in the GitHub CI runners all resolves are also done with extra domains added, like:

 QNAME examplehost.example.oxli0jd4dg2e1e4232xlml1rsh.gx.internal.cloudapp.net QTYPE A[LF]
 QNAME examplehost.example.oxli0jd4dg2e1e4232xlml1rsh.gx.internal.cloudapp.net QTYPE AAAA[LF]

I need to add filtering in the test logic that checks the request

DNS request ordering

c-ares and the threaded-resolver send their outgoing DNS requests in a different order. I make the check on sorted packet logs.

HTTPS request amount

For some reason I don't quite know, the c-ares backend makes three HTTPS requests and the threaded only does one, which makes the test case complicated.

Hold them for half the normal lifetime. Helps when told to transfer N
URLs in quick succession that all use the same non-resolving hostname.

Done by storing a DNS entry with a NULL pointer for 'addr'.

Previously an attempt was made in #12406 by Björn Stenberg that was
ultimately never merged.

Closes #18157
@bagder bagder force-pushed the bagder/negative-dns-cache branch from 503cd33 to cf25056 Compare August 4, 2025 14:41
@bagder bagder closed this in df2b4cc Aug 5, 2025
@bagder bagder deleted the bagder/negative-dns-cache branch August 5, 2025 06:06
vszakats added a commit to vszakats/curl that referenced this pull request Jan 15, 2026
vszakats added a commit that referenced this pull request Jan 15, 2026
Both guard the use of `CURL_DNS_SERVER` debug env.

Follow-up to df2b4cc #18157
Follow-up to 02e9690 #17015
Follow-up to 59dc9f7 #13718

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

Labels

feature-window A merge of this requires an open feature window name lookup DNS and related tech tests

Development

Successfully merging this pull request may close these issues.

1 participant