Repository navigation
A rebuild-memory test on the rotated free-slip + custom-FMG + split-fault path (refs #948) - #951
Merged
Merged
Conversation
… not grow memory (#948) #882's rebuild test covers a plain Stokes solve and passes on development f631ce4, where the zg95 fault runs grow about 190 MB per rank at every fault rebuild. This is its fixture on the path those runs take. Each rebuild cuts a new fault into one refined base and solves with rotated free slip on every wall, the fault's own constraint, and the custom FMG with the FAC patch keyed on the fault's cells. The bound is test_0078's: 10 MB of resident set per rebuild on the worst rank, Linux only. The test is not yet shown to fail; it goes to kaiju at np 2 and 4 against development. In serial, PETSc's object table balances on this path, and on five others, at 2 and 4 rebuilds (wombat probe). A parallel leak lives where petsc4py defers destruction, which only the resident set sees. Underworld development team with AI support from Claude Code
's cause is known #948's growth came from a monitoring hook outside the library that kept every rebuild's solver alive. The test covers the library path those runs take (rotated free slip, a split fault, the custom FMG, the FAC patch) and guards it against a leak appearing there. It measured 1.0 MB per rebuild at np 2 and 0.7 MB at np 4 in CI's environment. Underworld development team with AI support from Claude Code
…akref check, three levels (review) Findings of the adversarial review of ff4b674, all fixed: - The first reading of the resident set was taken with the last warm-up rebuild's objects still on petsc4py's deferred list, and the last reading after a mesh had emptied it, so up to one rebuild's footprint was hidden. A mesh is now built before both readings, here and in #882's test_0078, which had the same pattern. - A Python-held pin, #948's kind, is deterministic. Weak references to every measured rebuild's mesh and solver must be dead once dropped; this runs on any platform. Serially, a hook-style pin keeps 6 of 6 alive, and none survive without it. - The resident-set bound is 5 MB per rebuild, not 10. A pinned solver adds about 60 MB per rebuild of this fixture in serial. - The base has three levels (cellSize 0.1, refinement 2: 242 / 968 / 3872 cells), so the FAC gate runs on a middle level, at the same cost. - The timeout is 600 s, and the docstring's claims are dated and narrowed. Both checks are tier C until a pinned run at np 2 on Linux shows them failing. Underworld development team with AI support from Claude Code
On hyperion, in CI's environment at np 2 (2026-11-06): - as written: both tests pass, 2.61 MB per rebuild with no object alive; - with every Stokes solver held in a module-level list, as #948's monitoring hook did: both fail, 20 objects alive and 49.4 MB per rebuild. The bound is 10 MB, about four times the measured growth and five times below the pinned signal. The weak-reference check catches a pin deterministically whatever the bound. Underworld development team with AI support from Claude Code
Member
Author
Adversarial review, round 1 (ff4b674 against development eddab70)A separate agent reviewed the branch against Can the test fail on a leak of #948's kind? Yes. Serially, a hook-style pin (every Stokes solver appended to a module-level list) retains 60.5 MB of heap per rebuild of this fixture, against 0.19 MB without it. Pinning the mesh alone retains the same. At np 2 we estimate about 30 MB per rank, three times the bound. Findings and what was done
Attacks that failed
Underworld development team with AI support from Claude Code |
This was referenced Nov 6, 2026
Merged
gthyagi
pushed a commit
to gthyagi/underworld3
that referenced
this pull request
Nov 10, 2026
A parallel batch hung on a CI runner and on no other machine (test_1064's spherical case, underworldcode#951's shard 4). The supervisor's diagnosis went to a temporary directory on the runner and was lost, and its "stuck, not slow" rests on Python frames, which stop at the C boundary: an MPI wait and a long KSP solve read alike. The supervisor now takes each rank's native stack with gdb when gdb is on the path, writes rank_N_pid_P.native beside the Python stack and quotes the main thread's innermost frames in the log. Without gdb it says so. Each rank allows the attach itself with PR_SET_PTRACER, so no root and no sysctl are needed where Yama restricts ptrace. The CI shards install gdb, without failing the shard if that does not work, and upload /tmp/uw-stacks-* when the shard fails, kept five days. tests/test_0063_mpi_hang_supervisor.py (written first) plants a hang at np 2 and needs rank 1's native stack, and the log, to reach the barrier it waits in. Before: no native stack. After: 4 passed. Underworld development team with AI support from Claude Code
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.
Refs #948.
#882's rebuild-memory test (test_0078) covers a plain Stokes solve with Dirichlet walls. This adds its fixture on the path the zg95 fault runs take, which test_0078 does not reach:
add_fault+add_fault_bc);Each rebuild cuts a new fault into one refined base, as a driver's rebuild does, and drops everything.
What #948 was, and why this test
#948's runs grew about 190 MB per rank at every fault rebuild. The cause was outside the library. kaiju-launch's monitoring hook (
coarse_log_hook.py) appended every Stokes solver to a module-level list, and nothing removed them, so every rebuild's solver, mesh, coarse levels and multigrid hierarchy stayed alive. A referrer walk on kaiju named the list.On this path the library keeps no mesh or solver per rebuild. This test guards that.
The checks
One run of 2 warm-up and 5 measured rebuilds feeds two tests:
A mesh is built before each reading of the resident set, to empty petsc4py's deferred list, so both readings see the same state. #882's test_0078 had the same asymmetry and gets the same one-line fix here.
Proven at np 2 in CI's environment on hyperion (2026-11-06):
Both tests are therefore tier B.
The review asked for a 5 MB bound. It is 10 MB, because the three-level fixture measured 2.6 MB per rebuild without a pin, and 5 MB would sit within a factor of two of that on CI's runners. 10 MB is still five times below the pinned signal, and the weak-reference check catches a pin whatever the bound.
#882's test_0078, with the same flush before its first reading, still passes at np 2.
Cost
36.8 s at np 2 and 24.0 s at np 4, in CI's environment on kaiju, for the earlier two-level fixture. The three-level fixture costs the same serially. Both tests are skipped below np 2, and the resident-set check off Linux. They run in the MPI phase of
scripts/test.sh, through thetests/parallel/test_*.pyenumeration; no batch line is needed.Review
One adversarial review round is posted below. Its findings are fixed in 1b23336, and the bound settled at 10 MB in 4d63619 after the np-2 measurement. It filed #950: PETSc's options database grows by about 41 entries per rebuild, never removed. That is library-side but small, and not fixed here.
Underworld development team with AI support from Claude Code