Skip to content

Do not run 05076_error_trace_file_offsets on Darwin - #119145

Merged
Algunenano merged 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/05076-no-darwin
Sep 10, 2026
Merged

Algunenano merged 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/05076-no-darwin

Conversation

@groeneai

@groeneai groeneai commented Sep 10, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #119136
Related: #117449

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

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

05076_error_trace_file_offsets no longer runs on Darwin, where the storage form it asserts is not implemented.

Description

05076_error_trace_file_offsets has not passed once on Fast test (arm_darwin) since #117449 merged it: CIDB has 24 FAIL and 0 OK across 24 distinct PRs, almost all bystanders, and it prints 1 0 instead of 1 1. Report for ac5f2596d6e8d3391a1c8f973713ac706b68d2ae: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=111423&sha=ac5f2596d6e8d3391a1c8f973713ac706b68d2ae&name_0=PR&name_1=Fast%20test%20%28arm_darwin%29

The test asserts a storage form that Darwin documents itself as not implementing. StackTrace::resolveAddress is compiled #if defined(__ELF__) && !defined(OS_FREEBSD); elsewhere it returns AddressKind::Unsupported with the address unchanged, which StackTrace.h describes as "the platform keeps runtime addresses". So no frame reaches last_error_trace as a file offset there. collectSymbolsFromMachOImage meanwhile stores absolute addresses (n_value + slide) and extends each image's last symbol to that image's max_addr, for every loaded dyld image, so max(address_end) FROM system.symbols is a ceiling above every captured frame: the second column can never hold, and the first stops measuring the offset form. Neither ThinLTO nor dyld layout is involved, which is why #119136 (the ELF half of this, SHN_ABS symbols inflating the same bound on amd_release) does not repair this arm.

Tagging is therefore the fix, and the assertion is untouched on the 20+ arms where the contract holds (Fast test is 84 OK / 0 FAIL over 53 PRs). Since there is no macOS host to iterate on, this PR's own Fast test (arm_darwin) run is the verification, and it lands before merge; locally the runner's should_skip_test was exercised over both platform arms and both versions of the file, and the test passes 50/50 on Linux.

Two residuals I am not changing: 03172_error_log_table_not_empty shares the bound but only in the in-range shape, so a high ceiling satisfies it weakly rather than falsely; and on macOS a stored trace is not portable across restarts as it is on ELF. Whether Darwin should implement file offsets is an owner-level design question, not attempted here.


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

Version info

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

The test asserts that frames inside the main binary reach
system.errors.last_error_trace as file offsets, bounded above by
max(address_end) from system.symbols. That storage form is ELF-only.

StackTrace::resolveAddress is compiled under
`#if defined(__ELF__) && !defined(OS_FREEBSD)`. The other arm returns
AddressKind::Unsupported with the address unchanged, which StackTrace.h
documents as "the platform keeps runtime addresses", so on Darwin
resolveAddressForStorage stores a raw runtime address for every frame and
none is ever converted to a file offset. collectSymbolsFromMachOImage in
turn stores absolute addresses (n_value + slide) and extends each image's
last symbol to that image's max_addr, and SymbolIndex::load() runs it for
every loaded dyld image. max(address_end) is therefore a ceiling above
every captured frame, which makes the second column unsatisfiable and
leaves the first no longer measuring the offset form. The test printed
`1 0` for that reason, 23 times out of 23 runs.

Fast test (arm_darwin) had 23 failures and no passes across 23 distinct
pull requests since ClickHouse#117449 added the test, which is every pull request
that reached that arm. The assertion is left untouched on the arms whose
platform implements the contract it checks.

This is a different defect from the one ClickHouse#119136 fixes: unfiltered
absolute Mach-O symbols would only raise a ceiling that is already above
every frame, so filtering them would leave the output at `1 0`.

Related: ClickHouse#119136
Related: ClickHouse#117449

Co-Authored-By: Claude Opus 5 <[email protected]>
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-ci-master PR origin: master/nightly CI monitoring finding labels Sep 10, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Pre-publication review by an independent model (engine: codex; 1 finding), plus my own cold read of
the diff. No blocker and no major; both findings are wording in the new tag comment.

# Sev Finding Verdict Evidence / action
1 💡 The tag comment leaves StackTrace::resolveAddress, AddressKind::Unsupported, system.symbols and max(address_end) without inline code formatting AGREE, not fixed The convention for these reason lines is unformatted: 0 of the 38 no-darwin: reason lines under tests/queries/0_stateless use backticks. I kept the local shape rather than making this one the exception. One line to change if you prefer it formatted.
2 💡 The closing clause "neither column below can measure anything there" overstates: column 1 still catches a missing or short trace AGREE, not fixed True of what each column exists to assert, which is the file-offset form; 03172_error_log_table_not_empty.sh:64 ships column 1 alone and stays meaningful on Darwin for that reason. Say the word and I will tighten it.

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are terminal
per finding.

Session id: cron:clickhouse-review-slot-8:20260910-045700

@clickhouse-gh

clickhouse-gh Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [734d678]

Summary: ✅


AI Review

Summary

This PR adds a no-darwin tag to 05076_error_trace_file_offsets.sh because Darwin stores last_error_trace as runtime addresses rather than file offsets. That fixes the immediate failing system.errors assertion, but the same unsupported invariant is still asserted by the sibling system.error_log test on Darwin, so the change is not complete yet.

