Fix two transaction hangs, and other CI flakes - #134
Conversation
Current Aviator status
This PR is not ready to merge (currently in state pending): this PR has not been approved. Pending Status Checks
See the real-time status of this PR on the
Aviator webapp.
Use the Aviator Chrome Extension
to see the status of your PR within GitHub.
|
c504154 to
a4ba4d0
Compare
state_managers: don't hand a lock hold to a waiter that gave upThere was a problem hiding this comment.
Pull request overview
Fixes transaction hangs caused by cancelled lock waiters and interrupted coordinator aborts.
Changes:
- Safely discards abandoned lock waiters and restores interrupted upgrades.
- Publishes coordinator aborts before cancellable cleanup.
- Adds lock regression tests and increases a flaky test’s timeout class.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
reboot/aio/state_managers.py |
Updates lock and transaction-abort handling. |
tests/reboot/state_manager_tests.py |
Adds cancellation regression tests. |
tests/reboot/zod/concurrent_transactions_same_state/BUILD.bazel |
Increases the test size to large. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
02800df to
0cb9773
Compare
In the state manager, callers take `Lock`s per state - but before this commit it was possible for a caller to be granted a `Lock` after the caller was cancelled. In that case the `Lock` was never released again, and the state it guarded became unusable for the life of the process. That caused CI flakes. Specifically, before this change, `Lock._maybe_grant_next()` would grant the lock to the waiter at the head of its queue without checking whether that waiter was cancelled or not. Cancellation of callers is routine, so there were many ways CI runs could flake - the most common flake was the new `//tests/reboot/pydantic/concurrent_transactions_same_state:test_py` which flaked ~80% on MacOS (oof). This commit makes it so that all forms of lock-taking will avoid granting locks to waiters that have been cancelled. Additionally, the `zod` version of `concurrent_transactions_same_state` would regularly time out even without hitting the flake, so this commit also bumps its timeout. TESTED: five new unit tests cover all cases that used to be broken.
A participant only ever learns that its transaction aborted from the coordinator, by watching it. If that news never arrives the participant blocks forever, holds its state's lock forever, and any retry reusing the same idempotency key blocks behind it. Before this change, `_transaction_coordinator_abort()` resolved the `_coordinator_participants` future last, after awaiting a database cleanup and a fan-out of best-effort `Abort` RPCs whose own handler re-raises `CancelledError`. A coordinator cancelled during either await -- which is what happens when its caller goes away -- left the future pending with nothing left to resolve it, blocking every participant forever. This commit reorders the abort to first resolve the future and drop its entry, ahead of anything that can be interrupted. Answering before the database cleanup lands is safe because an abort is never something the coordinator records: the durable outcomes are "preparing" and "absent", and recovery re-drives a "preparing" transaction into the same abort.
26a92b8 to
80f5843
Compare
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
013a472 to
fac8d23
Compare
Our MacOS runners are the slowest and most expensive ones we have, and over-saturated runners cause frequent timeouts in our largest tests. This commit removes several redundant large tests from its coverage, reducing run time by ~51 minutes and hopefully reducing over-saturated-runner timeout flakes. Before this change, the MacOS job ran every test under `//tests/...` that wasn't explicitly excluded — 219 targets, 28 of them `large` or carrying a `long` timeout. Many of those tests don't tell us anything that the Linux runners don't already tell us: they type-check TypeScript, exercise pure application logic on top of the Reboot runtime. Other `large` tests drive a toolchain (`uv sync`, `rbt generate`, `npm install`, `rbt dev run`) that another test running on MacOS drives too. These useless tests add up to ~51 minutes of MacOS runner usage per run. This commit adds a `platform-independent` tag, which indicates tests that don't add meaningful coverage for the MacOS platform. the MacOS job's `bazel query` now excludes these.
fac8d23 to
a77547e
Compare
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
Before this commit, the `agent-wiki`'s test asked for a `large` test; we don't think it actually needs that. It claims it's for `uv sync`, but we've not seen any recent evidence of a fully cold `uv sync` taking more than ~1.2s. The target runs in 35-71s across the last 22 MacOS jobs, comfortably inside a `medium` budget. The timeouts it _did_ have look more like the hangs the previous commits fixed. This commit therefore removes the `large` test request for `agent-wiki`.
cca1867 to
061176e
Compare
|
@benh can you bump this to the top of your queue? These flakes make CI unpassable for all other PRs, and you're clearly the appropriate reviewer for transaction logic changes. |
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
CI is currently ~unpassable because of CI flakes. Most notably
//tests/reboot/pydantic/concurrent_transactions_same_state:test_pyis ~80% flaky. An agent identified two hangs in the transaction code from those flakes. These each have their own commit to fix them, please see the individual commit descriptions for details.Additionally, we address timeouts and flakes in MacOS CI that are due to overload by reducing its workload, removing tests that don't add meaningful coverage.
Note that while the first commit's case is proven with unit tests, the second is hard to repro so needs some human reasoning to validate.