Skip to content

Print file offsets in the bare fatal stack traces and build the release binary as PIE - #117449

Merged
Algunenano merged 8 commits into
ClickHouse:masterfrom
groeneai:always-pie-bare-trace-offsets
Sep 9, 2026
Merged

Algunenano merged 8 commits into
ClickHouse:masterfrom
groeneai:always-pie-bare-trace-offsets

Conversation

@groeneai

@groeneai groeneai commented Sep 1, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #103347

Reimplementation of #103347 against master; its head is from 2026-06-08.

SignalListener::onFault logs the trace twice: a bare address list in case symbolization fails, then the symbolized lines. The bare list printed raw runtime addresses, which ASLR moves, so the line that survives a symbolization failure was the one addr2line cannot use. Both bare dumps now print object-relative file offsets, with in <object> for a frame outside the main executable, whose offset ranges overlap, and in <unknown> for a frame in no loaded object.

The second commit drops the NOT ENABLE_THINLTO carve-out, so amd_release, arm_release and amd_cfi become position independent, and asks the linker for -pie explicitly. It can be dropped alone. The Performance job runs arm_release against master head and is green here, with one slower entry in three of its six batches; the amd_release batches are skipped without the pr-performance label, so please read it before merging.

From @ Algunenano's review: Compatibility check, which already unpacks the release deb for its glibc symbol versions, now also asserts that binary is ET_DYN and carries DF_1_PIE on amd64 and aarch64, since -fPIC only makes the code relocatable and nothing in the build fails when the executable comes out position dependent. And system.errors.last_error_trace, system.error_log.last_error_trace and system.crash_log.trace now store a frame of the main executable as its file offset, so a flushed row stays resolvable after a restart or on another host, while a frame in another object keeps its runtime address, because a stored offset into a library reads as a main-executable one.

Three of the four performance problems no longer exist; the fourth is PIE's own cost, which master's deleted comment called "a little bit slower" without a number. "Always" is only reachable on Linux glibc amd64 and aarch64 today: musl links statically, the other sysroots have no PIC startup objects, and that fix lives on an unmerged ClickHouse/sysroot branch I cannot push to.

Sysroot gap, validation, and disclosed residuals

contrib/sysroot caf9c9f560e5a06: linux-powerpc64le, linux-loongarch64, freebsd-x86_64, freebsd-aarch64 and freebsd-powerpc64le have no Scrt1.o (the FreeBSD ones also lack crtbeginS.o/crtendS.o); linux-riscv64 has Scrt1.o but no librt.so symlink, so -lrt falls back to a non-PIC archive. #103347's sysroot bump points at the unmerged branch pie-ready-linux-sysroots, ahead 2 / behind 3 of sysroot master, one of whose commits is obsoleted by the merged sysroot#45 "Remove musl sysroot". riscv64, ppc64le and loongarch64 keep -no-pie; s390x, musl, FreeBSD and Darwin stay outside the explicit -pie path, and Darwin and FreeBSD trace output is byte-identical. #103347 also stubs out remapExecutable with #if 0, but 6c5298f9b41d8b0 made it PIE-safe, so the stub is obsolete: a local amd_release PIE ThinLTO build still remaps 453.70 MiB of text into huge pages, which is why the compensating mlock_executable and the perf job's --privileged are unnecessary.

Validation: the amd_release recipe with -fPIC, -flto=thin and -pie links and yields ET_DYN; clickhouse local and a server from it both work. The musl configure keeps -fPIC but gets no -pie, the sanitizer configure gets -pie, riscv64 keeps -no-pie. The PIE assertion was run against the real binary and against -pie and -no-pie probe binaries from both gcc and ld.lld: it fails on each -no-pie one and raises on a non-ELF file. The offsets test and the crash-trace assertion fail on the parent commit and pass here; the added stateless test is 50/50 green with randomized settings. The bare dump now depends on SymbolIndex being loaded, which BaseDaemon does at init, and findObject is a lower_bound over an immutable vector with no allocation or locking, so the fallback path stays allocation-free.

Not fixed here, and disclosed rather than dropped silently: system.stack_trace.trace normalizes against whichever object contains the frame without recording which one, so a library frame's offset reads as a main-executable symbol; XRay rows and jemalloc heap-dump addresses are raw; SymbolIndex::findObject bounds each object by ELF file size rather than loaded extent. @ azat's open #101435 is redesigning that surface, and #115323 is adjacent in the same files. I have not touched either. system.trace_log.trace needs no change: TraceCollector subtracts the main executable's base only, which is the form the error and crash columns now follow.

Changelog category (leave one):

  • Build/Testing/Packaging Improvement

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

ClickHouse is now built as a position independent executable on Linux amd64 and aarch64 with glibc, including the release builds, so the text segment is subject to ASLR. Addresses in the bare stack trace of a fatal log are now file offsets relative to the object that contains them, annotated with that object for frames outside the main executable, so they can be resolved with addr2line -e <object> <hex> regardless of where the binary was loaded. For the same reason system.errors.last_error_trace, system.error_log.last_error_trace and system.crash_log.trace now store a frame of the main executable as its file offset, keeping runtime addresses for frames in other objects.


Workflow [PR]
Sync PR [sync-upstream/pr/117449]

Version info

  • Merged into: 26.9.1.1087 (included in 26.9 and later)

groeneai and others added 2 commits September 1, 2026 03:12
`SignalListener::onFault` logs the stack trace twice: a bare list of addresses
first, in case symbolization fails, and the symbolized lines after it. The bare
list printed raw runtime addresses while the symbolized lines print offsets
relative to the object that contains them, so the two were in different address
spaces and the one line that survives a symbolization failure was the one that
cannot be fed to `addr2line`. Every amd64 and aarch64 build except the three
`ENABLE_THINLTO` ones is already a position independent executable, so those
runtime addresses depend on wherever ASLR happened to place the image.

Route both bare dumps through `StackTrace::resolveAddress`, which returns the
representation `StackTrace::forEachFrame` already computes. An offset is only
interpretable together with its object, because the offset ranges of the main
executable and of the loaded libraries overlap, so a frame outside the main
executable is printed as `<offset> in <object>`. A frame that no loaded object
contains, which is what JIT code and anything mapped after `SymbolIndex` took
its one-time snapshot look like, is printed as `<address> in <unknown>` instead
of silently as an offset. Darwin, FreeBSD and non-ELF platforms do not normalize
addresses at all, and there the output is unchanged.

`StackTrace::forEachFrame` now shares that arithmetic instead of repeating it.

The new integration test compares the bare addresses of a fault against the
symbolized addresses of the same fault, which needs no reference values, and
reproduces the defect on the parent commit.

Co-Authored-By: Claude Opus 5 <[email protected]>
`ENABLE_POSITION_INDEPENDENT_BINARY` was set for every amd64 and aarch64 build
except the `ENABLE_THINLTO` ones, so `amd_release`, `arm_release` and `amd_cfi`
were the only three still linked with `-no-pie`, and therefore the only ones
whose text segment is not subject to ASLR. The carve-out was justified by

  Position independent binaries and libraries are a little bit slower, than
  position dependent. We consider build with -flto=thin as trully "production"
  build where each % of performance is important.

which is unquantified. The `Performance` job runs `amd_release` and `arm_release`
against master head, so it is the instrument that can settle it per architecture.

Dropping `-no-pie` alone would not be enough: `ENABLE_POSITION_INDEPENDENT_BINARY`
adds compile time `-fPIC` only, so the executable would come out position
independent because of the compiler driver default rather than because anything
here asks for it, and a differently configured driver would silently ship
`ET_EXEC` again. Ask the linker explicitly instead. musl keeps `-static`, which
cannot be combined with `-pie` and would need a `-static-pie` `rcrt1.o` that
`contrib/musl-cmake` does not build; the FreeBSD and Darwin sysroots carry no
`Scrt1.o`; riscv64, ppc64le, loongarch64 and s390x never enter this branch and
keep `-no-pie`.

