Skip to content

Commit 6f9b6c9

Browse files
rkennkeclaude
andauthored
fix(test): forkEvery for asan Test task to bound cumulative heap growth (#632)
The ASAN test JVM is pinned to -Xmx512m to keep the heap below ASan's shadow-memory region (ASLR constraint). Without forkEvery, Gradle reuses a single JVM for the entire ddprof-test:testAsan suite, and per-test allocations (JFR recordings, JMC object models) accumulate across ~100+ test classes until the shared heap OOMs late in the run, even though every individual test passes. Restart the JVM every 25 classes to bound cumulative growth. Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
1 parent d130f69 commit 6f9b6c9

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

build-logic/conventions/src/main/kotlin/com/datadoghq/profiler/ProfilerTestPlugin.kt

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -313,12 +313,21 @@ class ProfilerTestPlugin : Plugin<Project> {
313313

314314
// Sanitizer conditions
315315
when (testConfig.configName) {
316-
"asan" -> testTask.onlyIf {
317-
PlatformUtils.locateLibasan() != null &&
318-
// Skip J9+ASAN: OpenJ9 has known GC stack-scanning and defineClass
319-
// race bugs exposed by ASAN timing
320-
// https://github.com/eclipse-openj9/openj9/issues/23514
321-
!PlatformUtils.isTestJvmJ9()
316+
"asan" -> {
317+
testTask.onlyIf {
318+
PlatformUtils.locateLibasan() != null &&
319+
// Skip J9+ASAN: OpenJ9 has known GC stack-scanning and defineClass
320+
// race bugs exposed by ASAN timing
321+
// https://github.com/eclipse-openj9/openj9/issues/23514
322+
!PlatformUtils.isTestJvmJ9()
323+
}
324+
// The ASAN test JVM is pinned to -Xmx512m (see ConfigurationPresets.kt)
325+
// to keep the heap below ASan's shadow-memory region. Without forking,
326+
// Gradle reuses one JVM for the whole suite, and per-test allocations
327+
// (JFR recordings, JMC object models) accumulate until it OOMs late in
328+
// the run even though every individual test passes. Restart periodically
329+
// to bound cumulative heap growth.
330+
testTask.setForkEvery(25)
322331
}
323332
// TSan + JVM integration tests are incompatible: the profiler's signal
324333
// handlers (SIGPROF at 1ms) are TSan-instrumented; when a signal fires

0 commit comments

Comments
 (0)