Add TSan nightly CI workflow#2402
Open
cuihtlauac wants to merge 2 commits intomirage:eiofrom
Open
Conversation
New .github/workflows/tsan.yml runs the test suite under ThreadSanitizer on a nightly cron (plus manual and opt-in `tsan` label on PRs). Runs the default suite alongside a new @tsan-stress alias, with halt_on_error=0 so a single run surfaces every race TSan observes. Reports are uploaded as a workflow artifact. The existing multicore and QCheck-STM tests become scalable via env vars: IRMIN_STM_ITER, IRMIN_STM_PACK_ITER, IRMIN_MULTICORE_DOMAINS, IRMIN_MULTICORE_ITER. Defaults match prior behaviour, so normal `dune runtest` is unchanged. The @tsan-stress alias (test/irmin-pack/test_tsan_stress/) ships as an empty dispatcher; per-hotspot scenarios (dict refill, irmin_mem cache, watch globals, fs pool, append_only_file buffer) land in a follow-up PR. This adds detection only; no src/ changes. Expect the first nightly run to surface several known races from mirage#2397 — that output is the baseline for follow-up fixes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 tasks
dune @fmt / ocaml-ci's lint-fmt rejected two short match/if bindings that fit on a single line. No semantic change. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
Adds a nightly GitHub Actions workflow that runs the Irmin test suite under ThreadSanitizer (TSan) to hunt for data races on the eio branch.
.github/workflows/tsan.yml— nightly cron (0 3 * * *) +workflow_dispatch+ opt-in PRtsanlabel. Ubuntu-latest bare runner, 75-min timeout, opam cache keyed on the TSan compiler spec. Runsdune build @runtest @tsan-stressunder TSan withhalt_on_error=0 exitcode=66so a single run surfaces every race. Uploadstsan-report.*+tsan-run.logas artifact; writes a finding count to the job summary.test/irmin-pack/tsan_suppressions.txt— minimal runtime/FFI noise filter (caml_modify,caml_alloc_shr,called_from_lib:index). No Irmin-module entries by design.IRMIN_STM_ITER(default 500),IRMIN_STM_PACK_ITER(default 100),IRMIN_MULTICORE_DOMAINS(default 2),IRMIN_MULTICORE_ITER(default 1). All backward-compatible;dune runtestin regular CI is unchanged.test/irmin-pack/test_tsan_stress/ships as an empty dispatcher on a separate@tsan-stressalias so the workflow has a stable target. The five per-hotspot stress scenarios (dict refill,irmin_memcache,watchglobals,Irmin_fs_unixpool,append_only_filebuffer) land in a follow-up PR.Setup recipe is the one validated by the TSan PoC:
sudo sysctl vm.mmap_rnd_bits=28,libunwind-dev,ocaml-variants.5.3.0+options,ocaml-option-tsan,opam install duneexplicitly. All four Irmin pin-depends build cleanly under TSan (validated here).No
src/changes — this adds detection only. Expected first-run outcome: a nonzero number of races reported, matching the race patterns fixed in #2397. That output is the baseline for follow-up fix PRs.Context: part of the Irmin 4.0.0 release roadmap, #2401 Phase 6.
Test plan
tsanlabel to this PR → workflow fires → setup + switch build + cache +dune buildsteps all succeed.tsan-reports-<run_id>uploaded on completion, step summary shows### TSan findings: <N>.dune runtestbehavior on non-TSan CI jobs is unchanged (env vars absent → existing defaults).🤖 Generated with Claude Code