forge
Explore
Log in

Don't you dare go Hollow

A stalled run now fails in ninety minutes and names its test

Browse files at this commit

a39278e6044c84f773fcfd0c4e89ee08125ef3deAhmet Kaan GümüşParent: b7a8017
  • ci
    • a stalled run now fails in ninety minutes and names its test
Show full message
⏱️ ci: a stalled run now fails in ninety minutes and names its test

The Build-and-test job gets a 90-minute timeout-minutes (default 360 min,
since the run holds the serial deploy lock) and the Test step gets a
shell-level timeout --foreground 4200 - above the 41m18s/60m25s green Test
steps, below the job limit. Before Test: df/free/nproc/nextest
version/.config/nextest.toml + show-config test-groups; then, via if: always(),
the docker log, df/free, docker system df and the pg_stat_activity breakdown +
the 20 longest queries: if the stall is on the DB side, its name stays in the
log.
.github/workflows/main.ymlmodified+56 -1
@@ -125,6 +125,17 @@ jobs:
125 # runtime image is debian:trixie-slim — float either side carelessly125 # runtime image is debian:trixie-slim — float either side carelessly
126 # and the binary stops loading. See the TARGET comment above.126 # and the binary stops loading. See the TARGET comment above.
127 runs-on: ubuntu-24.04127 runs-on: ubuntu-24.04
128+ # GitHub's default job timeout is 360 minutes, and this job holds the
129+ # repo's serial deploy lock (every later push queues behind it), so a
130+ # stall burned six hours per run (observed: 3h38m on 35251780342 and
131+ # 35256696519, both cancelled by hand). 90 is measured, not guessed:
132+ # the *fastest* green Build-and-test was 49m13s (run 35227878489,
133+ # 13:34:06→14:23:19 — its Test step alone 41m18s), but three other
134+ # green runs took 66-68 min (35184706020 68m14s, 35103425693 66m32s,
135+ # 35184706020's Test step 60m25s), so 50-60 would kill legitimate
136+ # green runs. 90 keeps ~30% headroom over the worst green while
137+ # cutting lock-held stall time from 6h to 1.5h.
138+ timeout-minutes: 90
128 env:139 env:
129 # The 41 test binaries each link the full tonic/otlp/axum/sqlx stack;140 # The 41 test binaries each link the full tonic/otlp/axum/sqlx stack;
130 # with debug info they blow past the runner's free disk and the141 # with debug info they blow past the runner's free disk and the
@@ -182,11 +193,55 @@ jobs:
182 with:193 with:
183 tool: cargo-nextest194 tool: cargo-nextest
184 195
196+ # The runner's state and the repo's hang policy, recorded BEFORE the
197+ # suite starts: if the job is killed mid-suite, this is what the log
198+ # still holds. `show-config` is nextest's documented door onto its
199+ # resolved configuration (0.9.143: `version` and `test-groups`); it
200+ # reads the config file for real — a missing or syntactically broken
201+ # .config/nextest.toml exits 96 here (verified locally), and a key
202+ # nextest does not know is warned about by name — so a silently
203+ # ignored slow-timeout cannot hide.
204+ - name: Test environment
205+ run: |
206+ df -h /
207+ free -m
208+ nproc
209+ cargo nextest --version
210+ cat .config/nextest.toml
211+ cargo nextest show-config test-groups --no-pager || true
212+
185 # A broken build must never reach the server: the whole suite gates213 # A broken build must never reach the server: the whole suite gates
186 # the deploy (doc_sync included, so README drift blocks it too).214 # the deploy (doc_sync included, so README drift blocks it too).
187 # --no-fail-fast: one load-luck assert must not skip the other 1000 tests.215 # --no-fail-fast: one load-luck assert must not skip the other 1000 tests.
216+ # --config-file: pin the hang policy to the repo file explicitly, so a
217+ # nextest release that moves the default lookup cannot silently drop it.
218+ # `timeout --foreground 4200` (70 min) bounds the step at the shell
219+ # level, unbuffered and unpiped: output up to the kill survives, and a
220+ # stall exits 124 naming the phase instead of running to the job's
221+ # 90-minute ceiling. 4200s because CI's Test step has run 41m18s
222+ # (green, 35227878489) and 60m25s (green, 35184706020) — local 565s is
223+ # not the yardstick — so 70 min clears the worst green by ~10 min and
224+ # still sits below the 90-minute job timeout.
188 - name: Test225 - name: Test
189- run: cargo nextest run --no-fail-fast226+ run: |
227+ set -euo pipefail
228+ timeout --foreground 4200 \
229+ cargo nextest run --no-fail-fast --config-file .config/nextest.toml
230+
231+ # Always, including when the step above was killed: the discriminator.
232+ # If the stall is a DB-side wait (the suite mints and clones control+
233+ # school databases per test), this names the query and the state; if it
234+ # is disk or memory, df/free show it; docker's own log shows a crashed
235+ # or refusing Postgres.
236+ - name: Stall diagnostics
237+ if: always()
238+ run: |
239+ echo '=== df -h / ==='; df -h / || true
240+ echo '=== free -m ==='; free -m || true
241+ echo '=== docker system df ==='; docker system df || true
242+ echo '=== postgres container log (tail 80) ==='; docker logs hezarfen_backend_pg --tail 80 || true
243+ echo '=== pg_stat_activity by state ==='; docker exec hezarfen_backend_pg psql -U "$PG_USER" -c 'select count(*), state from pg_stat_activity group by state' || true
244+ echo '=== 20 longest-running queries ==='; docker exec hezarfen_backend_pg psql -U "$PG_USER" -c "select pid, now()-query_start as age, left(query,120) from pg_stat_activity where state='active' order by 2 desc limit 20" || true
190 245
191 246
192 - name: Build the release247 - name: Build the release