GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Retry oversized UDP responses over TCP by allenflux · Pull Request #421 · dnsjava/dnsjava

Conversation

@allenflux

@allenflux allenflux commented Oct 15, 2026

Copy link
Copy Markdown

Fixes #418.

When a server returns a UDP response larger than the advertised payload size without setting TC, the receive buffer cuts it off and parsing fails before the resolver can retry over TCP. Read one additional byte, bounded by the DNS message limit, to distinguish an oversized response from a valid response that exactly fills the buffer. Parse an oversized response as truncated, then retain the existing ID, question, opcode and TSIG checks before using the TCP fallback. ignoreTruncation=true retains its existing receive and parsing behavior.

Validation on macOS arm64 / OpenJDK 21.0.12.1:

  • The two oversized regression cases fail on the original production code; all eight regression cases pass with the fix, including exact-capacity, ordinary malformed, wrong-ID, TC and ignore-truncation controls.
  • mvn -B -ntp -Dgpg.skip -DexcludedGroups=concurrency verify: 1789 tests, 0 failures/errors, 28 skipped; compatibility, Spotless and Checkstyle checks pass. The concurrency exclusion and signing skip match the project's JDK 21 CI settings. The existing baseline suite reports 1781 tests with the same 28 skips.
  • A local UDP/TCP stub returning 2741 bytes without TC now returns all 24 TXT records through TCP; the original code raises WireParseException without attempting TCP. The small UDP and forced-TCP controls remain successful, and ignore-truncation does not retry.

AI assistance: OpenAI Codex helped investigate, implement and validate this change.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@allenflux
Retry oversized UDP responses over TCP
f1a1827
Generated with OpenAI Codex
@codecov

codecov Bot commented Oct 15, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.47368% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.08%. Comparing base (26a8d85) to head (64a7851).
⚠️ Report is 70 commits behind head on master.

Files with missing lines Patch % Lines
src/main/java/org/xbill/DNS/Message.java 92.30% 0 Missing and 1 partial ⚠️
src/main/java/org/xbill/DNS/SimpleResolver.java 83.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #421      +/-   ##
============================================
+ Coverage     66.95%   70.08%   +3.13%     
- Complexity     3098     3282     +184     
============================================
  Files           198      198              
  Lines         13709    13727      +18     
  Branches       2142     2145       +3     
============================================
+ Hits           9179     9621     +442     
+ Misses         3949     3527     -422     
+ Partials        581      579       -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@allenflux
allenflux marked this pull request as ready for review October 16, 2026 14:34
@allenflux allenflux mentioned this pull request Oct 21, 2026
SimpleResolver: UDP response larger than the EDNS buffer fails with WireParseException instead of falling back to TCP #418
Open
Flux
Refactor DNS signature record position tracking
64a7851
@sonarqubecloud

sonarqubecloud Bot commented Oct 24, 2026

Copy link
Copy Markdown

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
95.6% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ibauersachs
ibauersachs reviewed Oct 24, 2026
View reviewed changes
Comment thread src/main/java/org/xbill/DNS/SimpleResolver.java

verifyTSIG(query, response, in);
if (!tcp && !ignoreTruncation && response.getHeader().getFlag(Flags.TC)) {
if (!tcp && !ignoreTruncation && (oversized || response.getHeader().getFlag(Flags.TC))) {

@ibauersachs ibauersachs Oct 24, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

If TSIG is in use, this check is never reached. So we can:

  • Read everything we receive, regardless of what was specified in OPT. That would require growing the buffer on demand, we don't always want to allocate the max. message size.
  • Keep it like this and accept TSIG validation failures (because the answer IS invalid)
  • Retry with TCP regardless. Not really an option IMO, since this breaks the TSIG promise.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
ibauersachs
ibauersachs reviewed Oct 24, 2026
View reviewed changes
Comment thread src/main/java/org/xbill/DNS/SimpleResolver.java
Message response;
try {
response = parseMessage(in);
response = parseMessage(in, oversized);

@ibauersachs ibauersachs Oct 24, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Instead of modifying Message, parse only the header if the message is oversized for the name/id/dclass validation, then retry with TCP. Fewer modifications and avoids useless parsing.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

This branch has not been deployed

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

Reviewers

@ibauersachs ibauersachs ibauersachs left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

SimpleResolver: UDP response larger than the EDNS buffer fails with WireParseException instead of falling back to TCP

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@allenflux @ibauersachs
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.