Repository navigation
CI: do not fail Build Post Hooks when build profile artifacts are absent - #107117
Conversation
The build_profile_hook post-hook runs on every master Build job and uploads three artifacts produced by utils/prepare-time-trace/prepare-time-trace.sh: the time-trace profile, binary_sizes.txt, and binary_symbols.txt. prepare-time-trace.sh does not emit every artifact for every build. binary_symbols.txt is produced only for non-LTO builds (the script guards nm with 'if ! grep -q -- -flto', since nm does not work with LTO), and cross-arch or non-Linux builds produce no readable objects at all (issue ClickHouse#84159). The hook opened all three unconditionally, so on LTO release builds and cross-arch builds the missing file raised FileNotFoundError, which the broad except turned into sys.exit(1), failing the 'Post Hooks' check on master across all such build variants for months (top variants arm_release and amd_release are LTO builds). Upload whatever prepare-time-trace.sh actually produced and skip artifacts that are absent or empty, instead of failing the whole post-hook. Add ci/tests regression coverage for the LTO, cross-arch, and native-build cases. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Pre-PR validation gate
Session id: cron:clickhouse-worker-slot-21:20260611-001400 |
|
cc @maxknv — could you review this? The build profile post-hook ( |
|
Workflow [PR], commit [7040fed] Summary: ❌
AI ReviewSummaryThis PR makes Tests
Final VerdictStatus: ✅ Approve |
|
CI summary for HEAD
|
|
@groenai, can you make the hook no-op for builds that do not produce profile data and do the profile data upload for others? If any error on the way, it should explicitly fail. |
Address review on ClickHouse#107117. prepare-time-trace.sh collects binary sizes with `find ... | xargs wc -c`. On a build with no readable objects (cross-arch / non-Linux) GNU xargs runs `wc -c` once with no arguments and writes a bare `0` row into binary_sizes.txt. That row does not match the binary_sizes FORMAT Regexp, so insert_build_size_data still failed and the post-hook exited 1 - the exact case this PR set out to fix. The earlier "skip absent or empty artifact" guard did not help because the file was non-empty. Fix at the producer: use `xargs -r` on the size and symbol collection so an empty input set leaves the artifact empty instead of emitting a junk row. With that, an empty artifact reliably means "no such profile data for this build", and the hook can: no-op for builds that produce no data, upload for builds that do, and fail loudly on any genuine processing or upload error (it never swallows one). Regression tests now run the real producer against an empty build dir and assert binary_sizes.txt is empty, model the present-but-empty producer output for the cross-arch case instead of an absent file, and cover that an upload error propagates. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
@maxknv pushed Root of the remaining failure (bot was right): the previous guard skipped absent/empty artifacts, but Fix is at the producer (the bot's preferred option): With the producer fixed, an empty artifact reliably means "no such profile data for this build", so the hook now:
Tests ( Verified both directions: old producer writes |
Pre-PR validation gate
Session id: cron:clickhouse-worker-slot-8:20260611-091900 |
|
CI finished on 7040fed. The only failed check is BuzzHouse (amd_tsan), and it is a known chronic trunk flake, not caused by this PR:
The other 3 BuzzHouse builds and all Stateless/Integration/Stress jobs passed on this commit. A BuzzHouse re-run clears Mergeable Check. Session: cron:our-pr-ci-monitor:20260618-050000 |
|
CI finished on
All other checks pass. No PR-caused failures. |
addb0fa
The build_profile_hook post-hook runs on every master Build variant and uploads compile-time-trace telemetry to a shared remote analytics DB. The ~25 variants of a master push finish and upload at once, so the per-user INSERTs routinely cross the DB's memory limit and one is killed with Code: 241 MEMORY_LIMIT_EXCEEDED (during ParallelParsingBlockInputFormat). insert_* turns that rejection into an AssertionError, which the hook treated as fatal (sys.exit 1), so a successful build was reported as a failed "Post Hooks" check. This telemetry is observability-only and has no bearing on the produced binaries, so a rejected upload must not fail the build. Catch upload errors per artifact in _upload_profile_artifacts, log them, and continue. Genuine build/producer errors still fail loudly: they surface earlier, in prepare-time-trace.sh under strict Shell.check and in local file assembly, outside the upload loop. PR ClickHouse#107117 guarded the missing/empty-artifact case (ClickHouse#84159) but left the remote-rejection case fatal; this addresses that remaining mechanism, which is the dominant cause of the chronic master Build Post Hooks failures across all variants (~600/day, build-content-independent). Co-Authored-By: Claude Opus 4.8 <[email protected]>
The build_profile_hook post-hook runs on every master Build variant and uploads compile-time-trace telemetry to a shared remote analytics DB. The ~25 variants of a master push finish and upload at once, so the per-user INSERTs routinely cross the DB's memory limit and one is killed with Code: 241 MEMORY_LIMIT_EXCEEDED (during ParallelParsingBlockInputFormat). insert_* turns that rejection into an AssertionError, which the hook treated as fatal (sys.exit 1), so a successful build was reported as a failed "Post Hooks" check. This telemetry is observability-only and has no bearing on the produced binaries, so a rejected upload must not fail the build. Catch upload errors per artifact in _upload_profile_artifacts, log them, and continue. Genuine build/producer errors still fail loudly: they surface earlier, in prepare-time-trace.sh under strict Shell.check and in local file assembly, outside the upload loop. PR ClickHouse#107117 guarded the missing/empty-artifact case (ClickHouse#84159) but left the remote-rejection case fatal; this addresses that remaining mechanism, which is the dominant cause of the chronic master Build Post Hooks failures across all variants (~600/day, build-content-independent). Co-Authored-By: Claude Opus 4.8 <[email protected]>
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
The
build_profile_hookpost-hook runs on every master Build job and uploads three artifacts thatutils/prepare-time-trace/prepare-time-trace.shproduces: the time-trace profile,binary_sizes.txt, andbinary_symbols.txt.prepare-time-trace.shdoes not emit every artifact for every build:binary_symbols.txtis produced only for non-LTO builds (the script guardsnmwithif ! grep -q -- '-flto', sincenmdoes not work with LTO). Release builds use ThinLTO, so the file is never created.prepare-time-trace.shon non-x86/ARM non-Linux builds #84159).The hook opened all three files unconditionally, so on LTO release builds and cross-arch builds the missing file raised
FileNotFoundError, which the broadexceptturned intosys.exit(1), failing thePost Hookscheck. This has failed on master across all such Build variants for months (top variantsarm_releaseandamd_releaseare LTO builds).The fix uploads whatever
prepare-time-trace.shactually produced and skips artifacts that are absent or empty, instead of failing the whole post-hook. Addedci/testsregression coverage for the LTO, cross-arch, and native-build cases.Reproduced on master HEAD (Build (arm_release)): https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=fc73f46fae655b1fb5e5dc447c121c844a8a6295&name_0=MasterCI&name_1=Build%20(arm_release)
Version info
26.6.1.973