Skip to content

Commit d130f69

Browse files
rkennkeclaude
andauthored
fix(test): reduce ASAN wall-clock rate in BoundMethodHandleProfilerTest to avoid OOM (#630)
BoundMethodHandleProfilerTest sampled at wall=100us (~10k samples/s). Under ASAN the bound-method-handle workload runs for minutes, and because wall-clock sampling is time-based, a slow aarch64 CI runner accumulates a huge number of MethodSample events. verifyEvents() then loads the entire recording into a JMC object model inside the 512MB ASAN test heap (-Xmx512m), causing an OOM (or the multi-minute runtime trips the CI job timeout). Coarsen the sampling to wall=1ms under ASAN (10x fewer samples, independent of runner speed) and drop the aarch64+asan workload from 1000 to 500 handles for margin. Verified on aarch64: MethodSample count drops from 57,735 to 275 while the test still passes. Environment: Datadog workspace Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent a8551a2 commit d130f69

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

ddprof-test/src/test/java/com/datadoghq/profiler/metadata/BoundMethodHandleProfilerTest.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@
1515
public class BoundMethodHandleProfilerTest extends AbstractProfilerTest {
1616
@Override
1717
protected String getProfilerCommand() {
18-
return Platform.isJ9() ? "wall=100ms" : "wall=100us";
18+
if (Platform.isJ9()) {
19+
return "wall=100ms";
20+
}
21+
// wall=100us is ~10k samples/s. Under ASAN the workload runs for minutes,
22+
// producing a JFR too large for JMC to load into the 512MB test heap. Sampling
23+
// 10x coarser cuts both the recording size and the SIGVTALRM overhead.
24+
return isAsan() ? "wall=1ms" : "wall=100us";
1925
}
2026

2127
@Test
@@ -26,8 +32,10 @@ public void test() throws Throwable {
2632
assumeFalse(Platform.isAarch64() && Platform.isMusl() && !Platform.isJavaVersionAtLeast(11)); // aarch64 + musl + jdk 8 will crash very often
2733
registerCurrentThreadForWallClockProfiling();
2834
// Reduce workload on aarch64+asan: ASAN slows each invocation enough that the test
29-
// takes 3+ minutes, generating a 56MB JFR that OOMs the 512MB test-runner heap.
30-
int numBoundMethodHandles = isAsan() && Platform.isAarch64() ? 1_000 : 10_000;
35+
// takes 3+ minutes, generating a JFR that OOMs the 512MB test-runner heap. Combined
36+
// with the coarser wall rate in getProfilerCommand(), 500 keeps the recording small
37+
// while still generating enough bound-method-handle classes to sample.
38+
int numBoundMethodHandles = isAsan() && Platform.isAarch64() ? 500 : 10_000;
3139
int x = generateBoundMethodHandles(numBoundMethodHandles);
3240
assertTrue(x != 0);
3341
stopProfiler();

0 commit comments

Comments
 (0)