mirror of
https://github.com/Tencent/flare.git
synced 2026-10-16 20:31:05 +08:00
8396477144
* ci: add ASan/TSan fiber regression lane (#134, #196) The fiber-switch sanitizer fixes (#134 ASan/TSan SEGV, #196 detect_stack_use_after_return) had no automated coverage -- flare's CI is blade-based and never built under sanitizers, so these bugs sat undetected. Add a Bazel + clang job that builds and runs a curated set of fiber tests under both `--config=asan` and `--config=tsan` (matrix). Also add a `tsan` config to .bazelrc (mirroring the existing `asan` one). Scope: a curated list of fiber tests that pass cleanly under both sanitizers, which is enough to catch any regression of the fiber-switch fixes. The full `//flare/fiber/...` is intentionally NOT used -- it has unrelated sanitizer problems out of scope here: curl fails to foreign_cc-build under -fsanitize; a few sync-primitive tests (scheduling_group/latch/waitable) have their own ASan/TSan failures; and some tests exceed even a raised timeout under TSan. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * ci: download bazelisk to a temp path (repo has a bazel/ dir) The install step did `curl -o bazel`, but flare tracks a `bazel/` directory, so curl failed with exit 23 (can't write over a directory) before any test ran. Download to $RUNNER_TEMP instead. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * ci: narrow sanitizer_fiber to a fast core set, tighten timeout The 15-test set was fine under ASan (~4 min) but pathologically slow under TSan on shared 2-4 core runners (the heavier sync-primitive tests). Narrow to a focused set that exercises fiber create/resume/switch -- enough to guard the switch fixes, since a broken switch crashes every fiber test on first resume. Drop --test_timeout to 300s so a straggler fails fast instead of stalling. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * ci: pin sanitizer_fiber to clang-17 (clang-18 TSan header clash) flare's annotation.h hand-declares __tsan_* interface symbols (mutex flags, fiber no_sync) that collide with clang-18's <sanitizer/tsan_interface.h> ('non-static declaration follows static declaration'), breaking the TSan build. That's a separate pre-existing issue; pin the lane to clang-17 (the toolchain the fiber-switch fixes were verified on) so the regression guard is green. clang-18 TSan-header compatibility tracked separately. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * ci: force clang-17 via bazel --repo_env (update-alternatives ignored) The previous attempt used update-alternatives to point /usr/bin/clang at clang-17, but bazel's autodetected toolchain still resolved clang-18 (/usr/lib/llvm-18/bin/clang) from the runner's PATH, so the TSan build kept hitting the clang-18 tsan_interface.h clash. Configure the toolchain compiler explicitly with --repo_env=CC=/usr/bin/clang-17 (and CXX), and drop --config=llvm (which forced the generic 'clang'). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * ci: make clang-17 install non-interactive (apt hang) A TSan-leg runner got stuck in the apt install step (the ASan leg's identical step passed) -- a needrestart/debconf interactive hang. Set DEBIAN_FRONTEND=noninteractive + NEEDRESTART_MODE=a, sudo -E, and --no-install-recommends so the install can't block. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * ci: use preinstalled clang-17, stop apt-installing it (apt hangs) Multiple runner instances hung in 'apt-get install clang-17'. ubuntu-24.04 ships clang 16/17/18 preinstalled, so locate clang-17 directly (probe /usr/bin/clang-17 and /usr/lib/llvm-17/bin/clang) and point bazel at it via --repo_env. No apt install -> no hang; if clang-17 were ever absent the step fails fast instead of stalling. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * fiber/ci: build TSan via <sanitizer/tsan_interface.h>; use default clang in CI annotation.h hand-declared the __tsan_* symbols (fiber API, mutex API + flag constants, acquire/release). Those collide with compiler-rt's <sanitizer/tsan_interface.h> ("non-static declaration follows static declaration") whenever that header is in the translation unit under -fsanitize=thread, which broke the TSan build on the CI runners (both the default clang-18 and the runner's clang-17 hit it). It is NOT version-specific. Include the canonical header directly instead of redeclaring. FLARE_INTERNAL_ USE_TSAN is only defined under -fsanitize=thread, and any toolchain providing that flag ships this header (verified: clang-17, and gcc-13 which also defines __SANITIZE_THREAD__ and exposes the fiber/mutex API), so it's always available. With the build no longer tied to a clang version, drop the CI lane's clang-17 pinning (which needed an apt install that intermittently hung) and just use the runner's default clang via --config=llvm. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>