Skip to content

Serialize ROOT_ENUM_ERROR accurately in reference-chain abandonment events - #990

Draft
jbachorik wants to merge 2 commits into
mainfrom
dd/serialize-root-enum-error-accurately-in-reference-chain-aban-bnfn
Draft

jbachorik wants to merge 2 commits into
mainfrom
dd/serialize-root-enum-error-accurately-in-reference-chain-aban-bnfn

Conversation

@jbachorik

@jbachorik jbachorik commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

What does this PR do?:

Serialize SearchAbandonReason::ROOT_ENUM_ERROR as root_enum_error in datadog.ReferenceChainAbandoned, instead of unknown. Add an error counter and regression coverage for the encoded reason, the counter increment, and the Java-to-JFR path.

Motivation:

Root-enumeration failures already have a distinct engine reason. Losing that reason during serialization hides why the search stopped.

Additional Notes:

  • No JFR field/schema change. Existing abandonment thresholds and retry scheduling remain unchanged.
  • Keep RECORDING_END mapped to unknown; recording stop does not enqueue an abandonment event.
  • Accepted cost: one counter increment per failed enumeration attempt. Error injection is read only in debug builds; its atomic flag remains in the tracker in release builds.
  • TTL deferral policy is unchanged; related work is tracked in PROF-16457.
  • Human review is required before merge. Focus on the reason-string contract and the debug-only injection path.
  • Sphinx reviewed eafb93e6a..d952104e0 using the existing knowledge graph: no code findings. One INFO note says mutation analysis excluded test files; the tests were executed separately as listed below.

How to test the change?:

./.claude/commands/build-and-summarize \
  :ddprof-lib:gtestDebug :ddprof-test:testDebug \
  -Ptests=ReferenceChainRootEnumErrorTest \
  :ddprof-lib:qualityChecks spotlessCheck

Passed for d952104e0: 1,154 native test cases across 97 binary summaries; the Java test passed with no skips and read one abandonment event. Quality and formatting checks passed. Evidence: build/logs/20261113-184019-_ddprof-lib_gtestDebug.log and the testDebug XML result for ReferenceChainRootEnumErrorTest.

  • AbandonedEventSerializesRootEnumErrorReason checks the encoded reason and unknown-value fallback.
  • ConsecutiveEnumErrorsAbandonSearch checks error-counter deltas during real tracker passes.
  • ReferenceChainRootEnumErrorTest forces enumeration errors and asserts the reason read from the resulting JFR.

For Datadog employees:

  • If this PR touches code that signs or publishes builds or packages, or handles
    credentials of any kind, I've requested a security review (run the dd:platform-security-review
    skill, or file a request via the PSEC review form).
    bewaire also runs automatically on every PR.
  • This PR doesn't touch any of that.
  • JIRA: PROF-16662

@dd-octo-sts

dd-octo-sts Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Scan-Build Report

User:runner@runnervmccnms
Working Directory:/home/runner/work/java-profiler/java-profiler/ddprof-lib/src/test/make
Command Line:make -j4 all
Clang Version:Ubuntu clang version 21.1.8 (6ubuntu1)
Date:Fri Nov 13 17:52:44 2026

Bug Summary

Bug TypeQuantityDisplay?
All Bugs2
Logic error
Dereference of null pointer1
Unused code
Dead initialization1

Filter Results by File

Reports

Bug Group Bug Type ▾ File Function/Method Line Path Length
Unused codeDead initializationreferenceChains.cppapplyOomRamp4971
Logic errorDereference of null pointerperfEvents_linux.cppunregisterThread72026

@dd-octo-sts

dd-octo-sts Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

CI Test Results

Run: #43477047680 | Commit: 2f6e4ee | Duration: 20m 0s (longest job)

✅ All 32 test jobs passed

Status Overview

JDK glibc-aarch64/debug glibc-amd64/debug musl-aarch64/debug musl-amd64/debug
8 - ✅ - -
8-ibm - ✅ - -
8-j9 ✅ ✅ - -
8-librca - - ✅ ✅
8-orcl - ✅ - -
11 - ✅ - -
11-j9 ✅ ✅ - -
11-librca - - ✅ ✅
17 ✅ ✅ - -
17-graal ✅ ✅ - -
17-j9 ✅ ✅ - -
17-librca - - ✅ ✅
21 ✅ ✅ - -
21-graal ✅ ✅ - -
21-librca - - ✅ ✅
25 ✅ ✅ - -
25-graal ✅ ✅ - -
25-librca - - ✅ ✅

Legend: ✅ passed | ❌ failed | ⚪ skipped | 🚫 cancelled

Summary: Total: 32 | Passed: 32 | Failed: 0


Updated: 2026-11-13 18:15:32 UTC

@dd-octo-sts

dd-octo-sts Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

✅ All 40 integration tests passed

📊 Dashboard · 👷 Pipeline · 📦 d952104e

@datadog-official

datadog-official Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Pipelines

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: d952104 | Docs | Give us feedback!

@jbachorik

Copy link
Copy Markdown
Collaborator Author

@DataDog review

@datadog-official datadog-official Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bits Code Review: PASS

More details

The static review found the ROOT_ENUM_ERROR mapping and bounds check consistent with the enum, with error injection confined to debug builds. No actionable defects were identified.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 2dba42f

…vents

The reference-chain termination ladder (MAX_CONSECUTIVE_ENUM_ERRORS) can
abandon a search with SearchAbandonReason::ROOT_ENUM_ERROR, but the
datadog.ReferenceChainAbandoned reason table stopped at canary_stuck, so
that abandonment serialized as "unknown" and misattributed the cause in
the JFR event. The table now covers the whole enum: an "unknown" slot at
RECORDING_END (never enqueued, keeps ROOT_ENUM_ERROR at its enum index),
"root_enum_error" at 5, and a size-based bounds check.

A root-enum JVMTI error also increments the
reference_chain_root_enum_errors counter, and the stale termination
ladder and abandonment-reason list in doc/ now describe the ROOT_ENUM_ERROR
branch. Debug-build-only seam setRootEnumErrorInjection0 plus a native
serialization gtest and a Java end-to-end test pin the reason string.
…earch

Each errored root-enumeration attempt must bump the exported
reference_chain_root_enum_errors counter; assert +1 after the first
errored attempt and MAX_CONSECUTIVE_ENUM_ERRORS at the abandon pass so
removing or retargeting the increment fails the test.

PROF-16662
@jbachorik
jbachorik force-pushed the dd/serialize-root-enum-error-accurately-in-reference-chain-aban-bnfn branch from 2dba42f to d952104 Compare November 13, 2026 17:51
@jbachorik jbachorik added the AI label Nov 13, 2026

This branch has not been deployed

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant