Repository navigation
fix: deflake //rs/nns/governance:governance_integration_test - #12259
Merged
basvandijk merged 3 commits intoNov 24, 2026
Merged
Conversation
Cap the number of Apalache processes that run at the same time in a process to 8, with a process-wide semaphore that run_apalache holds while Apalache runs. governance_integration_test started all 99 of its Apalache JVMs at once (23 TLA-checked tests in parallel, up to 10 JVMs each) and needed about 33-38 GiB, so the 64 GiB, swapless Namespace RBE workers it shares with 15 other actions ran out of memory and OOM-killed it. With the cap it peaks at about 8 GiB. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The semaphore OOM fix lacks regression tests for its concurrency bound, waiter wake-up, and permit restoration after unwinding, with coverage also needing Bazel test wiring.
1 open issue
What changed in this PR
This PR reduces memory pressure behind governance integration-test flakes on Namespace remote build workers by limiting concurrent Apalache processes in the shared TLA checker.
Changes:
- Adds a process-wide semaphore limiting each test binary to eight concurrent Apalache processes.
- Holds a permit throughout process execution and releases it automatically when the checker returns.
- Documents the checker’s new capacity-waiting behavior.
| File | Description |
|---|---|
rs/tla_instrumentation/tla_instrumentation/src/checker.rs |
Adds the semaphore, guards Apalache execution, and documents the concurrency limit. |
Review effort: Balanced
Test the semaphore's permit accounting, that a waiter wakes up when a permit is released, and that a permit is released when its holder panics. Add the tla_instrumentation_test target, which runs the crate's unit tests under Bazel, including the existing tla_state test. Co-Authored-By: Claude Opus 5.5 <[email protected]>
pierugo-dfinity
approved these changes
Nov 24, 2026
Wait with Condvar::wait_while, propagate a poisoned lock as a panic, and document the wait on run_apalache, where the permit is taken. Co-Authored-By: Claude Opus 5.5 <[email protected]>
basvandijk
enabled auto-merge
November 24, 2026 13:37
basvandijk
deleted the
ai/deflake-governance_integration_test-2026-11-24
branch
November 24, 2026 14:52
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

//rs/nns/governance:governance_integration_testflaked in about 7% of its executions on Namespace RBE, and never on the self-hosted runners. All 9 failed attempts last week died the same way. The RBE worker's kernel OOM killer SIGKILLed the test binary, which Bazel prints asFAIL: ... (Killed).The test's 23 TLA-checked tests run in parallel, and each started up to 10 Apalache JVMs at once (
MAX_THREADSperperform_trace_checkcall). So all 99 JVMs ran together, and the test needed about 33-38 GiB. RBE workers have 64 GiB, no swap and 16 action slots. When the other actions on the worker held another 22-31 GiB, it ran out of memory. Since #12052 moved CI Main's tests to RBE, these flakes show up in CI Main.Changes
run_apalacheinrs/tla_instrumentationnow holds a permit from a process-wide counting semaphore while its Apalache process runs. The semaphore is astdMutexandCondvar.MAX_CONCURRENT_APALACHE_PROCESSES(8) Apalache processes run at the same time per process. Further checks wait until one exits.tla_instrumentation_testtarget runs the crate's unit tests under Bazel:tla_statetest, which no target ran before.Behaviour changes
Peak memory and wall time of
governance_integration_testfor different limits, measured locally on 32 CPUs:The limit applies to every test that checks TLA traces:
merge_neurons_test;rs/nns/integration_teststests that callperform_trace_check;rs/tla_instrumentationtests.This PR was created following the steps in
.claude/skills/fix-flaky-tests/SKILL.md.🤖 Generated with Claude Code