omniprobe icon indicating copy to clipboard operation
omniprobe copied to clipboard

Omniprobe wrapper silently masks child-process exit codes

Open lwitschen opened this issue 6 months ago • 1 comments

Summary

omniprobe/omniprobe::capture_subprocess_output reads the wrapped child's stdout/stderr but does not propagate the child's exit code. Combined with the top-level invocation in the same file, which discards any return value, every wrapped command exits 0 regardless of how the child terminated (non-zero exit, SIGABRT, SIGSEGV, etc.).

Evidence

  • omniprobe/omniprobe:115-184 (capture_subprocess_output): the comment # Get process return code on line 165 is followed by buffer-draining logic only; process.returncode is never read or returned.
  • omniprobe/omniprobe:788: capture_subprocess_output(parms.remaining[1:], ...) discards any return value; no sys.exit() with the child's status.

Expected behavior

Wrapper exit code mirrors the child's. Signal terminations surface as 128 + signo (or whatever convention the harness chooses).

Impact

  • CI cannot rely on the wrapper exit code to detect instrumented-child failures; consumers have to grep stderr for diagnostic strings.
  • Downstream test scripts that gate on omniprobe exit status silently pass on instrumentation crashes.

Suggested fix

  1. capture_subprocess_output: return process.returncode (and a sensible value for the KeyboardInterrupt path, e.g. 130).
  2. Top-level invocation: sys.exit(capture_subprocess_output(...)).

lwitschen avatar May 12 '26 09:05 lwitschen

Fixed, and now pushed.

Worth being straight about the timeline: this was actually fixed on 2026-09-08, in c5aec00, but that commit sat unpushed on a local main for seven weeks along with 30 others. So the issue stayed open long after the code stopped being broken. Nothing was waiting on a decision — the fix was finished and just not visible from here.

The reason it lingered is the one acceptance criterion that needed a gfx90a node: the gate demands a full tests/run_all_tests.sh with Suites skipped: 0, and the instrumented rocBLAS/hipBLASLt suites skip on any other architecture. Work had been happening on gfx950. Today's session landed on gfx90a, the criterion was met with no change to the code, and the whole batch went out.

What landed (c5aec00, tests in 80bcf2e), matching your suggested fix closely:

  • capture_subprocess_output now returns process.returncode instead of discarding it, and returns rather than exiting on failure — so the rocminfo caller at omniprobe/omniprobe:225 is unaffected.
  • The top-level invocation exits with the child's status.
  • Signal deaths surface as 128 + signo via a named shell_exit_status() helper, per your expected behaviour: a SIGSEGV target now reports 139, a target exiting 42 reports 42, and a successful target still reports 0.
  • The Python API (omniprobe/api/omniprobe.py) raises RuntimeError on a crashing target rather than quietly returning "[]".
  • JSON output is finalized before the exit, so a failing run still produces a parseable file rather than none.

Covered by a new regression suite, tests/test_exit_status.sh, registered as suite 11 in run_all_tests.sh. It needs no GPU — every target is a /bin/sh stub — so it runs anywhere.

One thing your "Impact" section called correctly, beyond what it claimed. Downstream scripts gating on the wrapper's status didn't just silently pass on crashes; the constant 0 had been actively misread as evidence about the hardware. A project note recorded that running a gfx90a binary on a gfx950 GPU "fails to dispatch silently, producing exit 0 with no output". It does nothing of the kind — it dies of SIGSEGV and exits 139. The silence was this bug, seen through the wrapper, and two phantom "known defects" had already been attributed to that misreading. Both have since been retracted.

rwvo avatar Oct 26 '26 08:10 rwvo