fix: diagnose TruthBench generated-code sandbox crashes - #189
Merged
Merged
Conversation
Scheduled CI intermittently reports a generated_code_sandbox regression whose only evidence is "generated code exited -11: " - a segfault in the sandbox subprocess with empty stderr and no indication of which script. - Run the sandbox with -X faulthandler so native crashes dump a traceback to stderr (already canary-scanned and redacted before reporting). - Pin OMP/OpenBLAS/MKL/Polars/Rayon thread pools to 1 and LANG=C.UTF-8 in the otherwise empty sandbox environment. - Prefix sandbox gate failures with domain/surface.
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
FreshData benchmark report —
|
| fixture | n_rows | n_cols | p50 s | p95 s | peak MB | repair % | false-repair % | preserve % | trust | monotonic | export % |
|---|
Authored-code reduction (Metric 6)
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.
Summary
The scheduled CI
truthbenchjob fails intermittently (09-01, 09-04, 09-06) with:The downloaded
truthbench-resultsartifact gives the only evidence:{"name": "generated_code_sandbox", "failures": ["generated code exited -11: "]}That is a segfault (SIGSEGV) in the sandbox subprocess with empty stderr. It is not a timeout or a canary leak, and neither the run nor the report shows which generated script crashed.
This PR is the diagnose-first step: it doesn't change what passes or fails, but the next crash will be explained.
Changes
benchmarks/truthbench/generated_code.py:-X faulthandler, so a native crash writes its Python traceback to stderr. The dump holds only file, line and function names, and stderr is already scanned for canaries and redacted before it is reported.OMP_NUM_THREADS,OPENBLAS_NUM_THREADS,MKL_NUM_THREADS,POLARS_MAX_THREADS,RAYON_NUM_THREADS= 1;LANG=C.UTF-8). Without them, BLAS/OpenMP/Rayon size their pools from the host core count, which is the leading suspect for a crash that happens only on some runners.benchmarks/truthbench/runner.py: sandbox gate failures are prefixed withdomain/surface, so the report names the crashing script.If crashes continue after this, the faulthandler output should point at the module to fix. A narrowly scoped retry for signal exits (PR/scheduled ratchet only, never the release gate) stays a fallback, not part of this change.
Tests
tests/truthbench/test_generated_code.pyuses the existingpython=hook with a fake interpreter to test two things:-I -X faulthandlerand the pinned thread variables.exited -11and theSegmentation faultfaulthandler dump.Results:
pytest tests/truthbench: all passruff check benchmarks/truthbench tests/truthbench: cleanmake truthbench-pr:generated_code_sandbox: pass,overall: PASS