Measured locally with the `amd_release` recipe: `-fPIC` together with
`-flto=thin` and `-pie` links, the result is `ET_DYN`, and with
`remap_executable` enabled the server still remaps 453.70 MiB of its own text
into huge pages at startup, so the hugepage remap that `-no-pie` used to protect
is not lost.

Co-Authored-By: Claude Opus 5 <[email protected]>
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-request PR origin: a maintainer pinged or directed groeneai labels Sep 1, 2026
@groeneai

groeneai commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator Author
Internal second-model review

I ran an independent review of this branch over five rounds and adjudicated every finding against
the evidence. Recording it here so the reasoning is visible rather than implied.

❌ Fixed in this PR

Finding Disposition
The test compared the bare addresses against the symbolized ones, and after this change both come from the same helper. So it proved the two agree, never that either is a file offset: a resolver mutated to hand back runtime addresses moves both sides together and every assertion stayed green, while the property the changelog promises was gone. Adding a size bound then covered only frames annotated with a concrete object, leaving main-executable frames, the majority, still held by that same comparison. Fixed over three rounds: every address must be below the on-disk size of the file it belongs to, the named object for an annotated frame and the server executable for an unannotated one, and at least one frame is required in each class. SymbolIndex bounds an object by that file's size, so a real offset is always under it while a runtime address exceeds it by four orders of magnitude, and the bound comes from the filesystem rather than from the code under test. Each half was proved independent by switching the other off: the executable bound is then the only red on that resolver mutant.
Deleting the in <object> annotation left the test green; requiring an annotation was then satisfiable by a degraded in <unknown>, so the object name, the half that makes an offset resolvable, was unpinned. Fixed: a concrete object name is required. A mutant emitting <unknown> for OtherObject fails on exactly that assertion while the address comparison still holds.
The trace parser accepted any log line containing Stack trace: and then asserted its first token was hex. Two unrelated sites log that marker followed by a symbolized trace on one line, and the test reads every log rotation, so one such line anywhere in the module would have failed it with a parser error. Fixed: a bare dump is recognized by its first token. A marker-bearing line that is not a bare dump is skipped rather than falling through to the frame pattern, which it would otherwise have matched.
Three overclaims: a comment and the changelog entry said every amd64 and aarch64 build becomes position independent, when -pie is asked for only on Linux without musl and amd_musl stays ET_EXEC; the description said system.stack_trace.trace becomes run-specific, when its producer already subtracts each object's load base; and a comment called the SymbolIndex singleton immortal, when instance holds a function-local static destroyed at exit. All three corrected to what holds. Also removed a dead [[maybe_unused]], a comment describing its own marker tuple backwards, and a comment that was true only once the second commit is applied.

⚠️ Raised and declined, with the reasoning

Finding Why I disagree
PIE makes the raw pointers in system.crash_log.trace and system.error_log.last_error_trace run-specific, so addressToSymbol and addressToLine cannot resolve them after a restart. Store a stable representation, at least the previous main-executable-relative offsets. The consequence is real and the release build is newly affected, which is why the description says so. The remedy is not: #101435 moves the canonical representation of exactly these columns the other way. It stores info->addr + st_value in SymbolIndex, drops the - address_begin subtraction from findSymbol, converts inside addressToLine instead, and deletes the normalization in TraceCollector and StorageSystemStackTrace on the stated grounds that it "breaks PIE builds where address_begin != 0". Under that PR a raw virtual address in these two columns is the correct input; a main-executable-relative offset is not, and the change would conflict with those hunks directly. The premise is also weaker than it looks: an offset alone does not identify an instruction, which is why this PR annotates the bare dump with in <object>, so re-symbolizing after a restart needs object identity plus a load base, i.e. a schema change to two system tables. That identical remedy is already pending unaddressed on #101435 as an automated review comment from 2026-06-03, so it is that PR's call, not this one's. Finally the class is not new: every debug and sanitizer build is already position independent, and crash_log additionally persists trace_full, symbolized inside the crashing process.
Add a check pinning ELF type DYN for amd_release, arm_release and amd_cfi, since reverting the CMake hunk would leave the test green. The harm needs the revert to be silent. It is its own commit and the description offers it for removal, so removing it is deliberate. Beyond that, this repository states build invariants in the build definition: no test pins -flto=thin, -fno-omit-frame-pointer, SPLIT_DEBUG_SYMBOLS, GLIBC_COMPATIBILITY or the musl -Wl,-z,stack-size either. Asking the linker for -pie explicitly, rather than inheriting the driver default, is the statement of this invariant. Residual, stated plainly: nothing automated pins ET_DYN for those three profiles.
Show amd_release and arm_release performance comparisons before merging, or drop the PIE commit. The evidence is required, and it is produced by this PR's own Performance job, which runs both release architectures against master head; the comparison is live because this arm is position independent and master's is not. I cannot substitute for it: there is no aarch64 host here, and #103347's own cloud benchmark returned no_change with two TPC-H queries moving in opposite directions, which is what that noise regime looks like.
Verify each annotated object with addr2line inside the test. That tests SymbolIndex::findObject, which this change does not touch and which two open pull requests are rewriting. llvm-symbolizer verification of every annotated entry was run locally across four arms instead.

💡 Noted, not blocking

  • The in <unknown> form is reachable by construction but was never observed at the print site, despite deliberate attempts with JIT-compiled expressions and faults delivered to running worker threads. Recording it as unexercised rather than claiming coverage.
  • Address carriers left raw, disclosed rather than dropped: crash_log.trace and error_log.last_error_trace; trace_log.trace normalizes for the main object only, so shared-library frames stay raw; XRay rows and jemalloc heap-dump addresses; and SymbolIndex::findObject bounds each object by ELF file size rather than loaded extent. All belong to the table representation Fix wrong shared library symbol resolution in stack traces #101435 is redesigning, so I left that surface alone.

Checked and found correct, so not raised

The bare dump keeps its "survives a symbolization failure" property: SymbolIndex is already
constructed before both new call sites in every configuration, at BaseDaemon startup for a daemon
and through build_id about thirty lines earlier for clickhouse-local and the client, and after
construction the resolver is a binary search with no allocation. Darwin and FreeBSD keep raw
addresses on both sides, so their output is byte-identical. -pie cannot collide with musl's
-static or with the surviving -no-pie block, and the three ENABLE_THINLTO profiles are the only
ones whose flags change. PIE also does not disturb the executable integrity check, which hashes
PF_X segments, nor the self-extracting wrapper, which locates itself through /proc/self/exe and
matches /proc/self/maps by path.

@clickhouse-gh clickhouse-gh Bot closed this Sep 1, 2026
@clickhouse-gh clickhouse-gh Bot reopened this Sep 1, 2026
@groeneai

