Skip to content

net: report a name that does not exist as a not-found lookup error - #73

Open
yohimik wants to merge 1 commit into
tinygo-org:mainfrom
yohimik:upstream-pr/dns-not-found
Open

net: report a name that does not exist as a not-found lookup error#73
yohimik wants to merge 1 commit into
tinygo-org:mainfrom
yohimik:upstream-pr/dns-not-found

Conversation

@yohimik

@yohimik yohimik commented Aug 30, 2026

Copy link
Copy Markdown

net: report a name that does not exist as a not-found lookup error

Repository tinygo-org/net. Branch upstream-pr/dns-not-found, base main.

What this does

The resolver learns from an NXDOMAIN reply that the name does not exist, but
both layers above it lost that fact.

  • dnsLookup in netdev_native.go replaced the error with a generic "no
    address found".
  • The Resolver methods in lookup.go built the DNSError from the message
    alone.

A caller that reads DNSError.IsNotFound, to tell "no such host" from "the
resolver did not answer", thus never saw a not-found lookup. A command line
program that must tell a typo in a host name from an offline network cannot do
so.

The change carries the flag out through both layers.

  • dnsLookup reports not-found when the A query and the AAAA query both said
    so.
  • The Resolver methods copy IsNotFound, IsTimeout and IsTemporary from
    the DNSError of the netdev, keep it as the unwrap target, and take its
    description and not its Error(), which repeats the "lookup " prefix.

Evidence

There is no CI in this repository. Checked by hand on macOS 26.6 arm64 with a
TinyGo build that carries the matching toolchain change. A lookup of a name that
does not exist now returns a DNSError with IsNotFound true, and a lookup
with no reachable resolver returns one with IsNotFound false.

A downstream product ships binaries built with these changes in a production
release. dispat v1.4.0 is published and is not a prerelease. It carries
dispat-tiny-linux-amd64 and dispat-tiny-linux-arm64, built by the fork
release v0.42.0-net.4 from sha256-pinned tarballs and smoke-executed under
binfmt before upload, beside six binaries from the gc toolchain.
https://github.com/yohimik/dispat/releases/tag/services%2Fdispat%2Fv1.4.0

The acceptance record of that repository is committed at
packages/docs/docs/internals/tinygo.md. It reports the net.2 to net.4
acceptance history, an integration suite of 694 rows that passes with 0 failures
and 1 documented skip on darwin, and a size table of 0.58x to 0.63x against the
gc equivalents with TinyGo -opt=z -no-debug against go build -trimpath -ldflags "-s -w". Those figures come from that document. They are not a
measurement of this branch.

The suite of that repository has rows that read IsNotFound to give the user
the right message.

Scope

  • Two files. No API change. The behaviour for a lookup that succeeds is the
    same.
  • The change is independent of the darwin netdev work and applies to linux as
    it stands.

Related

Related pull requests

This change is part of one body of work. Together the changes make programs that use the network and child processes work on hosted linux and macOS. A full CLI was tested end to end with all of them and ships binaries built this way, see dispat v1.4.0 in the evidence section.

In tinygo-org/tinygo

In this repository

A merge order that works. The remaining bug fixes are independent. tinygo-org/tinygo#5633 goes before tinygo-org/tinygo#5635. HTTPS on linux needs only tinygo-org/tinygo#5633 and tinygo-org/tinygo#5635. Full darwin support also needs tinygo-org/tinygo#5636, the net changes and a new src/net submodule pin.

Related owner work

The Crier listener and close audit is separate from these PR measurements. The historical Linux arm64 run passed 142 tests with local patches. It predates later Crier changes and is not release validation.

Current integration status

Darwin fcntl work is in tinygo-org/tinygo#5612. tinygo-org/tinygo#5632 is closed and remains a history reference only. The integer and pointer tests were offered on #5612. Builder socket and spawn symbols in tinygo-org/tinygo#5636 are an independent prerequisite at e8394f67. The direct syscall test needs no net update, so that PR does not wait for this net series. tinygo-org/tinygo#5634 is limited to process support.

#82 supplies the separate ListenConfig implementation. Close guard tests and a limited shutdown fix stay on the fork branch codex/close-audit for coordination with the #77 owner. They are not equivalent to the poller. No second shutdown PR was opened.

Current Crier evidence

The Crier report separates the original size comparison from a new CI-built candidate test. The original stripped Linux ARM64 result is 13,829,248 bytes versus Go's 30,277,794 bytes. Two render fixtures exceed pixel tolerance.

Candidate e7d34c8c126e0eecd2ce711915f2f88d112d833a, with net 0f460803, passed all 24 fork CI checks. Its downloaded compiler artifacts, with no source overlays, build unchanged Crier 7edaff9. Linux ARM64 E2E passed 143 cases with no failures or skips. Darwin ARM64 passed 142 with no failures and one platform trust-store skip. Darwin startup now works. A separate Darwin local-TLS matrix passes certificate rejection, plaintext refusal, update to a Go 1.1.0 target, and offline rollback. Both platforms pass spawn, signal, cookiejar, os/fcntl, and network probes.

These are combined-candidate results, not proof that this PR alone supplies all features. No new pixel or stripped-size comparison, amd64 execution, or current Dispat acceptance is claimed. WaitDelay and the recorded net limits remain open. No fork release was published.

The resolver learns from an NXDOMAIN reply that the name does not exist, but
both layers above it lost that fact. dnsLookup replaced the error with a
generic "no address found", and the Resolver methods built the DNSError from
the message alone. A caller that reads DNSError.IsNotFound, to tell "no such
host" from "the resolver did not answer", thus never saw a not-found lookup.

Carry the flag out through both layers. dnsLookup reports not-found when the A
query and the AAAA query both said so. The Resolver methods copy IsNotFound,
IsTimeout and IsTemporary from the DNSError of the netdev, keep it as the
unwrap target, and take its description and not its Error(), which repeats the
"lookup <host>" prefix.
@yohimik

yohimik commented Sep 2, 2026

Copy link
Copy Markdown
Author

tinygo-org/net main has not moved since this branch was opened. It is still
70037cf, so the branch needs no rebase and it is current. v0.42.0 of the
toolchain pins src/net at that same commit, so the change applies to the
released toolchain.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant