Repository navigation
Perf CI: start both servers with ASLR disabled and fail when their executable base differs - #126977
Conversation
…ecutable base differs Both measured servers are PIE executables started with ASLR on, so every start loads the executable at a new random address, and the position of the code modulo 2 MiB differs between the reference and the patched server and between restarts. Start them through `setarch <arch> -R` in both launchers (`CHServer.start_cmd` in performance_tests.py and `restart` in compare.sh), so that both load the executable at the fixed base, and fail the run when the two running servers do not have the same executable base, so that a divergence of the launchers is noticed and fixed in the scripts. The check is one script, `check_executable_base.py`, used by both: it takes the PID from the `status` file in the server's data path (the started process is `/bin/sh`, `taskset` or `setarch`, and the server forks under its watchdog) and reads the start of the offset-0 mapping of `/proc/<pid>/exe` (on x86-64 `remap_executable` replaces only the R+X mapping). In compare.sh the check exits instead of returning, because `confirm_changes` only skips its rerun on a failed restart; the `get_profiles` fallback now runs `restart` outside the subshell, so that this exit is not swallowed there. The jobs already run with `seccomp=unconfined`, which `personality(2)` with ADDR_NO_RANDOMIZE needs inside docker. Linux only, like the CPU pinning. Requested in ClickHouse#125949 (comment) Co-Authored-By: Claude Opus 5.5 <[email protected]>
A server that fails to start keeps the callers' existing handling: `confirm_changes` and the `get_profiles` fallback are fail-open, and `restart` returns the same status as before, because the two final `kill -0` checks stay its last commands. The base check now runs before them and only when both started servers are alive, so a restart that fails for another reason no longer ends compare.sh through the checker's missing `status` file. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 2 findings) plus my own review (2 nits).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20261020-151600 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-5:20261020-150400 |
|
Workflow [PR], commit [73da163] Summary: ✅
AI ReviewSummaryThe PR disables ASLR for both measured performance-comparison servers and rejects unequal executable bases after startup and restart. Reviewed commit Missing context / blind spots
Final VerdictStatus: ✅ Approve. |
|
cc @egor-click, could you review this and add the |
1b29cde
…on master The reference build from master is a dynamic PIE, which the kernel loads at `ELF_ET_DYN_BASE` with ASLR disabled, while the static-PIE binary of this branch has no interpreter and is mapped at the mmap base below the stack, so `check_executable_base.py` failed the `Start` stage on every shard. Print a warning instead of failing; make it fatal again after this is merged. Related: #126977 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ee stack placements Since ClickHouse#126977 both perf servers start with ASLR disabled, so every start of a binary puts its thread stacks at the same place. A change that only moves the query threads' frames within their stack pages (on ClickHouse#112928, `ThreadPool` worker frames 32 bytes larger) then reproduces at every restart: `set_in_clustered_keys` ClickHouse#2/ClickHouse#3 were 28-32% slower on arm with an instruction-identical `keys256` probe and equal static TLS, and the confirmation rerun reproduced them (+27.1%, +29.8%), so the shard stayed red. `confirm_changes` now reruns the flagged queries at three placements: the main run's own, and with `glibc.rtld.optional_static_tls` = 512 + 21*64 and 512 + 43*64 for both servers (glibc puts the static TLS block at the top of every thread stack, so all thread stacks move 1344 and 2752 bytes lower). `restart` takes the surplus as an optional argument; without it nothing changes. `eqmed.sql` runs separately per placement, step 5's rule is evaluated per placement, and `query-metric-stats.tsv` gets, per query, an actual placement row on the side of the two-of-three majority (the one farthest from the thresholds), so step 5 and the dashboard check in `performance_tests.py`, which are unchanged, reach the majority verdict. With fewer than three placements measured (a failed restart or rerun, the time budget), the placement 0 row is used, which is the previous behaviour; without it the original verdict stands. The per-placement verdicts go to `placement-verdicts.tsv` and the job log. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Related: #125949
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Not required: CI-only change.
Description
The two servers of the Performance Comparison job are PIE executables started with ASLR on, so every start loads the executable at a new random address, and the position of the code modulo 2 MiB differs between the reference and the patched server and between restarts. As suggested in #125949 (comment), this disables ASLR for these two servers only (the release binaries and ASLR everywhere else are unchanged) and fails the run when their executable base differs.
Both launchers,
CHServerinperformance_tests.pyandrestartincompare.sh, start the server throughsetarch <arch> -R(Linux only; the jobs already run withseccomp=unconfined, whichpersonality(2)needs in docker). The newcheck_executable_base.pytakes each server's PID from thestatusfile in its data path and compares the start of the offset-0 mapping of/proc/<pid>/exe. It runs at the end of theStartstage, which fails on a mismatch, and incompare.shafter every restart that brought up both servers, where a mismatch exits; theget_profilesfallback now callsrestartoutside its subshell, so that exit is not swallowed. A restart that fails to start a server keeps its existing handling.Validation, in the x86-64
clickhouse/performance-comparisonimage withseccomp=unconfined: with two different master release builds, both servers load at0x555555554000in theStartstage and in thecompare.shrestart, confirmation and profile-fallback paths; one server started withoutsetarchfails theStartstage and endscompare.sh, printing both addresses; a server that fails to start gives the samerestartstatus and caller behaviour as before. On CI, this PR's arm perf jobs run the check; the amd ones run only with thepr-performancelabel.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/126977]
Version info
26.11.1.436-master(included in26.11and later)