Findings
  • ⚠️ [tests/queries/0_stateless/05076_error_trace_file_offsets.sh:2] system.errors and system.error_log both serialize last_error_trace through StackTrace::resolveAddressForStorage (src/Common/StackTrace.cpp:359-367, src/Interpreters/ErrorLog.cpp:127-133). Skipping only 05076 means Darwin still runs tests/queries/0_stateless/03172_error_log_table_not_empty.sh:60-70, where the same max(address_end) check now passes vacuously because raw runtime addresses stay below the image-wide ceiling from system.symbols. Suggested fix: apply the same Darwin split to that system.error_log subcheck, or rewrite it to assert only the Darwin behavior the product currently documents.
Tests
  • ⚠️ Adjust Darwin coverage for system.error_log.last_error_trace so the suite no longer reports a green file-offset assertion on a platform that stores raw runtime addresses.
Final Verdict

Changes requested: the Darwin exclusion needs to be applied consistently to the sibling system.error_log assertion, or that assertion needs a Darwin-specific expectation.

@@ -1,4 +1,8 @@
#!/usr/bin/env bash
# Tags: no-darwin

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.

system.errors is not the only surface using this storage path. ErrorLog.cpp:127-133 also serializes system.error_log.last_error_trace via StackTrace::resolveAddressForStorage, and 03172_error_log_table_not_empty.sh:60-70 still asserts the same max(address_end) file-offset bound there. On Darwin that query also becomes vacuous for the same reason you describe here: resolveAddress returns AddressKind::Unsupported, so every raw runtime address falls below the image-wide ceiling from system.symbols. This leaves the Darwin fast test green while the sibling system.error_log contract is no longer being checked. Please either apply the same Darwin split to that subcheck or rewrite it to assert only the Darwin behavior the product currently documents.

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.

Mechanism confirmed, remedy declined, with the measurement.

The bound is vacuous on Darwin for exactly the reason given: off ELF StackTrace::resolveAddress reports AddressKind::Unsupported and leaves the address unchanged, and the Mach-O collector stores n_value + slide for every dyld image, so max(address_end) sits above every captured frame. That is the same mechanism this PR tags out of 05076.

What does not follow is that the system.error_log contract stops being checked on Darwin. These parts of 03172 are platform independent and still run there:

  • :27-29 and :41-43, the 111/222/333 propagation and re-propagation counts;
  • :48, last_error_time / last_error_query_id / last_error_message populated;
  • :54, arrayCount(x -> x != '', arrayMap(x -> demangle(addressToSymbol(x)), last_error_trace)) > 10, which works on macOS because findSymbol applies the address-to-offset conversion only under #if defined(__ELF__) and otherwise searches absolute addresses directly (src/Common/SymbolIndex.cpp:738-751).

The :64 subcheck also cannot hide a Darwin regression that :54 does not already catch: find() returns a symbol only when offset >= it->offset_begin && offset < it->offset_end (src/Common/SymbolIndex.cpp:679), and system.symbols.address_end is that offset_end (src/Storages/System/StorageSystemSymbols.cpp:119), so within one trace every frame :54 counts also satisfies the BETWEEN clause. Zeroed, shifted, or offset-form addresses redden :54 first.

So both suggested remedies cost coverage:

  • # Tags: no-darwin on 03172 deletes the checks listed above. Over the last 14h 03172 is 81 OK / 0 FAIL on Fast test (arm_darwin) across 80 distinct pull requests, and has no failure on any other check.
  • Rewriting :60-70 to the Darwin behaviour drops the offset bound on every ELF arm, where it is the contract being tested (301 OK / 0 FAIL on Linux Fast test, 173 pull requests).

I am leaving 03172 alone and not changing this PR. The one point I do take: the comment at 03172:60-62 states the ELF mechanism without qualifying it by platform. That is text only, so it is not worth a push against a green test on its own.

@clickhouse-gh clickhouse-gh Bot added the comp-testing Test content only (no production code). label Sep 10, 2026
@Algunenano Algunenano self-assigned this Sep 10, 2026
@Algunenano
Algunenano added this pull request to the merge queue Sep 10, 2026
Merged via the queue into ClickHouse:master with commit a77884d Sep 10, 2026
174 of 175 checks passed
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 10, 2026
ei-grad added a commit to ei-grad/ClickHouse that referenced this pull request Sep 10, 2026
Bring in the upstream Darwin exclusion for the file-offset check. The
assertion depends on ELF executable offsets and reads a mutable,
server-wide `system.errors` row, so retain both `no-darwin` and
`no-parallel` when resolving the test header.

Keep the trace lifecycle changes while taking the upstream `TCPHandler`
query-kind initialization and settings-masking corrections. The test's
executable commands and reference assertions remain intact.

ClickHouse#119145
ClickHouse#118415
https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=118415&sha=02075ae13fe4fa5baff34b23af02d084e6232eec&name_0=PR&name_1=Fast%20test%20%28arm_darwin%29

Co-Authored-By: Codex CLI <[email protected]>
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Sep 10, 2026
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Sep 10, 2026
cursor Bot pushed a commit that referenced this pull request Sep 10, 2026
…k-5dc0

Picks up #119145, which tags 05076_error_trace_file_offsets as no-darwin - that
test is what the Fast test (arm_darwin) failure on this PR was, and it fails on
master too.

Co-authored-by: Yakov Olkhovskiy <[email protected]>
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
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
@clickhouse-gh clickhouse-gh Bot added comp-logging Logging/monitoring/observability (logs, metrics, tracing, instrumentation). and removed comp-testing Test content only (no production code). labels Nov 22, 2026
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-logging Logging/monitoring/observability (logs, metrics, tracing, instrumentation). groeneai-origin-ci-master PR origin: master/nightly CI monitoring finding pr-ci 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.

3 participants