Repository navigation
fix(dictionary): survive a failed root-table calloc (PROF-16703) - #1074
zhengyu123 wants to merge 4 commits into
Conversation
Dictionary(int) wrote _table->base_index after an unchecked calloc. A failed allocation now leaves an empty dictionary: lookup returns its sentinel, collect and clear do nothing, and the destructor skips the accounting the constructor never recorded. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A failed constructor now touches no DICTIONARY_* counter, which are shared by id with live sibling dictionaries. The tests also assert the reserved SymbolDictionary entries and the bounded insert path after recovery. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Adds a sibling-dictionary counter test and drops a bounded_lookup check that could not detect the regression it named. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ewrite The sibling now grows overflow tables, so its counters differ from the values a failed constructor would write if it set them as the success path does. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@DataDog review |
|
🐶 babysit-pr was watching this PR — CI breakages and mechanical findings are fixed and pushed automatically; design decisions are always brought to you. This run
✅ stopped 21:36 UTC · all GitHub checks and Bits green; dd-gitlab/post-pr-comment failed (integration tests produced no results), needs a human GitLab retry |
There was a problem hiding this comment.
More details
The null-root guards preserve lookup sentinels and leave native-memory accounting and shared dictionary counters untouched after allocation failure. The completed static review found no actionable defect.
🤖 Bits Code Review · Commit 558e32d
There was a problem hiding this comment.
More details
Failed root allocation leaves an empty dictionary with preserved lookup sentinels and symbol fallbacks, while cleanup avoids changing shared accounting. The static reviewer reported no actionable defects.
🤖 Bits Code Review · Commit 558e32d
❌ ErrorsYour PR has failed checks. Please review the issues below and take necessary action before merging. 🚦 31 Pipeline jobs failed
ℹ️ Info🔁 Datadog re-ran Useful? React with 👍 / 👎 This comment will be updated automatically if new data arrives.🔗 Commit SHA: 558e32d | Docs | View more details | Give us feedback! |
Memory overhead check: ✅ within budgetProfiler
✅ Not budgeted (too noisy on shared runners)
|
CI Test ResultsRun: #46511117485 | Commit:
Status Overview
Legend: ✅ passed | ❌ failed | ⚪ skipped | 🚫 cancelled Summary: Total: 32 | Passed: 32 | Failed: 0 Updated: 2026-11-30 21:20:52 UTC |
|
🚨 Integration tests could not run — no results were produced No applicable configuration in 👷 Pipeline · 📦 10 not applicable (not scheduled): musl-x64-openj9, musl-arm64-openj9. OpenJ9 requires glibc; upstream publishes no musl runtime. |
What does this PR do?:
Dictionary(int)no longer writes through a NULL_tablewhen the root-tablecallocfails. A failed construction leaves an empty dictionary:lookup()returns its sentinel, the same signal as a failed insert, sobounded_lookup()andcheck()follow.collect()andclear()do nothing, and~Dictionary()returns early.NativeMemorDICTIONARY_*counter is touched. The counters are shared by id with live sibling dictionaries (Lookupbuilds_packagesand_symbols, both id 0).Motivation:
PROF-16703. Same defect class as PROF-16692 / #1005, which fixed the insert paths only. The constructor runs on every dump.
Additional Notes:
_tablewith NULL guards. Embedding the root table by value would remove the guards, but it moves about 6 KB into the object. Rejected here to keep the change small.clear()does not retry the root allocation.Lookupbuilds its dictionaries per dump, so a failed one is short-lived.How to test the change?:
New gtests in
dictionary_ut.cpp, using a test-only flag that forces the rootcallocto fail:NativeMembalance;SymbolDictionaryresolving to its reserved ids, with the entry contents asserted;Results:
qualityChecksand:ddprof-lib:gtestDebug, macOS arm64, at937c76f99: 0 failures.dictionary_utpasses 18 tests at the final head.dictionary_utin aarch64 containers (glibc ASan, glibc debug, musl debug) at72dd2a65f: exit 0 each. Later commits are test-only and were not re-run there.For Datadog employees:
credentials of any kind, I've requested a security review (run the
dd:platform-security-reviewskill, or file a request via the PSEC review form).
bewairealso runs automatically on every PR.Unsure? Have a question? Request a review!
🤖 Generated with Claude Code