Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

add TaskBlock events for blocking intervals#570

Open
kaahos wants to merge 63 commits into
mainDataDog/java-profiler:mainfrom
paul.fournillon/wallclock-taskblockDataDog/java-profiler:paul.fournillon/wallclock-taskblockCopy head branch name to clipboard
Open

add TaskBlock events for blocking intervals#570
kaahos wants to merge 63 commits into
mainDataDog/java-profiler:mainfrom
paul.fournillon/wallclock-taskblockDataDog/java-profiler:paul.fournillon/wallclock-taskblockCopy head branch name to clipboard

Conversation

@kaahos

@kaahos kaahos commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?:

Adds datadog.TaskBlock JFR events for blocking intervals such as LockSupport.park, Object.wait, monitor contention, including recording APIs used by dd-trace-java for instrumented blocking operations such as Thread.sleep.

Motivation:

This builds on paul.fournillon/wallclock-suppression (#560) by preserving visibility into blocked spans as explicit duration events.

Additional Notes:

This PR does not add the dd-trace-java instrumentation itself; Thread.sleep emission depends on that side calling the new profiler APIs. Monitor callback support is HotSpot-specific, and virtual-thread carrier attribution is avoided.

How to test the change?:

  • ./.claude/commands/build-and-summarize :ddprof-test:testDebug -Ptests="*.wallclock.*TaskBlockTest"
  • ./.claude/commands/build-and-summarize :ddprof-lib:gtestDebug

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 review from @DataDog/security-design-and-guidance.
  • This PR doesn't touch any of that.
  • JIRA: [JIRA-14354]

Unsure? Have a question? Request a review!

@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Jun 1, 2026

Copy link
Copy Markdown

Pipelines

Fix all issues with BitsAI

⚠️ Warnings

🚦 19 Pipeline jobs failed

CI Run | test-matrix / test-linux-musl-aarch64 (11-librca, debug)   View in Datadog   GitHub Actions

CI Run | test-matrix / test-linux-musl-aarch64 (17-librca, debug)   View in Datadog   GitHub Actions

CI Run | test-matrix / test-linux-musl-aarch64 (21-librca, debug)   View in Datadog   GitHub Actions

View all 19 failed jobs.

Useful? React with 👍 / 👎

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

@dd-octo-sts

dd-octo-sts Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

CI Test Results

Run: #28245769391 | Commit: 197cb8f | Duration: 14m 25s (longest job)

5 of 32 test jobs failed

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

Failed Tests

musl-aarch64/debug / 25-librca

Job: View logs

No detailed failure information available. Check the job logs.

musl-aarch64/debug / 8-librca

Job: View logs

No detailed failure information available. Check the job logs.

musl-aarch64/debug / 21-librca

Job: View logs

No detailed failure information available. Check the job logs.

musl-aarch64/debug / 17-librca

Job: View logs

No detailed failure information available. Check the job logs.

musl-aarch64/debug / 11-librca

Job: View logs

No detailed failure information available. Check the job logs.

Summary: Total: 32 | Passed: 27 | Failed: 5


Updated: 2026-06-26 15:08:21 UTC

@kaahos kaahos force-pushed the paul.fournillon/wallclock-taskblock branch from bcf3c2b to a46d368 Compare June 2, 2026 08:24
@kaahos kaahos force-pushed the paul.fournillon/wallclock-taskblock branch 3 times, most recently from 3f2f71a to d1e3210 Compare June 3, 2026 13:00
@kaahos

kaahos commented Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

@copilot review this PR

Copilot AI commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

@copilot review this PR

Reviewed and found a flaky assertion in NativeSocketTaskBlockTest: it required zero TaskBlock events globally, which can fail when an untraced socket op emits one. Fixed in d21e493 by asserting that no TaskBlock is emitted for the traced span specifically, and re-ran :ddprof-test:testDebug -Ptests="*.wallclock.*TaskBlockTest" successfully.

Copilot finished work on behalf of kaahos June 3, 2026 13:27
@kaahos kaahos marked this pull request as ready for review June 3, 2026 13:40
@kaahos kaahos requested a review from a team as a code owner June 3, 2026 13:40

@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: d21e4936d2

ℹ️ 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/wallClock.cpp Outdated
@kaahos kaahos force-pushed the paul.fournillon/wallclock-taskblock branch 2 times, most recently from 2101007 to a94677a Compare June 3, 2026 14:05
@kaahos kaahos force-pushed the paul.fournillon/wallclock-taskblock branch from a94677a to 681582c Compare June 3, 2026 14:38
@kaahos kaahos force-pushed the paul.fournillon/wallclock-taskblock branch from e760331 to a7f38f6 Compare June 24, 2026 13:06
@kaahos kaahos force-pushed the paul.fournillon/wallclock-taskblock branch 3 times, most recently from 68fa059 to fdbbbe8 Compare June 26, 2026 12:26
@kaahos kaahos force-pushed the paul.fournillon/wallclock-taskblock branch from fdbbbe8 to c862039 Compare June 26, 2026 12:59
@kaahos kaahos force-pushed the paul.fournillon/wallclock-taskblock branch from 3891f63 to bb6c93b Compare June 26, 2026 13:44

@rkennke rkennke left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That is a good improvement, and I only found relatively minor issues (so far) - see below.

}
u64 t1 = TSC::ticks();
if (NativeSocketSampler::active()) {
return NativeSocketSampler::recordHookResult(fd, ret, t0, t1, op);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I believe you need an ErrnoGuard around the recordHookResult() call, otherwise, otherwise we'd lose errno.

block.endTicks,
BLOCKER_WITHOUT_STACK,
UNBLOCKING_SPAN_ID,
ROOT_SPAN_ID,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The order of spanId and rootSpanId is swapped. This is invisible because both constants are 0. Therefore you should probably also test spanId != rootSpanId.

block.endTicks,
BLOCKER_WITH_STACK,
UNBLOCKING_SPAN_ID,
ROOT_SPAN_ID,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same as above.

static const uint8_t FD_TYPE_NON_SOCKET = 4;

std::atomic<uint32_t> _fd_cache_gen{1};
std::atomic<uint32_t> _fd_type_cache[FD_TYPE_CACHE_SIZE];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This whole fd-type-cache looks to be the same as the one in NativeSocketSampler, could/should they be shared instead? I.e. a single cache in one place, and also used by the other? Maybe even extracted into a class of its own?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.