carlos / platform Public

New custom domains wait up to an hour for a certificate: the cert warm is never woken Issue open

On branch certwarm-wake

Symptom. A newly attached custom domain takes 0 to 60 minutes to get a certificate on a multi-edge deployment. Paul saw about 20 minutes.

Evidence (flagship, 2026-10-24, carlos.international). Visitors' handshakes failed on the US and UK edges from 19:24 to 19:34 UTC with acme: not available here. AU holds the issuer lease and logged edge: cert warmed for carlos.international at 19:54:23. AU's warm passes fall at :54 each hour, so the domain simply waited for the next pass.

Cause (internal/edge/certwarm.go, certsync.go):

  1. Only the issuer orders. On every other box HostPolicy answers errNotIssuer, and latency steering means visitors almost never reach the issuer, so the lazy first-handshake order does not happen.
  2. The warm runs on a fixed hourly sleep (warmInterval). Nothing wakes it when its set gains a host. The wildcard manager does get woken (OnReload, homeMap.setHostsWake), but both hooks are single-slot and the wildcard holds them. setHostsWake also fires only on platform-class name changes, which never include a custom domain.
  3. A new host that fails dnsGate is retried at the next pass, an hour later.
  4. After issue: the mirror copies the cert within 30 s, and the console's status snapshot is every 5 min, so the domain reads live up to ~5 min after that. Not touched here.

Fix (branch certwarm-wake):

  • certWarm gets a wake channel. run() waits on its timer or a wake. A wake runs a pass only if the set holds a host that has never been warmed and is not backing off; otherwise it is ignored and the hourly cadence is untouched.
  • Wake sources: the Edge reload hook (local routes) and a new home-map hook that fires when the ServedHosts set changes (hosts homed on other boxes). Both hooks become fan-outs so the wildcard keeps its wake.
  • DNS-miss retry for a NEW host: 1 min for its first 10 minutes of misses, then 5 min until it has missed for an hour, then hourly as today. In memory only. Renewal re-arms, the per-pass order cap, failure backoff and the 12 h rate-limit backoff are unchanged.

Request budget: wakes are driven by changes the box already polls for, so no new polling. A woken pass costs what an hourly pass costs (one records LIST, plus EdgeIPs reads per new host at the DNS gate). The fast DNS retry adds at most ~20 passes in a domain's first hour, then stops.

Out of scope, noted: dnsGate re-reads the edge set from the bucket for every new host. After a roll every host is "new" to the issuer, so the first pass does that ~60 times. Worth memoising per pass separately.

Built on branch certwarm-wake (tip 41cca5e3, merged with main). The design moved during review. What landed:

  • Wake on a host the warm has never seen (reload hook, now additive; new home-map served-hosts hook).
  • DNS-only probe per pending host: 1 min for 10 min, 5 min to 1 h, then hourly. No outcome-record reads between passes.
  • Order cap is now 10 per rolling minute across all passes, not 10 per pass.
  • The loop reads the in-memory issuer lease every minute on an absolute deadline and runs a pass when the lease arrives.
  • The DNS gate reuses the edge set for 5 min (30 s when empty). That also fixes the per-host EdgeIPs re-read I listed as out of scope.

Astra took five rounds to reach ACCEPT. It found a cap bypass through wakes, bucket reads from fast passes, two lost-wake cases around the lease, an early order stamp, and a busy-spin after lease loss. Each fix has a test that fails without it.

Not touched: the console status snapshot (5 min) between issue and live.

Waiting on Paul: merge, then roll dev first and time a fresh custom domain from attach to cert.

Merged to main as 542ad2c (squash of certwarm-wake at bda1e424, CI green, census approved on #280); GitHub mirror fast-forwarded. Not released or rolled. It reaches the boxes with the next platform release. Roll dev first, then time a new custom domain from attach to edge: cert warmed for in the issuer's journal; it should take about a minute once DNS points at us, against up to an hour before.