Skip to content

Phase 7.4: Snapshot-under-churn stress test (8 workers + 1 sampler, 5s) - #24

Merged
jayakasadev merged 1 commit into
mainfrom
feature/phase-7-4-stress-test
Jun 11, 2026
Merged

jayakasadev merged 1 commit into
mainfrom
feature/phase-7-4-stress-test

Conversation

@jayakasadev

Copy link
Copy Markdown
Owner

Summary

Stress test for the lock-free SampledList + H1–H4 dealloc hooks under concurrent churn.

  • Workload: 8 worker threads in alloc/free tight loops cycling sizes [16, 64, 256, 1024, 16384]; 1 sampler thread invokes snapshot every ~10ms. Total runtime ~5s.
  • TSan-clean by construction — no shared mutable state outside snmalloc internals.
  • Profile-enabled Config in the test (matches profile_e2e.cc / profile_integration.cc pattern) — needed to exercise H1–H4 since the default snmalloc-testlib is built with NoClientMetaDataProvider.
  • Snapshot call site: directly invokes SamplerGlobals::list().snapshot()/debug_count() rather than the FFI thunk (rust.cc only compiles into snmallocshim-rust, not into the testlib used by perf tests). Equivalence documented in the file's header.
  • TSan/ASan invocations documented in the file header as a comment block — CI matrix to wire those variants later.
  • OFF-build stub: under SNMALLOC_PROFILE=OFF the body compiles to printf("skipped") + return 0.

Measured this run: ~15M alloc/free pairs across 8 workers + ~417 snapshots; max live sample window ~16k (check) / ~1k (fast).

Test plan

  • perf-profile_stress-fast (SNMALLOC_PROFILE=ON)
  • perf-profile_stress-check (SNMALLOC_PROFILE=ON)
  • perf-profile_stress-fast (SNMALLOC_PROFILE=OFF, stub path)
  • perf-profile_stress-check (SNMALLOC_PROFILE=OFF, stub path)
  • TSan / ASan invocations — deferred to CI matrix

- 8 worker threads tight-loop alloc/free at sizes [16,64,256,1024,16384]
- 9th sampler thread snapshots SampledList every ~10ms for 5s
- exercises H1-H4 dealloc hooks + lock-free SampledList under churn
- TSan/ASan-clean by construction; sanitizer cmd lines documented inline
- SNMALLOC_PROFILE=OFF path collapses to a "skipped" stub
@jayakasadev
jayakasadev merged commit 4ff64df into main Jun 11, 2026
154 of 208 checks passed
jayakasadev added a commit that referenced this pull request Jun 11, 2026
- Adds two ubuntu-24.04 clang Debug matrix legs to the existing
  ubuntu job in .github/workflows/main.yml so the heap-profiling
  code paths exercised by perf-profile_stress and the func-profile_*
  suite are run under ThreadSanitizer and AddressSanitizer.
- Both legs configure -DSNMALLOC_PROFILE=ON and the project's
  existing SNMALLOC_SANITIZER cmake option (=thread / =address)
  instead of raw CMAKE_CXX_FLAGS=-fsanitize=...; this is the
  idiomatic mechanism already used by the existing "TSan + UBSan"
  matrix entries (CMakeLists.txt:73-75, 580-606, 668-672) and
  correctly wires -fsanitize through to test-target compile and
  link lines plus the SNMALLOC_THREAD_SANITIZER_ENABLED define
  the codebase guards on.
- The TSan leg installs libc++-dev and uses -stdlib=libc++ to
  match the existing TSan + UBSan legs (libstdc++ on Ubuntu is
  not TSan-instrumented).  The ASan leg uses the default
  libstdc++ runtime, which is ASan-compatible.
- Both legs pass `-R profile_` via test-extra-args so ctest runs
  only the profile suite (perf-profile_stress-{fast,check} +
  func-profile_*).  This bounds sanitizer overhead within the
  CI time budget while still exercising the new snapshot-under-
  churn workload from PR #24.
- Local validation: configured + built + ran perf-profile_stress-fast
  on darwin-arm64 with -DSNMALLOC_SANITIZER=address; the fast
  variant ran ~5s under ASan with no diagnostics.  TSan was not
  validated locally because the macOS toolchain available here
  does not ship a TSan-instrumented libc++; relying on the
  GitHub ubuntu-24.04 runner for that leg as called out in the
  ticket.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant