runs/ci: a promote with head runs open ends them: left_along's read times out for every run driven again (34 heads, 1,009 checks told error, 06:31Z 11-17) #95

Open
opened 2026-11-17 06:39:49 +00:00 by xemmerling · 0 comments
Owner

What happened

The promote of f9cb88e3 at 06:30:31Z on 11-17 ended 34 open head runs with errors. The new server led epoch 596 from 06:30:39Z. Every head run it drove again asked Db::left_along (src/db/commits.rs, called at src/runs/run.rs:1100, from 8d736d69 "ci: a head's left checks keep their place in line across a takeover"). Its second statement

SELECT h.sha, r.id, r.created_ms, r.session, r.request -> 'priority', k.check_id
FROM unnest($1::TEXT[], $2::TEXT[]) AS h(sha, run)
JOIN runs r ON r.id = h.run
JOIN ci_runs c ON c.run = r.id AND c.kind = 'head'
LEFT JOIN commit_keys k ON k.sha = h.sha AND k.tests = '{}' AND k.idle
    AND k.check_id = ANY($3) AND r.request -> 'select' -> 'named' ? k.check_id

was cancelled at the 30 s statement timeout 34 times between 06:31:18Z and 06:31:26Z (the database's log). The server logged 40 answers of it over 30 s, and for each of the 34 runs

ERROR t::runs::run: driving the run: db error: ERROR: canceling statement due to statement timeout run=…

Each run was then finished: 1,009 open checks told error with "db error: ERROR: canceling statement due to statement timeout", 2 told fail. 34 jobs found open were given up ("a job found open was dropped before its run took it over"): image-ci-fast, relay-upgrade, cloud-rystic-build, docs-examples and two test/tilo-session-client shards, 27 of them cancelled on the node. All 34 are ci:tilo heads asked 05:07Z to 06:28Z; one had 859 checks open. Open heads fell from 40 to 7 in a minute.

Why now

a98a041d has the same statement. At its start (03:29Z) the server logged 13 slow answers of it and none was cancelled. commit_keys holds 12.9 M rows in 5.1 GB behind one index for this join, its key (sha, check_id, tests). The first page asks 64 commits, each against every check the run still has open (up to 1,293), for every run driven again, all at once on the database's two cores. With 40 runs open it crossed the timeout.

What is missing

  1. A read that only places a check in line can end its run. The call is left_along(…).await? inside the drive. Its answer feeds live.lift alone: the place in line the left checks stand at. Without it the run is correct and only stands at its own place. An error there must be a warning.
  2. The read's cost has no bound in what it needs. The chain is walked newest head first and open only shrinks: the head right before the run usually ran almost every check, so after it few checks are still open. The first statement nevertheless asks 64 commits at the full list.

What I am doing

I am having both fixed in two commits so either can be dropped: the call made a warning, and the first read asking the nearest heads before a whole page. Landed only through the whole check set and the 250-run take-over test. Say here if you would rather take either.

Until one of them is on production, a promote with head runs open will do this again.

Evidence kept: the new server's log, the database's log of those minutes, the list of the 34 runs.

06:40Z: the plan and the rows it reads

EXPLAIN of the statement's shape on production: a nested loop over the page's commits into Index Scan using commit_keys_pkey … Index Cond: ((sha = h.sha) AND (check_id = ANY (…)) AND (tests = '{}')), Filter: idle, then the join filter on the run's named list. So one page is 64 commits times every check still open, each a probe of the key.

The chain does not end early under load: the newest commit has 1,826 key rows of which 502 are counted left, and over the newest 64 commits 78,773 of 116,881 rows are counted left (67%). Heads leave most of their checks to the next, so open stays large for many heads back and the walk takes page after page at nearly the full list. Asking the nearest heads first would therefore not bound it; I am leaving the read itself to you and not touching src/db/commits.rs.

What I am having done (one commit, dev/left-along-optional): the read runs as one of the run's tasks beside its drive, live.lift is called when it answers (the loop already stands the lifts again on lifted.changed()), and a read that fails is a warning that leaves the checks at the run's own place. The run no longer waits for it and can no longer end by it. The load of 40 such reads at once on two cores stays until the read is bounded.

08:26Z 11-17: the call is fixed on main, 8334f739 (not on production)

One commit on 628c4681 (the developer's 96da1e4e). In src/runs/run.rs the read is a future polled in the drive's own select! loop beside its tasks, not before them and not one of them (the loop ends only when the tasks are done, so as a task a read still going would have held the run's end): the checks start at once, live.lift is called when the read answers and the loop's lifted.changed() stands the lifts again, the drive's end drops a read still going, and a read that fails is one warning ("reading what older heads left the run: the checks they left stand at its own place in line"). Nothing under src/db is changed.

Test: ci::tests::a_head_driven_again_whose_read_of_what_older_heads_left_fails_still_ends_with_its_checks_verdicts. It makes the read fail for one head (the older head's run row loses its priority, so the row does not decode) and takes the lead over: both checks pass and the run ends with 2 passed, 0 errors. Without the change both checks are told Error, as on production.

Gate: testing was down (it exits on draw under the pin of f9cb88e3 since 07:07Z), so the forge workflow on the candidate was the gate: run 1533, test, fmt and clippy success. Not run yet: t's own check set on testing and the 250-run take-over test; both before any promote of mine.

Open here: the read's cost (40 to 70 heads each walking commit_keys at once on two cores still loads the database for up to 30 s at every takeover, and the left checks stand at their run's own place until it answers), which is yours.

09:00Z 11-17: t's own CI on the fix

Testing serves ea02d47b since 08:52Z (your ship). t's own run for it, rdf7a0d8fbf, ended 15 passed, 0 errors at 08:59:59Z, test/t and the three clippy checks among them: the first verdict of t's own CI on 8334f739's change. The 250-run take-over test on the tree at 8334f739 started 09:00:28Z on testing; its figures follow here.

09:12Z 11-17: the 250-run take-over test on 8334f739

drivers::cargo::tests_prod::two_hundred_and_fifty_tilo_sized_runs_resumed_at_a_takeover, asked from a clean tree at 8334f739 as an ad hoc cargo command on testing: pass in 562.7 s.

8334f739
the takeover over 250 open runs led in 17.7 s
every run planned again after 20.3 s, 250 live
peak memory 6,311 MiB, 0 MiB above the 6,315 MiB at the takeover
a resumed run's turn plan 0.023 s, rest 0.186 s (means of 250)
driver jobs handed 1,741 before the takeover, 1,741 after
checks told 250,250, none twice

The same test on e61b411d this morning: lead 17.6 s, 0 MiB above the takeover's peak, 250,250 told, none twice. So the read beside the drive costs the takeover nothing at this size.

With t's check set green on ea02d47b (rdf7a0d8fbf) this is everything I owed for the change. It is on testing in your ea02d47b and reaches production with the next promote of what testing pins; I am not promoting your head myself. After that promote I read the new server's log: "driving the run:" should be 0, and each read that times out one warning.

09:45Z 11-17: the same restart with the fix on production

Your promote of c6a21463 (server pod started 09:43:14Z, leading epoch 598 at 09:43:22Z, 102 jobs re-attached) against the promote of f9cb88e3 at 06:30Z:

06:30Z, f9cb88e3 09:43Z, c6a21463
open head runs driven again 40 69
left_along statements the database cancelled at 30 s 34 47
"driving the run: db error" 34 0
head runs ended by it 34 0
checks told error with the statement's words 1,009 0
jobs found open and given up 34 0
warnings "reading what older heads left the run … stand at its own place in line" (no such line) 47

The three head runs that finished in the first five minutes ended with 0 errors each. So the first half of what was missing here is closed: the read can no longer end a run.

The second half is open and yours: the statement was answered late 77 times at this start, up to 30.4 s, from 09:44:06Z to 09:44:47Z, and 47 of them were cancelled, with a blob_refs read and a test_flakes delete beside them as at 06:31Z. For those 47 heads the checks older heads left them stand at their own place in line, so across a takeover under load 8d736d69 keeps no place; and the database's two cores are taken for half a minute at every start. I leave the issue open for that.

10:16Z 11-17, the fault came back with a rollback. Production was pinned back to f9cb88e3 (infra 521d3e7f), a build without 8334f739. Its start at 10:16:20Z (epoch 599) cancelled 48 statements at the timeout and ended 47 runs at 10:17:03Z with "driving the run: db error: ERROR: canceling statement due to statement timeout". The start of c6a21463 at 09:43Z, with the fix, cancelled 47 and ended none. Any start of a build before 8334f739 ends the open head runs driven again while this read stays over 30 s.

11:21Z 11-17, forward again and clean. Production was promoted to eae869f7 (epoch 600 at 11:21:15Z). Its start cancelled 33 statements at the timeout, wrote 29 of the fix's warnings and ended no run; the worker went from node protocol 77 to 80 and re-attached 109 jobs. Three starts today, side by side:

start build has 8334f739 statements cancelled runs ended by their drive
09:43Z c6a21463 yes 47 0
10:16Z f9cb88e3 no 48 47
11:21Z eae869f7 yes 33 0

The 47 head runs ended at 10:17Z stand finished with 79 checks told error, and their commits were not asked again. The read itself still passes 30 s at every start, which is what this issue stays open for.

**What happened** The promote of f9cb88e3 at 06:30:31Z on 11-17 ended 34 open head runs with errors. The new server led epoch 596 from 06:30:39Z. Every head run it drove again asked `Db::left_along` (`src/db/commits.rs`, called at `src/runs/run.rs:1100`, from 8d736d69 "ci: a head's left checks keep their place in line across a takeover"). Its second statement ```sql SELECT h.sha, r.id, r.created_ms, r.session, r.request -> 'priority', k.check_id FROM unnest($1::TEXT[], $2::TEXT[]) AS h(sha, run) JOIN runs r ON r.id = h.run JOIN ci_runs c ON c.run = r.id AND c.kind = 'head' LEFT JOIN commit_keys k ON k.sha = h.sha AND k.tests = '{}' AND k.idle AND k.check_id = ANY($3) AND r.request -> 'select' -> 'named' ? k.check_id ``` was cancelled at the 30 s statement timeout 34 times between 06:31:18Z and 06:31:26Z (the database's log). The server logged 40 answers of it over 30 s, and for each of the 34 runs ``` ERROR t::runs::run: driving the run: db error: ERROR: canceling statement due to statement timeout run=… ``` Each run was then finished: 1,009 open checks told `error` with "db error: ERROR: canceling statement due to statement timeout", 2 told `fail`. 34 jobs found open were given up ("a job found open was dropped before its run took it over"): `image-ci-fast`, `relay-upgrade`, `cloud-rystic-build`, `docs-examples` and two `test/tilo-session-client` shards, 27 of them cancelled on the node. All 34 are `ci:tilo` heads asked 05:07Z to 06:28Z; one had 859 checks open. Open heads fell from 40 to 7 in a minute. **Why now** a98a041d has the same statement. At its start (03:29Z) the server logged 13 slow answers of it and none was cancelled. `commit_keys` holds 12.9 M rows in 5.1 GB behind one index for this join, its key `(sha, check_id, tests)`. The first page asks 64 commits, each against every check the run still has open (up to 1,293), for every run driven again, all at once on the database's two cores. With 40 runs open it crossed the timeout. **What is missing** 1. **A read that only places a check in line can end its run.** The call is `left_along(…).await?` inside the drive. Its answer feeds `live.lift` alone: the place in line the left checks stand at. Without it the run is correct and only stands at its own place. An error there must be a warning. 2. **The read's cost has no bound in what it needs.** The chain is walked newest head first and `open` only shrinks: the head right before the run usually ran almost every check, so after it few checks are still open. The first statement nevertheless asks 64 commits at the full list. **What I am doing** I am having both fixed in two commits so either can be dropped: the call made a warning, and the first read asking the nearest heads before a whole page. Landed only through the whole check set and the 250-run take-over test. Say here if you would rather take either. Until one of them is on production, a promote with head runs open will do this again. Evidence kept: the new server's log, the database's log of those minutes, the list of the 34 runs. **06:40Z: the plan and the rows it reads** `EXPLAIN` of the statement's shape on production: a nested loop over the page's commits into `Index Scan using commit_keys_pkey … Index Cond: ((sha = h.sha) AND (check_id = ANY (…)) AND (tests = '{}')), Filter: idle`, then the join filter on the run's `named` list. So one page is 64 commits times every check still open, each a probe of the key. The chain does not end early under load: the newest commit has 1,826 key rows of which 502 are counted left, and over the newest 64 commits 78,773 of 116,881 rows are counted left (67%). Heads leave most of their checks to the next, so `open` stays large for many heads back and the walk takes page after page at nearly the full list. Asking the nearest heads first would therefore not bound it; I am leaving the read itself to you and not touching `src/db/commits.rs`. What I am having done (one commit, `dev/left-along-optional`): the read runs as one of the run's tasks beside its drive, `live.lift` is called when it answers (the loop already stands the lifts again on `lifted.changed()`), and a read that fails is a warning that leaves the checks at the run's own place. The run no longer waits for it and can no longer end by it. The load of 40 such reads at once on two cores stays until the read is bounded. **08:26Z 11-17: the call is fixed on main, 8334f739 (not on production)** One commit on 628c4681 (the developer's 96da1e4e). In `src/runs/run.rs` the read is a future polled in the drive's own `select!` loop beside its tasks, not before them and not one of them (the loop ends only when the tasks are done, so as a task a read still going would have held the run's end): the checks start at once, `live.lift` is called when the read answers and the loop's `lifted.changed()` stands the lifts again, the drive's end drops a read still going, and a read that fails is one warning ("reading what older heads left the run: the checks they left stand at its own place in line"). Nothing under `src/db` is changed. Test: `ci::tests::a_head_driven_again_whose_read_of_what_older_heads_left_fails_still_ends_with_its_checks_verdicts`. It makes the read fail for one head (the older head's run row loses its priority, so the row does not decode) and takes the lead over: both checks pass and the run ends with 2 passed, 0 errors. Without the change both checks are told `Error`, as on production. Gate: testing was down (it exits on `draw` under the pin of f9cb88e3 since 07:07Z), so the forge workflow on the candidate was the gate: run 1533, test, fmt and clippy success. Not run yet: t's own check set on testing and the 250-run take-over test; both before any promote of mine. Open here: the read's cost (40 to 70 heads each walking `commit_keys` at once on two cores still loads the database for up to 30 s at every takeover, and the left checks stand at their run's own place until it answers), which is yours. **09:00Z 11-17: t's own CI on the fix** Testing serves ea02d47b since 08:52Z (your ship). t's own run for it, rdf7a0d8fbf, ended 15 passed, 0 errors at 08:59:59Z, `test/t` and the three clippy checks among them: the first verdict of t's own CI on 8334f739's change. The 250-run take-over test on the tree at 8334f739 started 09:00:28Z on testing; its figures follow here. **09:12Z 11-17: the 250-run take-over test on 8334f739** `drivers::cargo::tests_prod::two_hundred_and_fifty_tilo_sized_runs_resumed_at_a_takeover`, asked from a clean tree at 8334f739 as an ad hoc cargo command on testing: pass in 562.7 s. | | 8334f739 | |---|---| | the takeover over 250 open runs led in | 17.7 s | | every run planned again after | 20.3 s, 250 live | | peak memory | 6,311 MiB, 0 MiB above the 6,315 MiB at the takeover | | a resumed run's turn | plan 0.023 s, rest 0.186 s (means of 250) | | driver jobs handed | 1,741 before the takeover, 1,741 after | | checks told | 250,250, none twice | The same test on e61b411d this morning: lead 17.6 s, 0 MiB above the takeover's peak, 250,250 told, none twice. So the read beside the drive costs the takeover nothing at this size. With t's check set green on ea02d47b (rdf7a0d8fbf) this is everything I owed for the change. It is on testing in your ea02d47b and reaches production with the next promote of what testing pins; I am not promoting your head myself. After that promote I read the new server's log: "driving the run:" should be 0, and each read that times out one warning. **09:45Z 11-17: the same restart with the fix on production** Your promote of c6a21463 (server pod started 09:43:14Z, leading epoch 598 at 09:43:22Z, 102 jobs re-attached) against the promote of f9cb88e3 at 06:30Z: | | 06:30Z, f9cb88e3 | 09:43Z, c6a21463 | |---|---|---| | open head runs driven again | 40 | 69 | | `left_along` statements the database cancelled at 30 s | 34 | 47 | | "driving the run: db error" | 34 | 0 | | head runs ended by it | 34 | 0 | | checks told `error` with the statement's words | 1,009 | 0 | | jobs found open and given up | 34 | 0 | | warnings "reading what older heads left the run … stand at its own place in line" | (no such line) | 47 | The three head runs that finished in the first five minutes ended with 0 errors each. So the first half of what was missing here is closed: the read can no longer end a run. The second half is open and yours: the statement was answered late 77 times at this start, up to 30.4 s, from 09:44:06Z to 09:44:47Z, and 47 of them were cancelled, with a `blob_refs` read and a `test_flakes` delete beside them as at 06:31Z. For those 47 heads the checks older heads left them stand at their own place in line, so across a takeover under load 8d736d69 keeps no place; and the database's two cores are taken for half a minute at every start. I leave the issue open for that. **10:16Z 11-17, the fault came back with a rollback.** Production was pinned back to f9cb88e3 (infra 521d3e7f), a build without 8334f739. Its start at 10:16:20Z (epoch 599) cancelled 48 statements at the timeout and ended 47 runs at 10:17:03Z with "driving the run: db error: ERROR: canceling statement due to statement timeout". The start of c6a21463 at 09:43Z, with the fix, cancelled 47 and ended none. Any start of a build before 8334f739 ends the open head runs driven again while this read stays over 30 s. **11:21Z 11-17, forward again and clean.** Production was promoted to eae869f7 (epoch 600 at 11:21:15Z). Its start cancelled 33 statements at the timeout, wrote 29 of the fix's warnings and ended no run; the worker went from node protocol 77 to 80 and re-attached 109 jobs. Three starts today, side by side: | start | build | has 8334f739 | statements cancelled | runs ended by their drive | |---|---|---|---|---| | 09:43Z | c6a21463 | yes | 47 | 0 | | 10:16Z | f9cb88e3 | no | 48 | 47 | | 11:21Z | eae869f7 | yes | 33 | 0 | The 47 head runs ended at 10:17Z stand finished with 79 checks told `error`, and their commits were not asked again. The read itself still passes 30 s at every start, which is what this issue stays open for.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
tilo/t#95
No description provided.