groeneai commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate
# Question Answer
a Deterministic repro? Yes, 100%. kill -SEGV a clickhouse local running a long query, then compare the bare Stack trace: line against the @ 0x... values of the same fatal log.
b Root cause explained? SignalListener::onFault logs the trace twice. The bare dump is the fallback for a symbolization failure and printed raw runtime addresses, while the symbolized lines print frame.physical_addr, an object-relative file offset. The two were in different address spaces, so the line that survives a failure was the one addr2line cannot consume. Those addresses move with ASLR: every amd64 and aarch64 build except the three ENABLE_THINLTO ones is already position independent.
c Fix matches the root cause? Yes. The bare dumps emit the representation forEachFrame already computed, and that arithmetic is now one helper instead of two copies. No widened bound, no tag, no defensive guard. The second commit removes the ENABLE_THINLTO carve-out and asks the linker for -pie instead of inheriting the driver default.
d Test intent preserved, new test added? New integration test in tests/integration/test_crash_log, self-calibrating: it compares one fault's bare addresses against that same fault's symbolized addresses, so there are no reference values to drift. Four asserted properties: the address comparison; at least one frame annotated with a concrete object ( in <unknown> deliberately does not satisfy it); at least one frame left unannotated, i.e. recognized as being in the main executable; and, independently of the resolver, every address below the on-disk size of the file it belongs to - the named object for an annotated frame, the server executable for an unannotated one. That last one is what pins both sides to being file offsets rather than merely consistent with each other. No existing assertion weakened; module still 8 passed, 1 skipped.
e Both directions demonstrated? Yes. Pristine master fails on 24 of 24 frames; the fix passes; forcing the resolver to its no-op branch fails again. Each assertion also reddens on its own mutation, and the two that could have been carried by a sibling arm were proved independent with that sibling switched off: mutating the resolver to return the runtime address while still returning the object leaves the equality and symbol assertions green on every entry, and the executable-size bound is then the only red; rewriting every unannotated entry of a real log to in <unknown> is the arm for the non-empty main-object class. On real output the worst address-to-size ratio is 0.27, against overshoots of 1.4e+04x and 3.0e+07x for runtime addresses.
f General across code paths? Yes. All three bare print sites route through one resolver. Every other producer and consumer of a frame pointer was enumerated; those left alone are listed in the PR description, because they are the system.* table representation that @ azat's open #101435 is redesigning in the opposite direction.
g General across inputs? Yes. The input space is the address classes, each with its own printed form and its own check: an offset in the main executable, bounded by the executable's size; an offset annotated with its object, bounded by that object's size; and an address in no loaded object, which no size predicate can separate from a regressed lookup, so the main-object class being non-empty is what guards it. Forcing the non-normalizing branch reproduces today's output byte for byte, so Darwin and FreeBSD are unchanged. Release/ThinLTO, sanitizer, musl, riscv64 and debug configurations were each measured.
h Backward compatible? Yes. No setting and no serialization format, so no SettingsChangesHistory.cpp entry. The two user-visible changes are both in the changelog entry. Nothing in the tree hardcodes the executable's load address, and the self-extracting wrapper hands off with execv, so the kernel maps the inner binary.
i Invariants and contracts preserved? Yes. resolveAddress adds no allocation: object->name is an already-populated std::string and findObject is a binary search over a vector built once and never resized. It adds no failure mode to the emergency path, because the symbol index is already constructed before the bare dump in every configuration. Frame::physical_addr semantics unchanged.

Verification: a local amd_release ThinLTO build with -fPIC and -pie links and yields ET_DYN, and a server from it still remaps 453.70 MiB of text into huge pages; the new test passes 3 repeats and the whole test_crash_log module is green; check_cpp.sh, various_checks.sh and ruff clean; no submodule change in the diff.

@clickhouse-gh

clickhouse-gh Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [c161175]

Summary: ❌

job_name test_name status info comment
Stateless tests (amd_tsan, sequential, selected tests) FAIL
04648_distributed_plan_task_error_propagation FAIL cidb IGNORED

AI Review

Summary

This PR makes Linux glibc amd64/aarch64 builds explicitly PIE, prints ASLR-stable file offsets in the bare fatal stack traces, and stores main-binary frames in system.errors, system.error_log, and system.crash_log as file offsets. The core implementation looks coherent, but two of the new guards still do not prove the contracts they claim: the new PIE compatibility check inspects the self-extracting wrapper instead of the inner runtime ELF, and the refreshed 05076 stateless test can still read a same-second stale system.errors row.

PR Metadata
  • Changelog category should be Improvement, not Build/Testing/Packaging Improvement: this branch changes user-visible runtime behavior in fatal logs and system tables, not only build or packaging machinery.
  • Exact replacement:
    - Improvement
Findings

⚠️ Majors

  • [ci/jobs/compatibility_check.py:63-80] The new PIE guard reads /usr/bin/clickhouse before first execution, but that file is the self-extracting wrapper built by programs/self-extracting/CMakeLists.txt; utils/self-extracting-executable/decompressor.cpp then replaces it with the decompressed inner clickhouse ELF and only execvs after that swap. So this check can stay green while the runtime binary regresses back to ET_EXEC, which makes the new CI proof materially weaker than the contract it is supposed to pin. Suggested fix: inspect the extracted inner ELF instead, either by unpacking a throwaway copy first or by decoding the self-extracting payload directly.
  • [tests/queries/0_stateless/05076_error_trace_file_offsets.sh:9,29] The new freshness filter is still only second-granularity because start_time comes from now() and system.errors.last_error_time is a DateTime. A stale code 395 row written earlier in the same second still satisfies last_error_time >= '$start_time', so this test can remain green even if the throwIf here stops refreshing last_error_trace. Suggested fix: combine the time bound with a before/after value delta like 01545_system_errors.sh, or use another identity check that proves this query updated the mutable row.
Tests
  • ⚠️ The PR body says the Performance job is green on the current head c16117525ab9697082ebe9ca769a6ed0b7b5ce45, but the available GitHub checks / Praktika report for that SHA still expose only Build profile diff, not the per-shard Performance Comparison results needed to validate PIE cost. Please attach or rerun at least the arm_release comparison for this head, and amd_release too if the ThinLTO carve-out removal on x86 is meant to be performance-neutral.
Final Verdict

Not ready to approve: the main implementation is plausible, but the new CI/test evidence still has two real holes, and the current head still lacks accessible performance-comparison output for the PIE change.

LLVM Coverage Report

Measured on commit c161175.

Metric Baseline Current Δ
Lines 88.80% 88.80% +0.00%
Functions 91.80% 91.80% +0.00%
Branches 81.20% 81.20% +0.00%

