Skip to content

Remove two tracked jemalloc heap dumps and ignore jeprof.*.heap - #117279

Merged
alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:remove-jeprof-heap-artifacts
Aug 31, 2026
Merged

alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:remove-jeprof-heap-artifacts

Conversation

@groeneai

@groeneai groeneai commented Aug 31, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #113242

Two jemalloc heap dumps, jeprof.2964715.0.heap and jeprof.3011593.0.heap (45 KB), are tracked in the repository root. Nothing references them and they are the only tracked files of that shape.

With jemalloc's default opt.prof_prefix, flushProfile in src/Common/Jemalloc.cpp builds a relative jeprof.<pid>.<seq>.heap, so a flushed profile lands in whatever directory the server was started from, and the test configuration enables that flush automatically (tests/config/config.d/jemalloc_flush_profile.yaml). Nothing in .gitignore matched the name. The new entry is scoped to exactly the shape that format string produces, and leaves the tracked ci/docker/test-base/jeprof helper alone.

Reported by @ zlareb1 in #113242 (comment).

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


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

`jeprof.2964715.0.heap` and `jeprof.3011593.0.heap`, 45130 bytes together, are
jemalloc `heap_v2` profiler output tracked in the repository root. Nothing
references them and they are the only tracked files of that shape.

When jemalloc's `opt.prof_prefix` is left at its default `jeprof`, `flushProfile`
in `src/Common/Jemalloc.cpp` formats a relative `jeprof.<pid>.<seq>.heap`, so a
server with profiling enabled writes the dump into its working directory.
Nothing in `.gitignore` matched that name, and the large-file check in
`ci/jobs/scripts/check_style/various_checks.sh` has a 5 MB threshold, so a 22 KB
dump passed both. The new entry is scoped to exactly that shape and leaves the
tracked `ci/docker/test-base/jeprof` helper and every other `.heap` name alone.

Reported by @ zlareb1 in
ClickHouse#113242 (comment)

Co-Authored-By: Claude Opus 5 <[email protected]>
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-review-human PR origin: human review feedback on a groeneai PR labels Aug 31, 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; 0 findings). Its stated coverage:
the complete final .gitignore, both deleted heap-profile blobs, flushProfile and all of its
call sites, jemalloc's filename-generation siblings, the relevant configuration, the tracked
jeprof helper, and the existing regression test.

I also read the resulting tree cold before running that gate. It raised four items, all in
human-facing text rather than in the diff, all resolved before publication:

# Sev Finding Verdict Evidence / action
1 ⚠️ The Related: link sat inside the leading HTML comment, where it does not render and creates no cross-reference AGREE moved to a visible line; .claude/CLAUDE.md:174 says GitHub renders such a line, which holds only outside a comment
2 💡 "a server with profiling enabled writes the dump into its working directory" omitted the condition that arms it AGREE the description now names the automatic flush and the test configuration that enables it. Measured: all four explicit flushProfile callers pass absolute /tmp/... prefixes, and the three jemalloc_flush_profile_* server settings default to 0 (src/Core/ServerSettings.cpp:1484-1486), so profiling alone never writes into the working directory
3 💡 .claude/CLAUDE.md:149 was cited as governing the absence of a test, but it governs removing a feature AGREE the validation-gate answer now gives the substantive reason and cites that line only for its rationale
4 💡 A line citation was off by one (various_checks.sh:258) AGREE corrected to :259

Noted, not addressed here: the dump path is relative because MemoryTracker forwards
opt.prof_prefix verbatim, so a server started locally with the repository's test configuration
keeps writing dumps into whatever directory it was started from. Giving that path an absolute
prefix, as ci/jobs/functional_tests.py:986 already does for CI, is a source change outside the
scope of this cleanup.

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

Session id: cron:clickhouse-review-slot-9:20260831-071900

@clickhouse-gh clickhouse-gh Bot added the manual approve Manual approve required to run CI label Aug 31, 2026
@clickhouse-gh clickhouse-gh Bot closed this Aug 31, 2026
@clickhouse-gh clickhouse-gh Bot reopened this Aug 31, 2026
@clickhouse-gh

clickhouse-gh Bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [f872cbc]

Summary: ✅


AI Review

Summary

This PR removes two accidentally committed jemalloc heap profile dumps from the repository root and adds a .gitignore rule for future jeprof.*.heap byproducts. I did not find any correctness, metadata, or evidence gaps in the current diff that warrant an inline review comment.

Final Verdict

