Skip to content

Temporarily disable the query and memory profilers on macOS - #111595

Closed
Algunenano wants to merge 3 commits into
ClickHouse:masterfrom
Algunenano:darwin-disable-sampling-profiler
Closed

Algunenano wants to merge 3 commits into
ClickHouse:masterfrom
Algunenano:darwin-disable-sampling-profiler

Conversation

@Algunenano

@Algunenano Algunenano commented Jul 23, 2026 •

Copy link
Copy Markdown
Member

Temporary stopgap for the Fast test (arm_darwin) Server died failures hitting unrelated PRs since 2026-07-21 (enabled by #109825, which turned on the sampling/query and memory profilers and trace_log symbolization on macOS).

Root cause (from a macOS .ips crash report of a local reproduction): a profiler captures a stack via the system backtrace() (Darwin __thread_stack_pcs) while a thread is running on a boost::context fiber stack (e.g. the async reader of a remote(...) query). __thread_stack_pcs walks the frame-pointer chain off the end of the fiber stack into unmapped memory and the server crashes with SIGSEGV. The faulting path observed was the memory profiler: MemoryTracker allocation sampling → AllocationTrace::onAllocImpl → StackTrace() → backtrace(), which is not protected by the asynchronous_stack_unwinding recovery, so there is no siglongjmp fallback and the crash is fatal. The memory profiler is active by default (total_memory_profiler_step/memory_profiler_step = 4 MiB).

This disables the profiler stack capture on macOS until the unwind is made safe on fiber stacks:

  • Query profiler (QueryProfilerReal/QueryProfilerCPU): not constructed in initGlobalProfiler/initQueryProfiler.
  • Memory profiler: MemoryTracker::setProfilerStep/setSampleProbability are no-ops on macOS, so allocation sampling never captures a stack (memory limits/accounting are unaffected).

The profiler/trace_log tests unskipped/added by #109825 are restored to ci/defs/darwin.skip since system.trace_log no longer gets these samples on macOS.

Follow-up (proper fix, separate PR): make the macOS stack capture safe on fiber stacks (bounded frame-pointer walk that stops at the current stack-segment boundary, and/or guard every StackTrace() capture with the existing async-unwind recovery).

Caused by: #109825
Related: #111579

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):

@clickhouse-gh

clickhouse-gh Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [8906365]

Summary: ⏳

job_name test_name status info comment
Stateless tests (arm_binary, parallel) FAIL
04625_hash_table_sizes_stats_table_expression_modifiers FAIL cidb

AI Review

Summary

This PR temporarily disables the query and memory profilers on macOS to stop Darwin-specific backtrace() faults on fiber stacks, and narrows the restored darwin.skip block to tests that genuinely depend on the disabled trace types. After checking the current diff, the touched profiler paths, the skipped tests, and all prior review discussion, I do not see an outstanding correctness, safety, or coverage issue in the current head. The previously reported clickhouse-gh concerns are fixed in 8906365b59897eca31ca84d49193b426b13599fd, and the PR CI report for this head is clean.

Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Jul 23, 2026
@Algunenano Algunenano added v26.7-must-backport pr-bugfix Pull request with bugfix, not backported by default and removed pr-ci labels Jul 23, 2026
Comment thread ci/defs/darwin.skip Resolved
@Algunenano Algunenano changed the title Temporarily disable the sampling query profiler on macOS Temporarily disable the query and memory profilers on macOS Jul 23, 2026
@clickhouse-gh clickhouse-gh Bot added pr-ci and removed pr-bugfix Pull request with bugfix, not backported by default labels Jul 23, 2026
Comment thread src/Common/MemoryTracker.h Resolved
…S; trim darwin.skip to profiler-dependent tests
@Algunenano

Copy link
Copy Markdown
Member Author

I have a proper fix in the works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant