Skip to content

fix(ci3): cache DNS on build instances to dodge link-local PPS throttling - #24105

Merged
alexghr merged 1 commit into
nextfrom
ci3-dns-cache
Jun 16, 2026
Merged

alexghr merged 1 commit into
nextfrom
ci3-dns-cache

Conversation

@charlielye

Copy link
Copy Markdown
Contributor

Problem

CI DNS failures (curl: (6) Could not resolve host …, e.g. the chonk_inputs.sh S3 download) are consistent with AWS's link-local PPS limit: traffic to the Amazon resolver (the VPC .2 address / 169.254.169.253) is capped at ~1024 packets/sec per ENI, and over that, packets are silently dropped (linklocal_allowance_exceeded in ethtool -S).

We confirmed the build's DNS path makes this likely: the devbox container and nested docker-in-docker both get nameserver 172.31.0.2 and query the VPC resolver directly — no caching. The host's systemd-resolved is caching (~48% hit on host-only traffic) but listens on loopback only (127.0.0.53), so containers can't use it. With the build's parallelism (and the larger spot instances), the aggregate DNS rate blows past 1024 pps.

Fix

Route container DNS through the host's caching systemd-resolved:

  • Expose its stub on the instance's primary private IP (derived from ip route get, no IMDS dependency) via DNSStubListenerExtra — that's the one address reachable from the devbox container and nested dind (unlike the docker0 gateway).
  • Point containers at it with docker run --dns <priv_ip>. Non-loopback nameservers propagate through the nested dockerd, so dind inherits it.

Repeat lookups become cache hits and never reach the throttled resolver.

Safety

This can only help, never break resolution: if the IP can't be derived, systemd-resolved isn't active, or the stub doesn't come up on the IP (5×0.5s health check via ss), priv_ip is cleared and --dns is omitted — leaving DNS exactly as today.

No counter instrumentation included — we're treating link-local throttling as the known cause. (PR #379's linklocal_allowance_exceeded logging can confirm before/after if desired.)

Validation

  • bash -n on ci3/bootstrap_ec2; rendered+bash -n the injected host-script block; verified the ip route get parse and the ${priv_ip:+--dns …} expansion locally.
  • Full validation is the PR's own CI run: a build instance that resolves through the cache and (ideally) flat linklocal_allowance_exceeded.

…ling

CI's parallel jobs (devbox + nested docker-in-docker) resolve the same hosts
(S3, Docker Hub, npm, cargo, github) thousands of times, each lookup going
straight to the VPC resolver. AWS caps traffic to the link-local resolver at
~1024 pps per ENI; over that, packets are silently dropped and show up as
"could not resolve host" (e.g. the chonk-inputs S3 download failures).

Route container DNS through the host's caching systemd-resolved: expose its stub
on the instance's primary private IP (the one address reachable from the devbox
container and nested dind) via DNSStubListenerExtra, and point containers at it
with `docker run --dns`. Repeat lookups become cache hits and never reach the
throttled resolver.

Fails safe: if the IP can't be derived, systemd-resolved isn't active, or the
stub doesn't come up, priv_ip is cleared and --dns is omitted, leaving DNS
exactly as before. No counters/measurement — treating the throttling as the
known cause.
@charlielye
charlielye requested a review from alexghr June 15, 2026 17:08

@alexghr alexghr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks great!

@ludamad
ludamad added this pull request to the merge queue Jun 15, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 15, 2026
@alexghr
alexghr added this pull request to the merge queue Jun 16, 2026
@AztecBot

Copy link
Copy Markdown
Collaborator

Flakey Tests

🤖 says: This CI run detected 1 tests that failed, but were tolerated due to a .test_patterns.yml entry.