✅ No review findings.

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Aug 31, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes, and it is a repository state rather than a runtime failure: gh api .../contents?ref=master lists both paths (21983 and 23147 bytes) and git ls-files lists them locally. The mechanism has a deterministic pre-state too: git check-ignore --no-index jeprof.2964715.0.heap exits 1, i.e. not ignored, which is why git add -A staged them.
b Root cause explained? Yes. MemoryTracker flushes heap profiles automatically (MemoryTracker.cpp:380, :390, :635), passing the prefix it reads from opt.prof_prefix. When that is jemalloc's default jeprof, flushProfile (Jemalloc.cpp:73) formats a relative jeprof.<pid>.<seq>.heap, so the dump lands in the server's working directory. No .gitignore rule matched, and the large-file check (various_checks.sh:259) has a 5 MB threshold, so a 22 KB dump passed both. Both artifacts have sequence 0 and different pids, consistent with two server processes on their first flush.
c Fix matches root cause? Yes. The deletion removes the committed instances; the ignore line closes the staging path at exactly the shape the generator emits. Lowering the 5 MB threshold was rejected as the wrong layer (the defect is "this shape is never source", not "files are too big"), and *.heap was rejected as broader than the generator.
d Test intent preserved / new tests added? No test, deliberately: there is no runtime behaviour to exercise. The deletion is asserted by the diff itself, and the ignore rule is git's own matching, checked in both directions in row (e). A test asserting the two paths are absent would only pin down the absence of something, which .claude/CLAUDE.md:149 calls noise. No existing test was touched, weakened or removed, and nothing in the tree references the deleted paths.
e Both directions demonstrated? Yes. Before: git check-ignore -v --no-index exits 1 for both filenames and for a nested programs/server/jeprof.99.0.heap. After, against the committed .gitignore: all exit 0 and print .gitignore:57:jeprof.*.heap, so the match is attributed to this commit's rule and not to some pre-existing one.
f Fix is general across code paths? Yes. All four flushProfile callers were checked, not only the one that produced these files: InterpreterSystemQuery.cpp:1323, StorageSystemJemallocProfileText.cpp:73, KeeperJemallocHandler.cpp:99 and FourLetterCommand.cpp:685 all pass absolute /tmp/... prefixes, and CI sets an absolute prof_prefix (ci/jobs/functional_tests.py:986), which takes the early return at Jemalloc.cpp:67. git ls-files confirms no other tracked file of this class exists.
g Fix generalizes across inputs (params/datatypes/wrappers)? Yes, over the input space that applies to a path glob. Matches both real filenames plus two nested paths; rejects 7 negatives covering the boundaries: no middle segment (jeprof.heap), no .heap suffix (jeprof), suffix only (foo.heap, heap), unanchored prefix (myjeprof.1.0.heap), extended suffix (.heap.sym), and the tracked ci/docker/test-base/jeprof helper. Left un-anchored on purpose, since the dump follows whatever working directory the server had.
h Backward compatible? (maintainer-approved exception only) Yes, trivially. No setting, no serialization format and no source, so SettingsChangesHistory.cpp does not apply. A .gitignore addition never untracks anything already tracked, which is confirmed by ci/docker/test-base/jeprof remaining tracked, and it is revertible by deleting three lines.
i Invariants and contracts preserved? Yes. No code, no concurrency, no data structures. The one invariant at risk is that the tracked jeprof helper script stays tracked and un-ignored, and that is asserted directly. Repository invariant established: profiler byproducts of the form <prof_prefix>.<pid>.<seq>.heap are not tracked here.

Style check (ci/jobs/scripts/check_style/various_checks.sh) reports 0 findings. Because an
empty result is also what a broken run looks like, I confirmed the run was real two ways: a
bash -x trace showing it executed end to end, and a planted violation which it correctly
reported. git -c diff.ignoreSubmodules=none diff --cached --stat shows no contrib/ line.

Session id: cron:clickhouse-impl-slot-41:20260831-065600

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @pamarcos, could you review this? It deletes two jemalloc heap dumps that were committed to the repository root and adds a jeprof.*.heap entry to the root .gitignore, scoped to the exact filename shape flushProfile builds when opt.prof_prefix is left at jemalloc's default.

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Aug 31, 2026
@alexey-milovidov alexey-milovidov self-assigned this Aug 31, 2026
Merged via the queue into ClickHouse:master with commit 8b9c265 Aug 31, 2026
344 checks passed
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 31, 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 groeneai-origin-review-human PR origin: human review feedback on a groeneai PR manual approve Manual approve required to run CI pr-not-for-changelog This PR should not be mentioned in the changelog 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