Skip to content

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

Closed
Algunenano wants to merge 2 commits into
ClickHouse:masterfrom
Algunenano:revert-pie-file-offsets
Closed

Algunenano wants to merge 2 commits into
ClickHouse:masterfrom
Algunenano:revert-pie-file-offsets

Conversation

@Algunenano

@Algunenano Algunenano commented Sep 10, 2026 •

Copy link
Copy Markdown
Member

Related: #117449
Related: #119145

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

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

Revert of #117449 ("Print file offsets in the bare fatal stack traces and build the release binary as PIE") and its followup #119145 ("Do not run 05076_error_trace_file_offsets on Darwin").

🤖 Generated with Claude Code


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

Algunenano and others added 2 commits September 10, 2026 15:42
This reverts commit a77884d, part of a
revert of ClickHouse#117449 and its followup ClickHouse#119145.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
…he release binary as PIE"

This reverts commit 30c0912, this is a
revert of ClickHouse#117449 and its followup ClickHouse#119145.

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

clickhouse-gh Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [99d1c94]


AI Review

Summary

This PR reverts #117449 and #119145, restoring the pre-PIE build flags and the pre-normalized stack-trace storage/logging paths. The revert is mechanically consistent and CI is green, but it also reintroduces two observability regressions: persisted system.error_log traces go back to storing process-local addresses, and the bare fatal Stack trace: fallback diverges again from the normalized addresses in the symbolized trace.

Missing context / blind spots
  • ⚠️ The PR body says what is being reverted, but not what regression requires rolling back the trace-normalization pieces together with -pie. A link to the concrete blocker would help judge whether only the build-hardening part needs to be reverted.
Findings

⚠️ Majors

  • [src/Interpreters/ErrorLog.cpp:144] system.error_log is the persisted error-history surface, but this change stores raw Exception::Trace pointers again. addressToSymbol only decodes current-process virtual addresses or pre-normalized offsets, so after a restart every shared-library frame, and all ClickHouse frames on PIE builds, stop symbolizing. Keep a restart-stable encoding such as resolveAddressForStorage for the stored column.
  • [src/Common/SignalHandlers.cpp:628] The bare Stack trace: fallback goes back to raw runtime addresses even though StackTrace::toStringEveryLine still prints ELF frames as per-object offsets. That makes the fallback line incomparable with the symbolized lines below it and unusable for addr2line on shared-library frames; on PIE builds the same happens for main-binary frames. Keep the normalized or object-qualified representation in the bare dump.
Final Verdict
  • Status: ⚠️ Request changes
  • Minimum required actions: preserve a restart-stable encoding for system.error_log.last_error_trace, and keep the bare fatal stack trace in the same address space or object-qualified form as the symbolized trace.

addrs.reserve(trace.size());
for (auto * ptr : trace)
addrs.push_back(StackTrace::resolveAddressForStorage(ptr));
addrs.push_back(reinterpret_cast<uintptr_t>(ptr));

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.error_log is the persisted error-history surface, so storing raw Exception::Trace pointers here reintroduces the "address valid only in the process that threw" problem. addressToSymbol only decodes current-process virtual addresses or pre-normalized offsets (SymbolIndex::findSymbol converts only when findObject succeeds), so after a restart every shared-library frame, and all ClickHouse frames on PIE builds, stop symbolizing. Because this table has no trace_full companion, operators lose the only machine-readable stack trace for historical errors. Please keep resolveAddressForStorage or another restart-stable encoding on the stored column even if the executable itself goes back to non-PIE.

{
writeChar(' ', bare_stacktrace);
writeResolvedAddress(stack_trace.getFramePointers()[i], bare_stacktrace);
writePointerHex(stack_trace.getFramePointers()[i], bare_stacktrace);

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.

StackTrace::toStringEveryLine still formats ELF frames with frame.physical_addr, i.e. offsets inside the owning object, but this bare dump is back to logging raw runtime addresses. That puts the Stack trace: line in a different address space than the symbolized lines immediately below it, so the fallback is no longer directly comparable or suitable for addr2line on shared-library frames; on PIE builds the same applies to ClickHouse frames too. Since this bare dump is the thing we rely on when symbolization itself fails, reverting writeResolvedAddress looks like a real diagnostic regression.

@Algunenano

Copy link
Copy Markdown
Member Author

Reverted in #119279

@Algunenano Algunenano closed this Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-not-for-changelog This PR should not be mentioned in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant