Skip to content

Wire reference chains into profiler lifecycle and JNI API - #798

Draft
jbachorik wants to merge 1 commit into
jb/rc-3-refchain-trackerfrom
jb/rc-4-profiler-wiring
Draft

jbachorik wants to merge 1 commit into
jb/rc-3-refchain-trackerfrom
jb/rc-4-profiler-wiring

Conversation

@jbachorik

@jbachorik jbachorik commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?:
Wires the reference-chain engine into the profiler lifecycle:

  • Profiler starts/stops ReferenceChainTracker and LivenessTracker with the recording, drains resolved chain events into JFR on dump(), and emits abandoned-search events.
  • ObjectSampler always informs LivenessTracker of the recording's flags so they cannot go stale across recordings.
  • javaApi.cpp adds the reference-chain natives and test seams; JavaProfiler.java declares them.
  • vmEntry GC-event hooks feed the tracker.

Motivation:
Part 4 of the stacked series for PROF-15341; makes the tracker from the previous PR reachable from a live recording.

Additional Notes:
Stacked on #797.

How to test the change?:
buildDebug compiles and links; end-to-end behavior is covered by the Java integration tests later in the stack.

For Datadog employees:

  • This PR doesn't touch any of that.
  • JIRA: PROF-15341

@dd-octo-sts

dd-octo-sts Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Scan-Build Report

User:runner@runnervmlun5p
Working Directory:/home/runner/work/java-profiler/java-profiler/ddprof-lib/src/test/make
Command Line:make -j4 all
Clang Version:Ubuntu clang version 18.1.3 (1ubuntu1)
Date:Thu Sep 17 20:07:57 2026

Bug Summary

Bug TypeQuantityDisplay?
All Bugs4
C++ move semantics
Use-after-move1
Logic error
Dereference of null pointer1
Result of operation is garbage or undefined1
Unused code
Dead increment1

Reports

Bug Group Bug Type ▾ File Function/Method Line Path Length
Unused codeDead incrementreferenceChains.cppcollectStaticFieldAnchorsForRotation36771
Logic errorDereference of null pointerfaultInjection.cppcrashNow242
Logic errorResult of operation is garbage or undefinedlivenessTracker.cppsecondsToOOM138324
C++ move semanticsUse-after-movereferenceChains.cppbuildCanaryChainEvent608368

@dd-octo-sts

dd-octo-sts Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

CI Test Results

Run: #35281070115 | Commit: 2209a89 | Duration: 16m 16s (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-09-17 22:35:58 UTC

@dd-octo-sts

dd-octo-sts Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

All 40 integration tests passed

📊 Dashboard · 👷 Pipeline · 📦 61cfd3d5

@jbachorik
jbachorik force-pushed the jb/rc-4-profiler-wiring branch from e8f5ee5 to 93f2dbf Compare September 17, 2026 19:08
@jbachorik
jbachorik added this pull request to stack #803 September 17, 2026 20:02
@jbachorik
jbachorik marked this pull request as ready for review September 17, 2026 20:03
@jbachorik
jbachorik requested a review from a team as a code owner September 17, 2026 20:03
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 17, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-17T20:08:04.481983Z 93f2dbf Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@jbachorik
jbachorik marked this pull request as draft September 17, 2026 20:04
@jbachorik
jbachorik force-pushed the jb/rc-4-profiler-wiring branch from 93f2dbf to 217a7ab Compare September 17, 2026 20:05

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 93f2dbf486

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ddprof-lib/src/main/cpp/profiler.cpp
Comment thread ddprof-lib/src/main/cpp/profiler.cpp
Comment thread ddprof-lib/src/main/cpp/profiler.cpp Outdated
Comment thread ddprof-lib/src/main/cpp/profiler.cpp
Comment thread ddprof-lib/src/main/cpp/profiler.cpp

@datadog-datadog-prod-us1-2 datadog-datadog-prod-us1-2 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.

Datadog Autotest: FAIL

Stopping a recording can omit all reference-chain events since the last dump. The lifecycle also keeps strong thread references and stale chain data across recording sessions.

Open Bits AI session

🤖 Datadog Autotest · Commit 93f2dbf · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest

Comment thread ddprof-lib/src/main/cpp/profiler.cpp
Comment thread ddprof-lib/src/main/cpp/profiler.cpp
Comment thread ddprof-lib/src/main/cpp/profiler.cpp
Comment thread ddprof-lib/src/main/cpp/profiler.cpp
Comment thread ddprof-lib/src/main/cpp/profiler.cpp Outdated
@jbachorik
jbachorik force-pushed the jb/rc-4-profiler-wiring branch from 217a7ab to b5588b7 Compare September 17, 2026 20:19
@jbachorik
jbachorik force-pushed the jb/rc-4-profiler-wiring branch from b5588b7 to b09e78d Compare September 17, 2026 20:20
@jbachorik
jbachorik force-pushed the jb/rc-4-profiler-wiring branch 2 times, most recently from e99dbc2 to 61cfd3d Compare September 17, 2026 21:33
Profiler starts/stops ReferenceChainTracker and LivenessTracker with the
recording, drains resolved chain events into JFR on dump(), and emits
abandoned-search events. ObjectSampler always informs LivenessTracker of
the recording's flags so they cannot go stale across recordings.
javaApi.cpp adds the reference-chain natives and test seams;
JavaProfiler.java declares them.
@jbachorik
jbachorik force-pushed the jb/rc-4-profiler-wiring branch from 61cfd3d to ac29386 Compare September 17, 2026 22:15
@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Sep 17, 2026

Copy link
Copy Markdown

Pipelines

Unblock PR with BitsAI

❌ Errors

Your PR has failed checks. Please review the issues below and take necessary action before merging.

🚦 1 Pipeline job failed

DataDog/java-profiler | gtest-tsan-amd64 — 🔧 Needs a code fix, caused by this PR

View more details · View in GitLab

Useful? React with 👍 / 👎

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

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