Skip to content

obs(#1009): upstream/downstream end timing in the HTTP access log, and the benign-DC grader rule for QUIC twins at hot restart - #1048

Merged
bpalermo merged 1 commit into
mainfrom
fix/1009-quic-dc-attribution
Sep 28, 2026
Merged

bpalermo merged 1 commit into
mainfrom
fix/1009-quic-dc-attribution

Conversation

@bpalermo

Copy link
Copy Markdown
Owner

Mechanism

Details are in the issue comment, which was read from the pinned Envoy 726d7ac. At a source-proxy hot restart, the draining parent stamps Connection: close on the 200. The HTTP/1.1 client (k6) reads the full Content-Length body and closes. The h3 upstream FIN is decoded a moment later, so ConnectionManagerImpl::onEvent(RemoteClose) → resetAllStreams flags the still-open stream DC with response_code_details=downstream_remote_disconnect.

This is cosmetic: bytes_sent equals the clean lines, the client closed the connection itself, and k6 counted every request as a success. h2 does not show it because nghttp2 delivers DATA+END_STREAM from one read. No Envoy config setting ends a stream on a satisfied Content-Length, so the fix is attribution rather than behaviour.

Access-log fields (agent/internal/xds/proxy/accesslog.go)

attribute formatter
upstream_rx_ms %COMMON_DURATION(US_RX_BEG:US_RX_END:ms)%, ending when the router decoded the upstream end_stream (maybeEndDecode)
downstream_tx_end_ms %COMMON_DURATION(US_RX_BEG:DS_TX_END:ms)%, ending when the downstream codec finished encoding (onCodecEncodeComplete)

CommonDurationFormatter renders - whenever either time point is unset. Reading the source, the race shows as both fields - together with a full bytes_sent, because resetAllStreams destroys and logs the stream before the FIN is decoded. A clean line has two numbers. A DC line with upstream_rx_ms set and downstream_tx_end_ms - is a different case: the upstream finished, then the response stalled on its way out. It gets attributed separately and is not the race.

Grader rule (e2e/soak/README.md, "Benign DC at a source-proxy hot restart")

A DC line is benign only if all of these hold:

  • response_flags is exactly DC
  • response_code_details is downstream_remote_disconnect
  • response_code is 200
  • bytes_sent equals that target's clean-line body size (791 for svc-1/2 on rev242; read it fresh)

Every other DC is still a failure: downstream_local_disconnect(...), a short body, a non-200, or DC alongside another flag. Benign lines are also left out of the k6 reconciliation. The README includes the LogsQL, and the runbook's east-west QUIC section links to it:

# clean-line size: ONE bytes_sent per authority
log_name:aether_access_logs AND reporter:source AND authority:~"svc-[12]" AND response_code:200 AND response_flags:="-"
  | stats by (authority, bytes_sent) count()

# benign, per roll bracket
log_name:aether_access_logs AND reporter:source AND _time:[<roll_start>, <roll_end>]
  AND authority:~"svc-1" AND response_flags:="DC" AND response_code:200
  AND response_code_details:="downstream_remote_disconnect" AND bytes_sent:="<clean_bytes>"
  | stats by (_time:1m, node_name) count() benign

# non-benign: MUST be empty
log_name:aether_access_logs AND reporter:source AND _time:[<roll_start>, <roll_end>]
  AND authority:~"svc-1" AND response_flags:~"DC"
  AND NOT (response_flags:="DC" AND response_code:200
           AND response_code_details:="downstream_remote_disconnect" AND bytes_sent:="<clean_bytes>")
  | stats by (node_name, response_code, response_flags, response_code_details, bytes_sent) count()

Kind proof: harness added, race not reproduced

e2e/eastwest-quic-hotrestart.sh reuses the e2e/eastwest-quic.sh bring-up. That script now has a source guard and an EWQ_EXTRA_HELM_ARGS hook, and its own behaviour is unchanged. The new script adds:

  • an OTLP collector stand-in
  • access logs enabled through the seeded MeshConfig
  • 16 HTTP/1.1 keep-alive curl loops per destination from client-a to quic-a and quic-b (h3 twins) and to h2only (the h2 control)
  • N supervisor hot restarts, triggered by SIGHUP to /opt/aether/supervisor, the same trigger as a watched-config change, and confirmed by restart_epoch

It then grades the collector's records against the rule above.

I did two runs on kind, with 3 and 6 restarts. Excerpt from the 6-restart run:

  ✓ (client-a -> quic-a) rides its HTTP/3 twin (1797 -> 1802)
==> H1 client: 16 keep-alive HTTP/1.1 loops per destination x 164s at 5/s, through 6 hot restarts
  ✓ hot restart: epoch 6 -> 7 (12:48:29Z)   … epoch 11 -> 12 (12:50:29Z)
  ✓ quic-a: 13120/13120 answered 200 with the full 700-byte body; 112 connections across 16 loops
  ✓ quic-b: 13120/13120 answered 200 with the full 700-byte body; 112 connections across 16 loops
  ✓ h2only: 13120/13120 answered 200 with the full 700-byte body; 112 connections across 16 loops
==> H2 logs: every DC on an h3 destination is benign; the h2 control has none
  quic-a: records=270 clean_bytes=700 DC=0 benign=0
  quic-a clean-line timing (upstream_rx_ms, downstream_tx_end_ms): 270 × "0 0"
  quic-b: records=210 clean_bytes=700 DC=0 benign=0
  h2only: records=258 clean_bytes=700 DC=0 benign=0
  NOTE: 0 DC lines on the h3 destinations — the race did not reproduce this run; H2 passed vacuously

What these runs show:

  • The client saw zero errors through the restarts.
  • The drain really did close connections: 96 reconnects per destination.
  • The h2 control logged no DC.
  • The new fields render numbers on clean lines, not -.

The race itself did not reproduce on single-node kind: 0 DC in about 100 drain-closed connections per h3 destination across 9 restarts. Here source and destination share one proxy over loopback, and on rev242 the rate was 74 in 8 h of fleet rolls. The leg reports a zero as vacuous, and HR_REQUIRE_DC=1 makes a zero fail. The next QUIC soak is the first place the timing fields will be read on real DC lines.

Tests

  • //agent/internal/xds/proxy:proxy_test: TestBuildAccessLogEnabled pins both formatter strings exactly. Envoy accepts unknown time-point names as custom timing keys, so only the unit test catches a typo in a marker.
  • //test/envoy_validate:envoy_validate_test passes. It is a live gate: with the precision set to mz, it fails envoy --mode validate on every bootstrap with Invalid common duration precision: mz.
  • The lint run (--config=lint --@aspect_rules_lint//lint:fail_on_violation) over //e2e/..., //agent/internal/xds/proxy/... and //test/envoy_validate/... is clean, and make format-check is clean.
  • No charts/ change.

Closes #1009

🤖 Generated with Claude Code

https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

…d the benign-DC grader rule for QUIC twins at hot restart

The HTTP access log (aether_access_logs) gains two durations anchored at
the first upstream response byte:

  upstream_rx_ms        %COMMON_DURATION(US_RX_BEG:US_RX_END:ms)%
  downstream_tx_end_ms  %COMMON_DURATION(US_RX_BEG:DS_TX_END:ms)%

"-" means the end point never happened, so a DC line now says whether
the upstream FIN had been decoded when the downstream closed. The pinned
Envoy (726d7ac) accepts both; //test/envoy_validate parses the formatter
(verified red with an invalid precision).

e2e/soak/README.md gets the grader rule: a DC line is benign iff it is
exactly DC + downstream_remote_disconnect + 200 + the clean-line
bytes_sent for that target, with the LogsQL for benign vs non-benign per
roll; the runbook points at it. e2e/eastwest-quic-hotrestart.sh is the
kind leg (HTTP/1.1 keep-alive loops through supervisor SIGHUP hot
restarts to two h3 twins and an h2 control, graded from an OTLP
collector stand-in). On single-node kind the race did not reproduce.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
@bpalermo
bpalermo merged commit 763e257 into main Sep 28, 2026
24 checks passed
@bpalermo
bpalermo deleted the fix/1009-quic-dc-attribution branch September 28, 2026 13:06
bpalermo added a commit that referenced this pull request Sep 29, 2026
Brings #979 up to date with 36 commits of main (demand-scoped twins #1020/#1032,
fresh-stream classifier #1033/#1035, dormant-pair ledger #1036/#1038, per-twin
EDS names #1012/#1029, the twin certificate gate #1051, the ODCDS always-answer
override, --east-west-quic-idle-timeout #1063, L4 stat keys #1043, access-log
timing #1048, the identity gate #1055, hot-restart knobs #1068 and the carried
Envoy patches) while keeping #979's intent: no allow-list, every destination in
the node's dependency set is QUIC-eligible.

Resolution:
- cache: quicServices / SetEastWestQUICServices removed. armsFor gives arms to
  every default, identity-ready, non-waypointed entry whose service is in the
  dependency set (the same rule recordQUICPair admits by, so no route names a
  twin the agent would refuse); twins stay demand-scoped. The
  destination_not_quic_enabled refusal/prune reason is gone.
- quicpairs: the dependency-set prune now waits for the pod set like the
  source prune does -- the allow-list used to force its destinations into the
  set, and without it the first snapshot after an agent restart dropped every
  restored pair (TestQUICDemandPairSurvivesAgentRestart was red).
- fan-out log: allow_listed_services dropped; observed_pairs and
  awaiting_client_cert kept.
- chart 1.0.12: eastWestQuicServices removed, eastWestQuicIdleTimeout and its
  parentShutdownTime check kept.
- e2e/eastwest-quic.sh: main's demand-scoped E1/E4c/E6 + #979's QUIC_DNS_SANS
  negative control; h2only/E3 removed; E6 dials quic-a and its idgate-* pairs
  are excluded from the driven-pair count. eastwest-quic-hotrestart.sh's h2
  control is now the weighted GAMMA split (the one h2-by-design path).
- tests, runbook, soak README, configuration.md, 038 rewritten for the
  unconditional state.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
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.

QUIC: twins log 200/DC (~12 per proxy roll) where h2 logs a clean response; not client-visible per the k6 join

1 participant