Repository navigation
Conversation
A begin whose endTaskBlock was never reached left the TLS token set, so every later begin on the thread failed, and its TASK_BLOCK run kept suppressing wall-clock signals. A new begin now supersedes the pending interval: it clears the token and closes the run with the generation-checked exitBlockedRun(), counting TASK_BLOCK_RECOVERED_ABANDONED. Document the finally requirement and the supersede policy on beginTaskBlock.
isPlatformThread() returned true on non-HotSpot JVMs reporting JNI 19+ without probing, so virtual threads could enter task-block producer state. The hardcoded IsVirtualThread table offset is only trusted on HotSpot, so other VMs now report every thread as non-platform, which keeps task-block hooks disabled there. Skip the arming TaskBlock tests on those JVMs and add a test asserting begin returns 0 there.
computeMinTaskBlockTicks() yields 0 when TSC::frequency() is below 1 kHz, and a zero threshold let every block pass the 1 ms minimum. exceedsMinTaskBlockDuration() now rejects in that case, which the caller counts as TASK_BLOCK_SKIPPED_TOO_SHORT. Add test-only hooks to reset the cached threshold and replace the frequency source, and cover the lazy recompute path and the fail-closed path.
Add TaskBlockAssertions.assertContainsDuration() and bound the encoded duration in the paired-API and lightweight TaskBlock tests.
Add a test-only observer for the event recordUnownedBlockedTail() writes and a gtest that accumulates suppressed weight before the tail flush and checks the emitted weight matches it.
blockEnter0 returned 0 for traced threads without any counter, unlike beginTaskBlock0. Increment BLOCK_ENTER_SKIPPED_TRACE_CONTEXT on that path and test it.
Codex Review SummaryThis 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. |
There was a problem hiding this comment.
More details
Abandoned TaskBlock recovery retains generation checks, and invalid duration thresholds fail closed. The completed static review reported no actionable correctness regression; runtime behavior was not exercised.
🤖 Bits Code Review · Commit b626adf
CI Test ResultsRun: #45696093374 | Commit:
Status Overview
Legend: ✅ passed | ❌ failed | ⚪ skipped | 🚫 cancelled
|
| Test | Cells | Message |
|---|---|---|
MallocArenaWarningTest.statsEventsDescribeTheArenas__ |
glibc-8-orcl-debug-amd64 |
org.opentest4j.AssertionFailedError: expected: <489684992> but was: <477626368> |
These fail the build. Passing on a second run makes a test flaky, not passing. Fix it, or quarantine it against a ticket so the debt is tracked rather than forgotten.
Consider quarantining these — click for ready-made entries
A quarantined test still runs and still reports; its failures just stop
turning CI red. To quarantine one:
- Open a PROF ticket for the test, linking the failing job.
- Append the line below to
ddprof-test/quarantine.txt, replacing
PROF-XXXXXwith the ticket number. - Check the
cellsandreasoncolumns — the proposal only knows what
failed in this run, and a narrowercellsglob keeps the same test
gating everywhere it has not misbehaved.
CI fails once review_by passes, so an entry expires instead of piling up.
# test | ticket | added | review_by | cells | reason
com.datadoghq.profiler.nativemem.MallocArenaWarningTest.statsEventsDescribeTheArenas | PROF-XXXXX | 2026-11-25 | 2027-02-23 | glibc-8-orcl-debug-amd64 | org.opentest4j.AssertionFailedError: expected: <489684992> but was: <477626368> (seen in: glibc-8-orcl-debug-amd64)
Retried 1 of 32 cells.
Failed Jobs
- glibc-amd64/debug / 8-orcl — view logs
Summary: Total: 32 | Passed: 31 | Failed: 1
Updated: 2026-11-25 21:05:01 UTC
This comment has been minimized.
This comment has been minimized.
Emit the getLockIndex definition for cross-translation-unit callers and cover optimized linking with a recording-stripe lookup regression. Wait for the wall timer's initial sampling epoch in the debug-only synchronous dump driver. Bound the normal-thread wait and test ready, delayed-publication, and timeout behavior without changing zero-epoch production fallback or weakening the JFR assertions.
Reliability & Chaos Results✅ All reliability & chaos checks passed Pipeline: https://gitlab.ddbuild.io/DataDog/java-profiler/-/pipelines/153120055 |
# Conflicts: # ddprof-test/src/test/java/com/datadoghq/profiler/wallclock/UnownedWallTailContextTransitionTest.java
# Conflicts: # ddprof-lib/src/main/cpp/wallClock.h # ddprof-lib/src/test/cpp/wallClock_ut.cpp
# Conflicts: # ddprof-lib/src/main/cpp/wallClock.h # ddprof-test/src/test/java/com/datadoghq/profiler/JavaProfilerTestSupport.java
Memory overhead check: ✅ within budgetProfiler
✅ Not budgeted (too noisy on shared runners)
|
# Conflicts: # ddprof-test/src/test/java/com/datadoghq/profiler/wallclock/UnownedWallTailContextTransitionTest.java
What does this PR do?:
Hardens the paired TaskBlock API added in #664:
task_block_threshold_invalid, not intask_block_skipped_too_short.beginTaskBlock()recovers an interval whoseendTaskBlock()never ran. Recovery runs only after the begin admission checks, and it closes the tracker run only when the token matches the current slot and generation. It counts intask_block_recovered_abandoned.JVMSupport::isPlatformThread()returns false on non-HotSpot VMs that report JNI 19 or later, without reading the virtual-thread slot of the JNI function table.blockEnterskipped by an active trace context inblock_enter_skipped_trace_context.Motivation:
An uncalibrated clock (TSC frequency below 1 kHz) makes the threshold zero. A zero threshold would admit every positive interval and hide the clock problem as normal events.
A missed
endTaskBlock()must not leave the thread's paired token in place forever, because that also suppresses its later wall signals. Native code cannot tell an abandoned begin from a nested one, so the replacement rule must be explicit.IsVirtualThreadis read through a hard-coded JNI table offset (slot 234). This offset is verified only on HotSpot. Reading it on another VM could call the wrong function.Additional Notes:
endTaskBlock()with the discarded token returnsfalse. Begin keeps the pending interval when it returns0for these early reasons: recording inactive, caller not verified, not a platform thread, or active span. A later failure to arm the replacement can also return0after the discard, so0alone does not mean the old interval was kept. Callers must still callendTaskBlock()infinally; the Javadoc says so.beginTaskBlock()always returns0andendTaskBlock()returnsfalse. This restricts the paired API only, not other profiling. feat(taskblock): add JVM producers and retain failed recording output (PROF-14931) #665 extends the classifier contract to the JVM producers.human_review:mandatory). Reason: changes the publicbeginTaskBlock()contract (silent discard of a pending interval) and JVM-specific classification.How to test the change?:
Added coverage:
TaskBlockRecorderTest.UncalibratedTscFailsClosedandUninitializedThresholdIsRecomputedFromTscFrequency;AbandonedTaskBlockTest(abandoned run closed, nothing pending, non-decodable token, newer run and foreign slot not closed);TaskBlockRealRecorderTest(stripe release and single count on stack failure, contention, inactive recorder, thread-table overflow);PairedTaskBlockRestartTest;JvmSupportNonHotspotTest(JNI 19 and 21 rejected without reading the table);ProfilerLockIndexTest;WallClockInitialEpochTest;WallTailRecordingTest.TailCarriesWeightAccumulatedWhileBlocked.JavaProfilerTaskBlockApiTest(abandonedIntervalDoesNotDisableTaskBlockForThread,traceContextRejectionKeepsOpenInterval),JavaProfilerTaskBlockNonHotspotTest.platformThreadCannotArmTaskBlock(fail-closed classification, no event),UnfilteredWallPrecheckTest.tracedBlockEnterIsSkippedAndCounted,JavaProfilerTaskBlockLightweightTest.Run:
./.claude/commands/build-and-summarize :ddprof-lib:gtestDebug :ddprof-lib:gtestRelease./.claude/commands/build-and-summarize :ddprof-test:testDebug -Ptests='JavaProfilerTaskBlock*'JavaProfilerTaskBlockNonHotspotTestneeds a non-HotSpot JDK 19+ asJAVA_TEST_HOME; it runs only where platform-thread classification is not supported.For Datadog employees:
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!