Changed lines: Changed C/C++ lines covered: 67/75 (89.33%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-build Pull request with build/testing/packaging improvement label Sep 1, 2026
@groeneai

groeneai commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator Author

cc @antonio2368 @Algunenano, could you review this? The bare address list that SignalListener::onFault logs as its fallback for a symbolization failure printed raw runtime addresses, while the symbolized lines below it print offsets relative to the object that contains them, so the one line that survives a failure was the one addr2line cannot consume. The second commit drops the ENABLE_THINLTO carve-out so amd_release, arm_release and amd_cfi become position independent as well, and it is a separate commit so it can be dropped on its own.

Comment thread CMakeLists.txt
# musl links statically, and -static-pie needs an rcrt1.o that contrib/musl-cmake does not build.
# The FreeBSD and Darwin sysroots carry no PIC startup objects (Scrt1.o).
if (OS_LINUX AND NOT USE_MUSL)
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie -Wl,-pie")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes the Linux glibc amd64/aarch64 release link mode globally, but the PR currently does not carry the performance evidence the description asks reviewers to read. In PR CI, ci/jobs/scripts/workflow_hooks/filter_job.py:470-479 hard-skips the AMD perf matrix on non-pr-performance PRs, and there are no Performance Comparison results attached to this commit yet. Since the only stated reason the old ENABLE_THINLTO carve-out existed was possible release-build slowdown, we still need actual amd_release/arm_release before/after numbers (or the label that makes those jobs run) before this can be evaluated as safe to merge.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Half of this is right, and that half was my error in the description.

arm_release is not gated. filter_job.py:470-479 requires "amd" in job_name, and the rule's own
comment reads "skip AMD perf tests for non-performance update (ARM runs by default)". This PR's own
Config Workflow log shows the split directly: the six
Performance Comparison (amd_release, master_head, N/6) jobs are
set to skipped by custom hook [should_skip_job], reason [Skipped, not labeled with 'pr-performance'],
while the six arm_release ones are listed as scheduled. Over the last 7 days CIDB has arm
Performance Comparison on 967 distinct PRs against amd on 170. No results were attached when you
looked because Build (arm_release) was still running, not because the job will not run.

So arm_release before/after numbers against master head arrive here with no label, and only the
AMD half is opt-in.

What you are really pointing at is correct though: the description sent a reviewer to amd_release
results this PR will not produce. I have corrected it to name what actually runs and what the label
would add.

I am not applying the label myself. If the AMD half is wanted before merge, please add
pr-performance.

`read_server_log` returns the whole rotation history, and `test_crash_log`
faults the same module-scoped server seven times before this test runs, so the
collection-level checks ran over every crash in the log rather than over the one
under test.

Measured on the preserved log directory of a whole-module run: the assertions saw
8 faults and 20 bare dumps, of which 1 fault and 2 dumps are this test's.
Rewriting only this fault's unannotated frames to ` in <unknown>`, stripping only
its object annotations, and deleting only its two bare dump lines each left the
suite green, while the same rewrite applied to every fault turned it red. Every
earlier validation of this test used a single-test invocation, where the history
does not exist and the checks are sound.

Blocks now carry the fault they belong to and the test selects the last fault
recorded, which is its own because the faults of the tests that follow have not
happened yet. The count comes from the log rather than from the blocks, so a
fault that logs no bare dump at all fails here instead of silently handing the
checks the previous fault's trace. Each of the ten faults in a module run
independently carries 4 to 5 annotated and 8 to 10 main-executable frames, so the
narrower scope keeps margin on every assertion.

Co-Authored-By: Claude Opus 5 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing c16117525 with master a63831d1f (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

⚠️ Significant changes: binary sizes, symbol sizes.

Binary sizes ⚠️
Binary Master PR Δ
programs/clickhouse-stripped 709.12 MiB 736.85 MiB +27.73 MiB (+3.91%)

Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Object file sizes

15503 object files changed (-3.25 MiB total), 0 added.

Object file Master PR Δ
contrib/hive-metastore-cmake/CMakeFiles/_hivemetastore.dir/__/hive-metastore/ThriftHiveMetastore.cp… 5.81 MiB 5.68 MiB -133.43 KiB (-2.24%)
contrib/google-cloud-cpp-cmake/CMakeFiles/google_cloud_cpp_storage_protos.dir/google/storage/v2/sto… 1.76 MiB 1.71 MiB -46.26 KiB (-2.57%)
contrib/vectorscan-cmake/CMakeFiles/_vectorscan.dir/__/vectorscan/src/rose/rose_build_program.cpp.o 732.05 KiB 698.10 KiB -33.96 KiB (-4.64%)
contrib/arrow-cmake/CMakeFiles/_parquet.dir/__/arrow/cpp/src/generated/parquet_types.cpp.o 1017.44 KiB 986.57 KiB -30.87 KiB (-3.03%)
contrib/google-protobuf-cmake/CMakeFiles/_libprotobuf.dir/__/google-protobuf/src/google/protobuf/co… 365.34 KiB 336.43 KiB -28.90 KiB (-7.91%)
base/poco/Foundation/CMakeFiles/_poco_foundation.dir/src/Exception.cpp.o 356.32 KiB 327.53 KiB -28.79 KiB (-8.08%)
contrib/libhdfs3-cmake/CMakeFiles/_hdfs3.dir/ClientNamenodeProtocol.pb.cc.o 1.07 MiB 1.04 MiB -24.19 KiB (-2.22%)
contrib/icu-cmake/CMakeFiles/_icui18n.dir/__/icu/icu4c/source/i18n/messageformat2_data_model.cpp.o 192.21 KiB 168.35 KiB -23.86 KiB (-12.41%)
contrib/icu-cmake/CMakeFiles/_icui18n.dir/__/icu/icu4c/source/i18n/number_fluent.cpp.o 124.48 KiB 103.95 KiB -20.53 KiB (-16.49%)
src/CMakeFiles/dbms.dir/Interpreters/ActionsDAG.cpp.o 1.25 MiB 1.24 MiB -20.34 KiB (-1.58%)
contrib/llvm-project-cmake/CMakeFiles/LLVMAnalysis.dir/__/llvm-project/llvm/lib/Analysis/ScalarEvol… 1.32 MiB 1.30 MiB -18.73 KiB (-1.39%)
contrib/llvm-project-cmake/CMakeFiles/LLVMCore.dir/__/llvm-project/llvm/lib/IR/ConstantRange.cpp.o 273.43 KiB 256.75 KiB -16.68 KiB (-6.10%)

716 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only clickhouse-bundle) and not compared.

Compile time of recompiled translation units

15852 translation units recompiled, 32793 s compile time in total, 15253 of them have a recent master baseline.

Median compile-time ratio to the baselines is ×1.06 (machine-speed difference or a change affecting every TU); per-TU deltas below are relative to that ratio.
The matched translation units cost +1763.9 s (+6%) in total before that adjustment.

Translation unit Master PR Δ vs median
contrib/grpc-cmake/__/grpc/src/core/xds/grpc/xds_listener_parser.cc 5.4 s 11.1 s +5.3 s (+93%)

Translation units without a recent master baseline:

  • contrib/rocksdb-cmake/__/rocksdb/utilities/backup/backup_engine.cc: 7.6 s
  • contrib/s2geometry-cmake/__/s2geometry/src/s2/s2builder.cc: 7.0 s
  • contrib/ai-sdk-cpp-cmake/__/ai-sdk-cpp/src/providers/openai/openai_factory.cpp: 5.9 s
Symbol sizes ⚠️
Binary Symbol Master PR Δ
programs/clickhouse-keeper _ZZN24TopLevelDomainLookupHash7isValidEPKcmE8wordlist new 864.07 KiB +864.07 KiB
programs/clickhouse _ZZN24TopLevelDomainLookupHash7isValidEPKcmE8wordlist new 864.07 KiB +864.07 KiB
programs/clickhouse-keeper wordlist new 242.38 KiB +242.38 KiB
programs/clickhouse wordlist new 242.38 KiB +242.38 KiB
programs/clickhouse rd_kafka_properties new 130.00 KiB +130.00 KiB
programs/clickhouse _ZGRN2DB12_GLOBAL__N_15nounsE_ new 102.33 KiB +102.33 KiB
programs/clickhouse-keeper _ZGRN2DB12_GLOBAL__N_15nounsE_ new 102.33 KiB +102.33 KiB
programs/clickhouse-keeper a_2 new 82.50 KiB +82.50 KiB
programs/clickhouse a_2 new 82.50 KiB +82.50 KiB

Job report

@clickhouse-gh

clickhouse-gh Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing d4eada3ce with master 9f35a2b2a (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

⚠️ Significant changes: binary sizes, compile time of recompiled translation units, symbol sizes.

Binary sizes ⚠️
Binary Master PR Δ
programs/clickhouse-stripped 710.21 MiB 737.86 MiB +27.65 MiB (+3.89%)

Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Object file sizes

15471 object files changed (-3.24 MiB total), 0 added.

Object file Master PR Δ
contrib/hive-metastore-cmake/CMakeFiles/_hivemetastore.dir/__/hive-metastore/ThriftHiveMetastore.cp… 5.81 MiB 5.68 MiB -133.43 KiB (-2.24%)
contrib/google-cloud-cpp-cmake/CMakeFiles/google_cloud_cpp_storage_protos.dir/google/storage/v2/sto… 1.76 MiB 1.71 MiB -46.26 KiB (-2.57%)
contrib/vectorscan-cmake/CMakeFiles/_vectorscan.dir/__/vectorscan/src/rose/rose_build_program.cpp.o 732.05 KiB 698.10 KiB -33.96 KiB (-4.64%)
contrib/arrow-cmake/CMakeFiles/_parquet.dir/__/arrow/cpp/src/generated/parquet_types.cpp.o 1017.44 KiB 986.57 KiB -30.87 KiB (-3.03%)
contrib/google-protobuf-cmake/CMakeFiles/_libprotobuf.dir/__/google-protobuf/src/google/protobuf/co… 365.34 KiB 336.43 KiB -28.90 KiB (-7.91%)
base/poco/Foundation/CMakeFiles/_poco_foundation.dir/src/Exception.cpp.o 356.32 KiB 327.53 KiB -28.79 KiB (-8.08%)
contrib/libhdfs3-cmake/CMakeFiles/_hdfs3.dir/ClientNamenodeProtocol.pb.cc.o 1.07 MiB 1.04 MiB -24.19 KiB (-2.22%)
contrib/icu-cmake/CMakeFiles/_icui18n.dir/__/icu/icu4c/source/i18n/messageformat2_data_model.cpp.o 192.21 KiB 168.35 KiB -23.86 KiB (-12.41%)
contrib/icu-cmake/CMakeFiles/_icui18n.dir/__/icu/icu4c/source/i18n/number_fluent.cpp.o 124.48 KiB 103.95 KiB -20.53 KiB (-16.49%)
contrib/llvm-project-cmake/CMakeFiles/LLVMAnalysis.dir/__/llvm-project/llvm/lib/Analysis/ScalarEvol… 1.32 MiB 1.30 MiB -18.73 KiB (-1.39%)
src/CMakeFiles/dbms.dir/Interpreters/ActionsDAG.cpp.o 1.24 MiB 1.22 MiB -17.05 KiB (-1.34%)
contrib/llvm-project-cmake/CMakeFiles/LLVMCore.dir/__/llvm-project/llvm/lib/IR/ConstantRange.cpp.o 273.43 KiB 256.75 KiB -16.68 KiB (-6.10%)

716 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only clickhouse-bundle) and not compared.

Compile time of recompiled translation units ⚠️

15818 translation units recompiled, 30331 s compile time in total, 4487 of them have a recent master baseline.

Translation units without a recent master baseline:

  • contrib/arrow-cmake/__/arrow/cpp/src/arrow/compute/kernels/scalar_round.cc: 27.9 s
  • contrib/llvm-project-cmake/__/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp: 23.7 s
  • contrib/llvm-project-cmake/__/llvm-project/llvm/lib/Passes/PassBuilder.cpp: 23.3 s
  • contrib/arrow-cmake/__/arrow/cpp/src/arrow/compute/kernels/scalar_temporal_binary.cc: 22.5 s
  • contrib/arrow-cmake/__/arrow/cpp/src/arrow/compute/kernels/scalar_temporal_unary.cc: 20.9 s
  • contrib/arrow-cmake/__/arrow/cpp/src/arrow/compute/kernels/scalar_arithmetic.cc: 18.3 s
  • contrib/arrow-cmake/__/arrow/cpp/src/arrow/compute/kernels/vector_swizzle.cc: 15.5 s
  • contrib/aws-cmake/__/aws/generated/src/aws-cpp-sdk-s3/source/S3Client.cpp: 14.9 s
  • contrib/grpc-cmake/__/grpc/src/core/ext/transport/chttp2/transport/http2_client_transport.cc: 14.5 s
  • contrib/llvm-project-cmake/__/llvm-project/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp: 14.4 s
  • contrib/arrow-cmake/__/arrow/cpp/src/arrow/compute/kernels/vector_sort.cc: 13.9 s
  • contrib/grpc-cmake/__/grpc/src/core/ext/transport/chttp2/transport/http2_server_transport.cc: 13.8 s
  • contrib/arrow-cmake/__/arrow/cpp/src/arrow/compute/kernels/scalar_cast_string.cc: 13.7 s
  • contrib/arrow-cmake/__/arrow/cpp/src/arrow/compute/kernels/aggregate_basic.cc: 13.6 s
  • contrib/arrow-cmake/__/arrow/cpp/src/arrow/scalar.cc: 13.5 s
  • contrib/arrow-cmake/__/arrow/cpp/src/arrow/compute/kernels/vector_select_k.cc: 13.5 s
  • contrib/aws-cmake/__/aws/generated/src/aws-cpp-sdk-glue/source/GlueClient.cpp: 13.4 s
  • contrib/arrow-cmake/__/arrow/cpp/src/arrow/compute/kernels/hash_aggregate.cc: 13.3 s
  • contrib/arrow-cmake/__/arrow/cpp/src/arrow/builder.cc: 13.2 s
  • contrib/aws-cmake/__/aws/generated/src/aws-cpp-sdk-glue/source/GlueClient1.cpp: 12.9 s
  • ... and 195 more
Symbol sizes ⚠️
Binary Symbol Master PR Δ
programs/clickhouse-keeper _ZZN24TopLevelDomainLookupHash7isValidEPKcmE8wordlist new 864.07 KiB +864.07 KiB
programs/clickhouse _ZZN24TopLevelDomainLookupHash7isValidEPKcmE8wordlist new 864.07 KiB +864.07 KiB
programs/clickhouse-keeper wordlist new 242.38 KiB +242.38 KiB
programs/clickhouse wordlist new 242.38 KiB +242.38 KiB
programs/clickhouse rd_kafka_properties new 130.00 KiB +130.00 KiB
programs/clickhouse-keeper _ZGRN2DB12_GLOBAL__N_15nounsE_ new 102.33 KiB +102.33 KiB
programs/clickhouse _ZGRN2DB12_GLOBAL__N_15nounsE_ new 102.33 KiB +102.33 KiB
programs/clickhouse a_2 new 82.50 KiB +82.50 KiB
programs/clickhouse-keeper a_2 new 82.50 KiB +82.50 KiB

Job report

@groeneai

groeneai commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - 8495b67

Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Docs examples / Documentation examples trunk bug, not this PR: the toYYYYMM doc example asserts a hardcoded 202608, so it reds on every tree since the Sept 1 US/Eastern month rollover (77 rows across 74 distinct PRs in 30d, all after 2026-09-01 04:10:16Z, none before) #117459 (mine, open)
Integration tests (amd_asan_ubsan, db disk, old analyzer, 6/6) / Container memory budget exceeded (/docker) infra capacity, not this PR: the shard's /docker cgroup leaf is capped at its share instead of a ceiling, so nested containers are killed under load (483 rows across 274 distinct PRs plus 17 true-master trees in 24h) #117411 (external, open)

Both owners were checked for a causal link rather than area proximity: #117459 changes exactly src/Functions/toYYYYMM.cpp and replaces the now() argument in the failing example with a fixed timestamp, and #117411 changes the /docker cap this shard died against. Neither is merged, so nothing needed picking up onto this branch.

Session id: cron:our-pr-ci-monitor:20260901-110000

@nikitamikhaylov

Copy link
Copy Markdown
Member

@groeneai merge master.

@groeneai

groeneai commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator Author

Merged master 552cef4. New head a3383a4, no conflicts, and the PR diff is unchanged (same 5 files, 277 insertions / 12 deletions).

@groeneai

groeneai commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - a3383a4

Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task whose fixing-PR link will be posted here when it opens.

Check / test Reason Owner / fixing PR
Integration tests (amd_asan_ubsan, db disk, old analyzer, 6/6) / Container memory budget exceeded (/docker) leaked containers, not PR-caused: the kernel report in the job log names oom_memcg=/docker/<dind>/docker, task=clickhouse, and this shard ran the two session-scoped fixtures whose servers stay resident for the whole job. #117412 is already present on this tree, so its raised budget is not what is missing #117564 (mine, open)
Integration tests (amd_asan_ubsan, db disk, old analyzer, 6/6) / Timeout same event: the session timed out after those kills #117564 (mine, open)
Parser memory check / Resolve master binary CI infra, not PR-caused: the master clickhouse-examples artifact now lives under its workflow prefix, so the hand-spelled key resolves in none of the 100 tracked commits #117701 (mine, open)
Sync - CH Inc sync (private, not actionable by me)

The integration failure also dropped the other 99 jobs of this run (Dropped due to previous failure), so this head is covered by the 43 that completed rather than by the whole matrix. Both owners are open, so there was nothing merged to pick up onto this branch and I pushed nothing.

Session id: cron:our-pr-ci-monitor:20260902-150000

@nikitamikhaylov

Copy link
Copy Markdown
Member

@groeneai merge master.

@groeneai

groeneai commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator Author

Merged master at bb1a20e152146f297b4b8ca232287d7f74402a43; new head 07e918525ae553dd33602f431ca960a6627e64bd.

No conflicts, and the PR diff is unchanged (same git patch-id, same 5 files and line counts). The merge also picks up #117564 and #117701, which owned both failures in the last CI ledger here.

@clickhouse-gh clickhouse-gh Bot added the comp-build-system Build system (CMake, compilation, platform builds). label Sep 4, 2026
@Algunenano Algunenano self-assigned this Sep 7, 2026

@Algunenano Algunenano left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general the changes look good, but we need a way to verify and confirm that PIE is enabled in all release binaries. I'd suggest doing it in the same check as GLIBC (just reuse and rename it), but I'm open to other options too.

In addition there are a few places that will stop resolving after restart. Here is the analysis:

Inventory of address surfaces under ASLR

┌──────────────────────────────────────────┬────────────────────────────┬───────────────────┬───────────────────────────────────────┐
│                 Surface                  │       Representation       │   Survives ASLR   │    Symbol string stored alongside     │
├──────────────────────────────────────────┼────────────────────────────┼───────────────────┼───────────────────────────────────────┤
│ Fatal log, bare dump                     │ object offset + object     │ yes               │ no, but that is the point of the bare │
│                                          │ name (after this PR)       │                   │  dump                                 │
├──────────────────────────────────────────┼────────────────────────────┼───────────────────┼───────────────────────────────────────┤
│ Fatal log / exception Stack trace:       │ physical_addr              │ yes               │ yes                                   │
│ symbolized                               │                            │                   │                                       │
├──────────────────────────────────────────┼────────────────────────────┼───────────────────┼───────────────────────────────────────┤
│ system.crash_log.trace                   │ raw runtime addresses      │ no                │ yes, trace_full is always filled from │
│                                          │                            │                   │  toStringEveryLine                    │
├──────────────────────────────────────────┼────────────────────────────┼───────────────────┼───────────────────────────────────────┤
│                                          │ main-object frames         │                   │ yes by default, symbols and lines     │
│ system.trace_log.trace                   │ normalized in              │ partly            │ filled unless                         │
│                                          │ TraceCollector, library    │                   │ <trace_log><symbolize>false           │
│                                          │ frames raw                 │                   │                                       │
├──────────────────────────────────────────┼────────────────────────────┼───────────────────┼───────────────────────────────────────┤
│ system.trace_log Instrumentation (XRay)  │ raw runtime addresses      │ no                │ yes, function_name / function_id      │
│ rows                                     │                            │                   │                                       │
├──────────────────────────────────────────┼────────────────────────────┼───────────────────┼───────────────────────────────────────┤
│                                          │ normalized per containing  │                   │ no column, but it is a live-process   │
│ system.stack_trace.trace                 │ object, object not         │ yes               │ table                                 │
│                                          │ recorded                   │                   │                                       │
├──────────────────────────────────────────┼────────────────────────────┼───────────────────┼───────────────────────────────────────┤
│ system.errors.last_error_trace,          │ raw runtime addresses      │ no                │ no                                    │
│ system.error_log.last_error_trace        │                            │                   │                                       │
├──────────────────────────────────────────┼────────────────────────────┼───────────────────┼───────────────────────────────────────┤
│                                          │ file offsets (min=8,       │                   │                                       │
│ system.symbols.address_begin/end         │ max=698647937 on my PIE    │ yes               │ n/a                                   │
│                                          │ build)                     │                   │                                       │
├──────────────────────────────────────────┼────────────────────────────┼───────────────────┼───────────────────────────────────────┤
│ flameGraph aggregate function            │ symbolized in-process, hex │ in-process only   │ yes, when the symbol resolves         │
│                                          │  fallback                  │                   │                                       │
├──────────────────────────────────────────┼────────────────────────────┼───────────────────┼───────────────────────────────────────┤
│ Jemalloc symbolized profile source       │ symbolizes in-process      │ in-process only   │ yes                                   │
├──────────────────────────────────────────┼────────────────────────────┼───────────────────┼───────────────────────────────────────┤
│ Jemalloc raw .heap dumps                 │ raw runtime addresses      │ yes, via          │ jeprof handles it                     │
│                                          │                            │ MAPPED_LIBRARIES  │                                       │
├──────────────────────────────────────────┼────────────────────────────┼───────────────────┼───────────────────────────────────────┤
│ Sentry CrashWriter                       │ physical_addr + build id   │ yes               │ yes                                   │
└──────────────────────────────────────────┴────────────────────────────┴───────────────────┴───────────────────────────────────────┘

The two answers to your question

Yes, there is a demangled string stored along with it, on the surfaces that matter. crash_log has trace_full, trace_log has symbols and lines (default symbolize=true), XRay rows have function_name. A human reading a crash after the fact loses nothing. What breaks is arrayMap(x -> addressToLine(x), trace) run against a crash_log row from a different process, and any offline addr2line on those columns.

The one real gap is last_error_trace. It is the only address column that is neither normalized nor accompanied by a symbolized column. Empirically, against my running PIE server:

name: CANNOT_PARSE_TEXT
addr: 55DCBA494673
sym:  ['Poco::Exception::Exception(...)', 'DB::Exception::Exception(...)', ...]

addressToSymbol resolves it correctly while the process is alive, because SymbolIndex::findSymbol finds the containing object and converts. Once the row is flushed to system.error_log and the server restarts, or the row is shipped to a central cluster, the address is unresolvable. The column description even claims "physical addresses", which was true only for non-PIE release builds and is now wrong on every build. That is the concrete thing I would ask for: run last_error_trace and crash_log.trace through the new StackTrace::resolveAddress (or at minimum fix the column comment), since the helper this PR adds is exactly what they need. The author disclosed crash_log deliberately, deferring to azat's #101435, which is defensible; error_log is not mentioned at all.

Two smaller notes

system.stack_trace.trace normalizes against whichever object contains the frame but never records which one, so addressToSymbol on a library frame silently returns a main-binary symbol at the same offset. Live on my build right now:

609497        094CD9  __atan_fma
620386        097762  __GI___pthread_cond_timedwait

Those are libm/libpthread offsets landing in a flat symbol table keyed by offset. Pre-existing, identical under non-PIE, not this PR's problem, but it is the same ambiguity the PR's AddressKind enum was invented to solve, so the fix is now one function call away.

The bare dump now depends on SymbolIndex being loaded, which slightly weakens its role as the fallback for when symbolization fails. In practice it is fine: BaseDaemon.cpp:489 loads the singleton at init, and findObject is a lower_bound over an immutable vector with no allocation or locking. Worth a sentence in the PR rather than a change.

The -pie -Wl,-pie pair is redundant (the driver already forwards -pie) but harmless.

Can you extend the PR with both please? @groeneai

…utable

-fPIC only makes the code relocatable. Whether the executable itself is
position independent is the linker's decision, and nothing in the build
fails when it comes out position dependent: the stack traces silently go
back to printing runtime addresses. The Compatibility check already
unpacks the release deb to read its glibc symbol versions, so the ELF
type and DF_1_PIE of that same binary are checked next to them, on both
amd64 and aarch64.

The type alone is not enough, since a shared library is ET_DYN too, and
DF_1_PIE alone would accept a linker that sets the flag without asking
for -pie, so both are required. An unreadable or non-ELF file raises
instead of passing.
system.errors.last_error_trace, system.error_log.last_error_trace and
system.crash_log.trace stored raw runtime addresses. addressToSymbol
resolves those while the process that produced them is alive, because
SymbolIndex::findSymbol converts an address it finds an object for, but
once the row is flushed and the server restarts, or the row is shipped
to a central cluster, the address means nothing: the load base differs
on every start of a position independent binary. last_error_trace is
the worst case of the three, being the only address column with no
symbolized column beside it, so nothing else in the row identifies the
frames. The column description claiming "physical addresses" was true
only for the position dependent release builds this branch removes.

Frames in the main executable are now stored as their file offsets,
which is what system.trace_log and system.stack_trace already store and
what addr2line and llvm-symbolizer take. Frames in other objects keep
their runtime address: a bare number column has nowhere to record which
object an offset belongs to, and addressToSymbol on a library offset
would answer with the main executable's symbol at the same offset,
which is worse than not resolving. Fixing that ambiguity for the
columns that do normalize per containing object is ClickHouse#101435's subject.

The stored value is computed on read rather than at capture, so the
exception path does an object lookup per frame only for the rows a
query or a log flush actually produces.
@clickhouse-gh clickhouse-gh Bot added the manual approve Manual approve required to run CI label Sep 8, 2026
ei-grad added a commit to ei-grad/ClickHouse that referenced this pull request Sep 10, 2026
The test reads the shared local Code 395 row in `system.errors`. A parallel
async-insert test can replace `last_error_trace` with its own fresh error,
so the timestamp guard accepts a different query's stack and loses the
expected C-library frame. CI captured that overwrite and then passed all
38 isolated diagnostic attempts with the same randomized settings.

Use `no-parallel` to run the check in the existing sequential group.
Preserve the executable queries and both offset assertions. The official
tag parser and classifier verify the changed scheduling; no new server
run or assertion change is needed for this metadata correction.

Related: ClickHouse#117449
Related: ClickHouse#117830
CI: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=117830&sha=26e0f6172adfa5219ca56bbb494cc30f5a5529ee&name_0=PR&name_1=Stateless%20tests%20%28arm_binary%2C%20parallel%29

Co-Authored-By: Codex CLI <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member

@Algunenano, This PR broke master. I will revert.

otselnik pushed a commit to otselnik/ClickHouse that referenced this pull request Sep 10, 2026
…he release binary as PIE"

This reverts the changes merged in 30c0912 (pull request ClickHouse#117449).

The test it added, `05076_error_trace_file_offsets`, has never passed on two
configurations and is red on `master` and on every pull request opened since it
merged on 2026-09-09:

  Fast test (arm_darwin)                        0 ok / 130 fail
  Stateless tests (amd_release, parallel, 1/2)  0 ok /  31 fail
  Stateless tests (arm_release, parallel)      30 ok /   0 fail
  every other configuration                  ~2500 ok /   0 fail

Both failing configurations produce the same diff: the second column drops from
1 to 0, so no captured frame lies outside the main executable. The `amd_release`
runner reproduced it 48 out of 48 times with the randomized settings and 49 out
of 49 without them, so it is deterministic rather than flaky, and `arm_release`
passes at the same times, so it is not a scheduling artifact.

It merged green because neither failing configuration ran the test on the
original pull request - `Fast test (arm_darwin)` and the `amd_release` stateless
jobs are absent from its results.

The Darwin half was since addressed on `master` by 734d678 (pull request
ClickHouse#119145), which tags the test `no-darwin`. That tag cannot help `amd_release`,
which is still failing on `master` as of 2026-09-10 15:13 - including on
a77884d, the very commit that merged the tag. Reverting removes the test
altogether, so that tag goes with it.

The feature is worth having; it should return with the test guarded for the
configurations whose premise it does not match, and with both jobs above
exercised before it merges.

Related: ClickHouse#117449
Related: ClickHouse#119145
Algunenano pushed a commit that referenced this pull request Sep 10, 2026
SymbolIndex copied Elf64_Sym::st_value (and + st_size) into
Symbol::offset_begin/offset_end without checking that the symbol is defined
relative to a section. When st_shndx is a reserved index, the value is a
constant rather than an address.

-fwhole-program-vtables, enabled for every ThinLTO build, emits LLVM's
control-flow-integrity type-id globals (__typeid__*) as absolute symbols whose
value is a bit mask. system.symbols published those verbatim, so on amd_release
max(address_end) read 1162219258676258 instead of 685204737 (505 such symbols;
amd_debug, built with ENABLE_THINLTO=0, has none). An "offset" of 1.16
petabytes into a 4.6 GB binary is impossible on its face.

05076_error_trace_file_offsets bounds captured stack frames by that value, so
the raw runtime addresses of frames outside the main executable stopped
exceeding it and the test printed "1 0" on every master commit since #117449
merged. The inflated bound also cost the first column its meaning on that
flavour, since it counted those same raw addresses as in-range.

No test is changed. Once the bound again reflects the largest real symbol
offset, both columns of 05076, and the same bound in
03172_error_log_table_not_empty, hold for the reason their comments state.

Of the 505 absolute values none lands inside any of the 620643 real FUNC symbol
ranges, so no code address resolves differently. The Mach-O collector already
skips N_STAB, N_UNDF and n_value == 0; it is left alone because both Darwin
recipes disable ThinLTO and no macOS job could validate the change.

Co-Authored-By: Claude Opus 5 <[email protected]>
alexey-milovidov added a commit to ei-grad/ClickHouse that referenced this pull request Sep 10, 2026
Resolves the conflict on 05076_error_trace_file_offsets.sh by taking master's
deletion: the test was removed from master by ClickHouse#119279, which reverted ClickHouse#117449.
The no-parallel tag this branch added to it goes with the file.
alexey-milovidov added a commit to ei-grad/ClickHouse that referenced this pull request Sep 10, 2026
Resolves the conflict on 05076_error_trace_file_offsets.sh by taking master's
deletion: the test was removed from master by ClickHouse#119279, which reverted ClickHouse#117449.
The no-parallel tag this branch added to it goes with the file.
alexey-milovidov added a commit that referenced this pull request Sep 13, 2026
Edited by hand following .claude/skills/edit-changelog/SKILL.md, consolidating
the nine raw blocks generated between 2026-09-06 and 2026-09-13. The
NightlyChangelog job rejected its own edits every night in that period: the
verifier did not know that #116566 (reverted by #116586) had itself reverted
#109710, so it demanded that no trace of #116586 remain while the rules put
its link on the CatBoost entry. Fixed in the job by
#119866; this edit passes the
patched verifier, and the trailers below give the ledger the missing chain.

Failed runs: https://github.com/ClickHouse/ClickHouse/actions/runs/34006912773
through https://github.com/ClickHouse/ClickHouse/actions/runs/34668133756

Changelog-revert: 116566 109710 Revert "Remove CatBoost integration"
Changelog-revert: 116586 116566 Revert "Revert "Remove CatBoost integration""
Changelog-revert: 117629 117295 Revert "Skip Darwin fast test in PRs unless labeled ci-macos"
Changelog-revert: 118525 118218 Revert "Do not wait for the remote drain when cancelling a remote query"
Changelog-revert: 119043 117866 Revert "Add `ci-coverage` label to force LLVM coverage jobs on tests-only PRs"
Changelog-revert: 119269 118239 Revert "Require agents to run the style check locally before pushing"
Changelog-revert: 119270 115343 Revert "Resume a NATS JetStream subscription after a reconnect"
Changelog-revert: 119274 118919 Revert "Carry the mutation version onto a rewritten lightweight `DELETE`"
Changelog-revert: 119275 114817 Revert "Convert OUTER join to INNER join by null-rejecting join conditions"
Changelog-revert: 119276 110939 Revert "Support real hard links for plain_rewritable metadata."
Changelog-revert: 119279 117449 Revert "Print file offsets in the bare fatal stack traces and build the release binary as PIE"
Changelog-revert: 119281 116629 Revert "Check access rights in the TimeSeries table functions"
Changelog-revert: 119298 118606 Revert "Proper partition pruning with dates"
Changelog-revert: 119323 117768 Revert "Docs: Skip private sync for documentation-only pull requests"
Changelog-revert: 119334 117356 Revert "Unify the spill trigger for hash joins"
Changelog-revert: 119429 114562 Revert "Fix NO_SUCH_COLUMN_IN_TABLE naming a column absent from the table when a part's columns were all renamed or all dropped"
Changelog-deleted-entry: 110939 [New Feature] [raw] * Disks with the `plain_rewritable` metadata (`s3_plain_rewritable`, and `azure`/`local` object storages with `metadata_type = plain_rewritable`) support hard links if configured with the new `enable_hard_links` setting, which enables `ALTER` operations and mutations on `MergeTree` tables stored on them. Mutations and partition operations share the unchanged blobs between parts instead of copying them. The setting is off by default, because a disk that has hard links cannot be read by older servers. [#110939](#110939) ([yanglongwei](https://github.com/ylw510)).
Changelog-deleted-entry: 114562 [Bug Fix (user-visible misbehavior in an official stable release)] [raw] * Fixed `NO_SUCH_COLUMN_IN_TABLE` naming a column that is not in the table, when reading or merging a part whose columns had all been renamed or all dropped by a mutation that was not applied yet. The merge kept being retried, so the table stopped compacting. Also fixed the columns of a `MergeTree` part produced by such a merge reading as their default values until the mutation was applied. [#114562](#114562) ([Shaohua Wang](https://github.com/tiandiwonder)).
Changelog-deleted-entry: 114817 [Performance Improvement] [raw] * Convert `OUTER JOIN` to `INNER JOIN` when a later JOIN condition filters out its NULL-extended rows, and filter NULL join keys directly at the table scan when column statistics show it is selective. Only conditions of the form `expr1` OP `expr2` are considered, where OP is one of `=`, `<`, `<=`, `>`, `>=`. Each side can be a column or an expression that propagates NULLs. Controlled by the new settings `query_plan_derive_not_null_filters_from_joins` (enabled by default), `query_plan_allow_derived_not_null_filters_execution` (enabled by default) and `query_plan_max_selectivity_for_not_null_filters_execution` (0.7 by default). [#114817](#114817) ([Hechem Selmi](https://github.com/m-selmi)).
Changelog-deleted-entry: 115343 [Bug Fix (user-visible misbehavior in an official stable release)] [raw] * Fixed a `NATS` engine table reading from a JetStream stream (`nats_stream`) silently stopping to consume messages after the NATS server restarted or the connection was re-established. [#115343](#115343) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
Changelog-deleted-entry: 116629 [Bug Fix (user-visible misbehavior in an official stable release)] [raw] * The table functions reading a `TimeSeries` table (`timeSeriesSamples`, `timeSeriesTags`, `timeSeriesMetrics`, `timeSeriesSelector`, `prometheusQuery`, `prometheusQueryRange`) checked no privilege on it: a user holding only `CREATE TEMPORARY TABLE` could read its target tables' column definitions and rows, and write into them. Each now requires the corresponding privilege on the `TimeSeries` table and on the target table, following an `Alias` target through to the table it points at. `timeSeriesSamples`, `timeSeriesTags` and `timeSeriesMetrics` check the target at table level, since they return it whole and cannot restrict the columns, so a column-scoped grant on the target is not enough; the other three run ordinary target queries, which the planner still checks per column. An external target is authorized before it is looked up, so its existence is not disclosed either. A read fails with `ACCESS_DENIED` when the user's effective `SELECT` row-policy filter on the `TimeSeries` table is not always true, since such a policy cannot be enforced on the target's rows, and the three target functions can no longer back a `CREATE TABLE ... AS` (`BAD_ARGUMENTS`). PromQL over the Prometheus HTTP and remote-read endpoints reaches `timeSeriesSelector` whenever it selects series, so those requests now need these privileges for the user the endpoint authenticated. [#116629](#116629) ([Groene AI](https://github.com/groeneai)).
Changelog-deleted-entry: 117356 [Backward Incompatible Change] [raw] * `max_bytes_before_external_join` and `max_bytes_ratio_before_external_join` are now the spill threshold for every hash-based `join_algorithm`, including `grace_hash`, which previously ignored them and spilled on `max_rows_in_join` / `max_bytes_in_join` instead. Those two are a hard cap again for every algorithm: they no longer cause spilling, and a join that spills no longer exceeds them. All join algorithms remain available; `join_algorithm = 'grace_hash'` now needs a non-zero spill threshold, and is skipped in favour of the next algorithm in the list when it has none. Set `legacy_join_size_limits_trigger_spilling = 1` (or `compatibility` to 26.8 or older) to restore the previous behavior. [#117356](#117356) ([Yarik Briukhovetskyi](https://github.com/yariks5s)).
Changelog-deleted-entry: 117449 [Build/Testing/Packaging Improvement] [raw] * ClickHouse is now built as a position independent executable on Linux amd64 and aarch64 with glibc, including the release builds, so the text segment is subject to ASLR. Addresses in the bare stack trace of a fatal log are now file offsets relative to the object that contains them, annotated with that object for frames outside the main executable, so they can be resolved with `addr2line -e <object> <hex>` regardless of where the binary was loaded. For the same reason `system.errors.last_error_trace`, `system.error_log.last_error_trace` and `system.crash_log.trace` now store a frame of the main executable as its file offset, keeping runtime addresses for frames in other objects. [#117449](#117449) ([Groene AI](https://github.com/groeneai)).
Changelog-deleted-entry: 117768 [NOT FOR CHANGELOG / INSIGNIFICANT] [raw] * Not applicable. [#117768](#117768) ([Dominic Tran](https://github.com/dhtclk)).
Changelog-deleted-entry: 118218 [Bug Fix (user-visible misbehavior in an official stable release)] [raw] * Fixed cancelling a distributed, `s3Cluster` or parallel-replicas `SELECT` taking up to `receive_timeout` (300 s by default) to take effect, and never reaching some of the remote sources, when one of them was draining the packets left over after a `LIMIT` was satisfied. [#118218](#118218) ([Groene AI](https://github.com/groeneai)).
Changelog-deleted-entry: 118239 [NOT FOR CHANGELOG / INSIGNIFICANT] [raw] * Require agents to run the style check locally before pushing. [#118239](#118239) ([Nikita Fomichev](https://github.com/fm4v)).
Changelog-deleted-entry: 118606 [Bug Fix (user-visible misbehavior in an official stable release)] [raw] * Proper partition pruning with dates. Closes [#103433](#103433). [#118606](#118606) ([Konstantin Vedernikov](https://github.com/scanhex12)).
Changelog-deleted-entry: 118919 [Bug Fix (user-visible misbehavior in an official stable release)] [raw] * Fixed a pending lightweight `DELETE` read with `apply_mutations_on_fly = 1` evaluating its predicate over patch parts created after it, which made rows disappear from the result and reappear after the mutation materialized. [#118919](#118919) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
pull Bot pushed a commit to Mu-L/ClickHouse that referenced this pull request Sep 15, 2026
… build the release binary as PIE""

This reverts 34421af (pull request ClickHouse#119279), restoring pull request
ClickHouse#117449.

ClickHouse#119279 reverted the change to get `master` green: the test it added,
`05076_error_trace_file_offsets`, was failing on every release run. The Darwin
half had already been fixed on `master` by 734d678 (pull request ClickHouse#119145),
whose `no-darwin` tag comes back with this re-land, but `amd_release` was still
failing and remains undiagnosed.

Do not merge this before that is fixed - it re-introduces a known red job.

What is known about the remaining failure:

- Only `Stateless tests (amd_release, parallel, 1/2)` fails.
  `arm_release` passes at the same times, and so does every other configuration.
- It is deterministic, not flaky: 48 of 48 runs with the randomized settings and
  49 of 49 without them.
- It is the second column that fails, dropping from 1 to 0: no captured frame
  lies outside the main executable, so either every frame is being stored as a
  file offset, or `max(address_end)` from `system.symbols` is above all of them.
- Both release builds are configured identically apart from the toolchain file,
  and both set `ENABLE_THINLTO=1`. Before this change PIE was gated on
  `NOT ENABLE_THINLTO`, so the release builds are exactly the ones whose PIE
  status it flips - and only the amd64 one fails. The difference is therefore in
  architecture-specific link or runtime behaviour, not in the CMake
  configuration.

Related: ClickHouse#117449
Related: ClickHouse#119145
Related: ClickHouse#119279
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-build-system Build system (CMake, compilation, platform builds). groeneai-origin-request PR origin: a maintainer pinged or directed groeneai manual approve Manual approve required to run CI pr-build Pull request with build/testing/packaging improvement pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants