Repository navigation
Conversation
|
Workflow [PR], commit [3b38486] Summary: ❌
AI ReviewSummaryThis draft PR tries to verify macOS stacktrace-log attachment by making Missing context / blind spots
Findings❌ Blockers
Final VerdictRequest changes before merge. |
`_ensure_lldb_installed` installs `lldb` at runtime so `print_c_stacktraces` can attach and dump C++ backtraces. On Linux it used `apt-get`, which requires root; the fast-test container runs unprivileged, so `apt-get update` fails with "List directory /var/lib/apt/lists/partial is missing. - Acquire (13: Permission denied)", lldb never lands, and `print_c_stacktraces` only logs `lldb: command not found` (no c_stacktraces.log is written or attached). Observed on a testing PR that leaves a query hung until the end-of-run hung check: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=111213&sha=84b4363107f7eb2319eacaafa3e1adb18bae0e36&name_0=PR&name_1=Fast%20test (PR ClickHouse#111213). There `sql_stacktraces.log` was attached but `c_stacktraces.log` was missing for the reason above. Unify the on-demand install on Homebrew, which needs no root and matches how the macOS runner already provisions lldb (`brew install ... llvm` plus `{prefix}/opt/llvm/bin` on the job PATH in runner-init.py). `brew install llvm` is keg-only and does not symlink `lldb` system-wide, so also prepend the formula bin dir to PATH so `shutil.which("lldb")` resolves the freshly installed binary. Related: ClickHouse#107173 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
… log attachment Throwaway testing change (do NOT merge) on top of the brew-based lldb install fix (ClickHouse#112058). Adds a stateless test that never finishes: it detaches a long-running server-side query (with max_execution_time = 0 so the server does not self-kill it) into its own session via os.setsid, so it lingers in system.processes past the end of the run and the end-of-run hung check dumps and attaches the full server stacktraces (sql_stacktraces.log / c_stacktraces.log). Its foreground also hangs past --timeout so it is reported as a timeout. Related: ClickHouse#107173 Related: ClickHouse#112058 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
84b4363 to
2b6a6ee
Compare
`_ensure_lldb_installed` had unified the on-demand install on Homebrew,
but `brew` is not present in the Linux `clickhouse-test` containers, so
that path failed with `ENOENT` on exactly the jobs it was meant to fix.
Use the native package manager per platform: `brew install llvm` on
macOS (keeping the keg-only PATH fix so `shutil.which("lldb")` resolves
the freshly installed binary), `apt-get install -y lldb` on Linux.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
`_ensure_lldb_installed` split the install across two package managers: Homebrew on macOS and `apt-get` on Linux. The Linux branch can never work where it matters: the Fast test job runs in the unprivileged `clickhouse/fasttest` container (`docker run --user $(id -u):$(id -g)`, see `ci/praktika/runner.py`), so `apt-get install lldb` fails with a permission error and `c_stacktraces.log` is never written. Installing `lldb` on Linux belongs in the image, not at runtime -- see PR ClickHouse#104815 (`Install lldb in CI Docker images alongside gdb`). Drop the dead Linux branch and keep only the macOS Homebrew path (the Darwin runner is a bare host, not a container, so an on-the-fly install is the right tool there). On Linux the helper is now a no-op. Touching `tests/clickhouse-test` also changes the `Fast test (arm_darwin)` cache digest, so the job is a cache miss and actually re-runs on a real macOS host -- the previous run reused a cached result and reported `skipped`: https://github.com/ClickHouse/ClickHouse/actions/runs/30324617319 Related: ClickHouse#104815
The test is a plain stateless test, so it ran (and hung) in the Linux `Fast test` and in every `Stateless tests` job, not just the macOS `Fast test (arm_darwin)` run it is meant for. Those Linux jobs are transitive `needs` of `Fast test (arm_darwin)` (via the `arm_darwin` build and `CORE_BLOCKING_JOB_NAMES`), so their timeout failure tripped the per-job GitHub Actions `if:` guard (`!contains(needs.*.outputs.pipeline_status, 'failure')`, ci/praktika/yaml_generator.py) and the macOS job was skipped before it could run — the previous run never produced `c_stacktraces.log`: https://github.com/ClickHouse/ClickHouse/actions/runs/30329003808 Exit cleanly on non-Darwin (the reference is empty, so it passes) and hang only on macOS, keeping the dependency chain green so the macOS job runs the hang and dumps the server stacktraces.
…call `_ensure_lldb_installed` made two `brew` calls: `brew install llvm` and `brew --prefix llvm` to locate the keg-only `lldb`. The second call is redundant: `llvm` is keg-only, so its bin dir is the version-stable `opt/llvm` path under the Homebrew prefix (`/opt/homebrew` on Apple Silicon, `/usr/local` on Intel). `runner-init.py`'s `macos_job_path` already hardcodes exactly this path when assembling the job PATH, so derive it the same way and drop the extra subprocess (and its failure branch).
| # (the same way `runner-init.py`'s `macos_job_path` assembles the job PATH) | ||
| # rather than spending a second `brew --prefix llvm` subprocess on it. | ||
| brew_prefix = "/opt/homebrew" if platform.machine() == "arm64" else "/usr/local" | ||
| os.environ["PATH"] = f"{brew_prefix}/opt/llvm/bin:{os.environ.get('PATH', '')}" |
There was a problem hiding this comment.
Returning early on every non-Darwin platform drops the only working path that currently puts lldb on Linux. The in-tree Linux images this script runs in still copy /opt/gdb and install llvm-*, but I do not see them installing lldb itself in ci/docker/fasttest/Dockerfile or ci/docker/test-base/Dockerfile. print_c_stacktraces is still used from the Linux timeout / hung-check / server-died paths, so after this change those flows fall through to shutil.which("lldb") or "lldb" and produce command not found instead of a C backtrace. If we want to stop installing on the fly, the Linux images need to gain lldb in the same change; otherwise we should keep a working Linux fallback here until that lands.
| # execution time is too long`) after a few minutes — before the end-of-run hung | ||
| # check runs — so `system.processes` would be empty and nothing would be dumped. | ||
| python3 -c 'import os, sys, subprocess; os.setsid(); subprocess.Popen(sys.argv[1:])' \ | ||
| $CLICKHOUSE_CLIENT --query "SELECT sleepEachRow(1) FROM numbers(100000) SETTINGS max_block_size = 1, max_execution_time = 0, max_estimated_execution_time = 0" & |
There was a problem hiding this comment.
The detached clickhouse-client inherits the script's redirected stdout / stderr, and this query still produces rows. After the foreground shell times out, run_single_test immediately rewrites and reads those files, but the detached client is still appending to them in the background, so the timeout result becomes nondeterministic for no benefit. The hung-check only needs a live query in system.processes, so it would be safer to make this FORMAT Null and launch the detached client with its own stdout / stderr redirected away from the test files (for example via subprocess.DEVNULL inside the Python helper).
|
Testing PR |
Testing PR — do not merge. Rebased onto the brew-based lldb install fix (#112058) to verify, on a real
Fast testrun, that a hung query's server stacktraces are written to files and attached to the report.It carries two things:
_ensure_lldb_installedchange from darwin fast test: install lldb on demand via brew on macOS only #112058: installlldbon demand via Homebrew instead ofapt-get(which fails unprivileged in the fast-test container), plus the keg-only PATH fix soshutil.which("lldb")resolves.04612_artificial_timeout_stacktrace_dump.sh, that never finishes. It detaches a long-running server-side query (SELECT sleepEachRow(1) FROM numbers(100000)withmax_execution_time = 0so the server does not self-kill it) into its own session viaos.setsid, so it lingers insystem.processespast the end of the run. The end-of-run hung check then fires and callsprint_sql_stacktraces/print_c_stacktraces, which writesql_stacktraces.log/c_stacktraces.logforfast_test.pyto attach. Its foreground also hangs past--timeoutso the test is reported as a timeout too.Expected result: the CI report carries
sql_stacktraces.log(and, wherelldbis available,c_stacktraces.log) as attached artifacts, andjob.logkeeps only a trimmed preview.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):