Repository navigation
CI keeps the MPI supervisor's stacks, and they reach native frames - #954
Conversation
A parallel batch hung on a CI runner and on no other machine (test_1064's spherical case, #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
|
Adversarial review of #954 at 99cd966 The branch keeps the MPI supervisor's stacks as a CI artifact and adds a gdb native stack per rank. Evidence:
Must fixM1. [high]
Should fixS1. [medium] The CI run printed both of these lines:
S2. [medium] The install step is S3. [medium] Mutants we constructed and the test that catches each:
The fake-gdb probe reaches every branch of S4. [medium]
S5. [low] On POSIX S6. [low] Probe (gdb exits 1 with S7. [low] S8. [low] "the handler below allows it with S9. [low] Yama accepts the declared tracer and any of its descendants. The supervisor writes the module, so it can embed its own pid. NotesN1. The stacks #951 needed already exist. Run 42170374397 reproduced the hang on this PR's merge commit, and its artifact has both ranks' Python and native stacks; it expires 2026-11-11. The hang is not specific to #951. It reproduced on the development push at eddab70 (42095953261), which is this branch's merge base, and on #946's runs. If #951 is rerun anyway, a re-run keeps the original event's N2. N3. N4. N5. N6. Pre-existing, flagged under Charter §2.
N7. Artifact name on a re-run attempt. We did not verify this. upload-artifact v4 fails on a name that already exists in the run ( N8. The log quotes the 8 innermost frames of the main thread. In both CI attaches the innermost frame was Attacks that failed:
Issue verdicts
Not checked
Underworld development team with AI support from Claude Code |
BLAS picks its kernels from the CPU, and #963's solve stops finishing only on some runs, with the same tree, runner image and lockfile. The next hang then says which host it was on. Also prints ptrace_scope, which the native stacks depend on. Refs #963 Underworld development team with AI support from Claude Code
The upload ran only on failure(), but a shard at its cap is cancelled, and a hung shard finishes within a minute of 60: now failure() || cancelled(), with a 70-minute cap. The supervisor takes two native samples and says whether the frames moved, because one sample could not tell the first real stacks' solve from a loop. A refused attach quotes gdb's reason, a hung gdb keeps what it printed, an undecodable byte costs no rank its stack, and at most 8 gdbs run at once. The log quotes frames from the first MPI routine. PR_SET_PTRACER names the supervisor, not any process, and comes after the dump handler is armed. test_0063: the native path is tested serially with a script standing in for gdb, and the real test fails rather than skips on CI with no gdb. 10 passed. CI reports the CPU, the OpenBLAS kernel and the OpenMP and BLAS settings per shard. Refs #963 Underworld development team with AI support from Claude Code
|
Review addressed at the new head.
#963 is now reproduced off a runner, by forcing OpenBLAS kernels, so this PR's headline case is decided: that hang is a solve that does not finish, not a collective mismatch. Details are on #963. Underworld development team with AI support from Claude Code |
CI now keeps the MPI supervisor's stacks when a shard fails, and those stacks reach native frames, so a hang that happens only on a runner can be told from a slow solve.
What was wrong
Parallel shard 4 hung on #951's runs in
test_1064_rotated_freeslip_parallel's fifth test, with every rank in_solve_rotated_iterative(run 42130702511). It does not reproduce elsewhere: the samescripts/test.sh --p 2 --shard 4/4on hyperion passes, pinned to 2 cores (4033 s) and unpinned (6174 s), and so do the batch and its first three files.Two things stopped the diagnosis:
/tmp/uw-stacks-*on the runner and were lost with it._solve_rotated_iterative()and both burn a core.The fix
scripts/mpi_supervisor.py: when gdb is on the path, it takes each rank's native stack after the Python samples, writesrank_N_pid_P.nativebeside the.stackfile, and quotes the main thread's innermost frames in the log. Without gdb it says so and the Python diagnosis stands.PR_SET_PTRACER, so no root and no sysctl are needed where Yama restricts ptrace. That is a no-op elsewhere..github/workflows/build_uw3_and_test.yaml: the shards install gdb, without failing the shard if that does not work, and upload/tmp/uw-stacks-*ashang-stacks-shard-Non failure, kept five days. Neither gdb nor py-spy is in the pixi env, so it comes from apt.A planted hang at np 2 now logs:
No parallel test file is added, so no MPI batch moves. The optional KSP monitor switch on the test was dropped: the rotated solve builds its own KSP under a per-solve prefix (
rotfsN_), so the solver's options do not reach it, and the native stack answers the same question.Tests
tests/test_0063_mpi_hang_supervisor.py::test_a_hang_gets_native_stacks_that_reach_the_mpi_library, written first, needs rank 1's native stack and the log line to reach the barrier it waits in. Before:expected a native stack per rank, got []. After: 4 passed in the file. It skips where gdb is absent, so without the apt step it would not run on CI.The workflow change is only checked as valid YAML: it can run only on a runner. A failed shard on this PR would be the first real test of the upload.
Refs #951
Underworld development team with AI support from Claude Code