Files
amethyst/quic/interop/inspect-multiplexing.sh
T
Claude c1a6b6fafb diag(quic-interop): trim inspect-multiplexing.sh to actionable sections only
Removed:
- file tree dump (sanity check, only useful once)
- output.txt last 200 lines (overlaps with writer traces; runner
  spam already filtered at run-matrix.sh level)
- peer MAX_DATA frame grep (qlog observer doesn't emit max_data
  frames yet, always prints 'no max_data frames')
- per-packet stream_id grep (qlog observer doesn't emit stream_id
  per-frame, always prints 'no stream_id field')
- last 5 packet_received / packet_sent (we have steady-state from
  the histograms; the FIRST 10 packets are what reveal the burst
  shape, last 5 doesn't add signal)
- frames-per-packet histogram (overlapped with stream-frames; the
  stream-frames histogram is the focused version)
- separate qlog event-type histogram (not informative for the
  current investigation)
- first 10 packet_received (server-side response shape, not the
  bug we're chasing)

Kept:
- writer-side debug traces (the smoking gun for the live driver bug)
- server stderr tail (peer's CONNECTION_CLOSE if any)
- stream-frames-per-sent-packet histogram (coalescing or not)
- transport_parameters (peer's TPs)
- first 10 packet_sent (burst shape after handshake)
- connection_closed + packet_dropped (failure indicators)
2026-05-07 13:17:27 +00:00

94 lines
3.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Pull the post-mortem diagnostics for the most recent multiplexing run.
# Runs from anywhere; resolves logs relative to the runner clone path
# (../quic-interop-runner from this repo).
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
RUNNER_LOGS="${REPO_ROOT}/../quic-interop-runner/logs"
if [[ ! -d "$RUNNER_LOGS" ]]; then
echo "no runner logs at $RUNNER_LOGS" >&2
exit 1
fi
RUN_DIR="$(ls -1dt "$RUNNER_LOGS"/run-* 2>/dev/null | head -n 1 || true)"
if [[ -z "$RUN_DIR" ]]; then
echo "no run-* dirs under $RUNNER_LOGS" >&2
exit 1
fi
echo "==> run dir: $RUN_DIR"
# Layout: <run>/<server>_<client>/<testcase>/{client,server,sim}/
CASE_DIR="$(ls -1d "$RUN_DIR"/*amethyst*/multiplexing 2>/dev/null | head -n 1 || true)"
if [[ -z "$CASE_DIR" ]]; then
echo "no <pair>/multiplexing dir; tree under run:" >&2
find "$RUN_DIR" -maxdepth 3 -type d >&2
exit 1
fi
echo "==> case dir: $CASE_DIR"
echo
echo "=============== writer-side debug traces (DEBUG=1 build only) ==============="
# Per-drain frame/budget stats from buildApplicationPacket. The
# smoking-gun section for "writer is iterating N active streams but
# emits only 1 STREAM frame per packet". Empty unless the image was
# built with `make build DEBUG=1`.
WRITER_LINES=$(grep -c '\[writer' "$CASE_DIR/output.txt" 2>/dev/null || echo 0)
if [[ "$WRITER_LINES" -gt 0 ]]; then
echo "($WRITER_LINES writer trace lines; first 30:)"
grep '\[writer' "$CASE_DIR/output.txt" | head -n 30
echo
echo "stream_frames histogram (writer-reported):"
grep -oE 'stream_frames=[0-9]+' "$CASE_DIR/output.txt" | sort | uniq -c | sort -rn
echo
echo "active histogram (active stream count at drain time):"
grep -oE 'active=[0-9]+' "$CASE_DIR/output.txt" | sort | uniq -c | sort -rn
else
echo "(no [writer.* lines — rebuild image with: cd quic/interop && make build DEBUG=1)"
fi
echo
echo "=============== server stderr (last 50 lines) ==============="
# Peer's CONNECTION_CLOSE reason if any; processing pace via stream
# create/discard cadence.
tail -n 50 "$CASE_DIR/server/stderr.log" 2>/dev/null \
|| echo "(no server/stderr.log)"
QLOG="$(ls -1 "$CASE_DIR"/client/qlog/*.sqlog \
"$CASE_DIR"/client/qlog/*.qlog \
2>/dev/null | head -n 1 || true)"
if [[ -z "$QLOG" ]]; then
echo
echo "(no qlog under $CASE_DIR/client/qlog — skipping qlog sections)"
exit 0
fi
echo
echo "=============== qlog ($QLOG, $(wc -l <"$QLOG" | tr -d ' ') lines) ==============="
echo
echo "stream-frames-per-sent-packet histogram:"
# Many `0` = ack-only; many `1` = the bug; many `>=4` = writer
# coalescing as intended.
grep '"name":"transport:packet_sent"' "$QLOG" \
| awk -F'"frame_type":"stream"' '{print NF - 1}' \
| sort -n | uniq -c
echo
echo "transport_parameters (local + remote):"
grep '"name":"transport:parameters_set"' "$QLOG"
echo
echo "first 10 packet_sent (full) — burst shape after handshake:"
grep '"name":"transport:packet_sent"' "$QLOG" | head -n 10
echo
echo "connection_closed events (peer CCs are the smoking gun for spec violations):"
grep '"name":"transport:connection_closed"' "$QLOG" || echo "(none)"
echo
echo "packet_dropped events (last 10):"
grep '"name":"transport:packet_dropped"' "$QLOG" | tail -n 10 \
|| echo "(none)"