\033FLAKED\033 (8;;http://ci.aztec-labs.com/9a102ce2a369487d�9a102ce2a369487d8;;�): yarn-project/kv-store/scripts/run_test.sh src/sqlite-opfs/internal/ordered-binary-browser.test.ts (2s) (code: 0)

Merged via the queue into next with commit 8dec6b2 Jun 16, 2026
22 checks passed
@alexghr
alexghr deleted the ci3-dns-cache branch June 16, 2026 06:44
AztecBot pushed a commit that referenced this pull request Jun 24, 2026
…ling (#24105)

## Problem

CI DNS failures (`curl: (6) Could not resolve host …`, e.g. the
`chonk_inputs.sh` S3 download) are consistent with AWS's **link-local
PPS limit**: traffic to the Amazon resolver (the VPC `.2` address /
`169.254.169.253`) is capped at **~1024 packets/sec per ENI**, and over
that, packets are silently dropped (`linklocal_allowance_exceeded` in
`ethtool -S`).

We confirmed the build's DNS path makes this likely: the devbox
container **and** nested docker-in-docker both get `nameserver
172.31.0.2` and query the VPC resolver directly — no caching. The host's
`systemd-resolved` *is* caching (~48% hit on host-only traffic) but
listens on loopback only (`127.0.0.53`), so containers can't use it.
With the build's parallelism (and the larger spot instances), the
aggregate DNS rate blows past 1024 pps.

## Fix

Route container DNS through the host's caching `systemd-resolved`:
- Expose its stub on the instance's **primary private IP** (derived from
`ip route get`, no IMDS dependency) via `DNSStubListenerExtra` — that's
the one address reachable from the devbox container *and* nested dind
(unlike the docker0 gateway).
- Point containers at it with `docker run --dns <priv_ip>`. Non-loopback
nameservers propagate through the nested dockerd, so dind inherits it.

Repeat lookups become cache hits and never reach the throttled resolver.

## Safety

This can only help, never break resolution: if the IP can't be derived,
`systemd-resolved` isn't active, or the stub doesn't come up on the IP
(5×0.5s health check via `ss`), `priv_ip` is cleared and `--dns` is
omitted — leaving DNS exactly as today.

No counter instrumentation included — we're treating link-local
throttling as the known cause. (PR #379's `linklocal_allowance_exceeded`
logging can confirm before/after if desired.)

## Validation

- `bash -n` on `ci3/bootstrap_ec2`; rendered+`bash -n` the injected
host-script block; verified the `ip route get` parse and the
`${priv_ip:+--dns …}` expansion locally.
- Full validation is the PR's own CI run: a build instance that resolves
through the cache and (ideally) flat `linklocal_allowance_exceeded`.
@AztecBot

Copy link
Copy Markdown
Collaborator

✅ Successfully backported to backport-to-v5-next-staging #24277.

rangozd pushed a commit to rangozd/aztec-packages that referenced this pull request Aug 5, 2026
…ling (AztecProtocol#383)

Port of AztecProtocol#24105.

## Problem

CI DNS failures (`curl: (6) Could not resolve host …`) are consistent with AWS's link-local PPS limit: traffic to the Amazon resolver (VPC `.2` / `169.254.169.253`) is capped at ~1024 pps per ENI; over that, packets are silently dropped (`linklocal_allowance_exceeded`). The devbox container and nested dind both query the VPC resolver directly with no caching, and the build's parallelism blows past the cap.

## Fix

Route container DNS through the host's caching `systemd-resolved`: expose its stub on the instance's primary private IP (reachable from the devbox container and nested dind) via `DNSStubListenerExtra`, and point containers at it with `docker run --dns`. Repeat lookups become cache hits and never reach the throttled resolver.

Fails safe: if the IP can't be derived, `systemd-resolved` isn't active, or the stub doesn't bind (health-checked via `ss`), `priv_ip` is cleared and `--dns` omitted — DNS unchanged.

## Validation

`bash -n` on `ci3/bootstrap_ec2`; rendered+checked the injected host-script block; verified the `ip route get` parse and `--dns` expansion. Full validation is the CI run itself.
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.

4 participants