Skip to content

Commit 787f29e

Browse files
committed
Reset frontier search state before directly tagging a root in ReferenceChainTestSeamsTest
An earlier test can leave the shared FrontierTable full/tiny (shouldReportAbandonedSearchOnTinyFrontierCap deliberately caps it at 1); without resetting first, tagAsReferenceChainRoot0()'s insert() fails deterministically.
1 parent a48899b commit 787f29e

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

ddprof-test/src/test/java/com/datadoghq/profiler/referencechains/ReferenceChainTestSeamsTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,13 @@ public void shouldReconstructChainForDirectlyTaggedRoot() {
105105
assumeDebugBuild();
106106
JavaProfiler.resetKlassPopulationForTest0();
107107
JavaProfiler.setGcGenerationsEnabled0(true);
108+
// Guards against inheriting a FrontierTable an earlier test in this same, no-forkEvery
109+
// JVM left permanently full/tiny - e.g. ReferenceChainTrackingTest's own
110+
// shouldReportAbandonedSearchOnTinyFrontierCap deliberately drives the shared table to
111+
// framecap=1 and leaves it that way. Same defensive pattern that class's own tests already
112+
// use (see its header comment); without it, tagAsReferenceChainRoot0()'s insert() below can
113+
// fail against a table this test never sized itself.
114+
JavaProfiler.resetReferenceChainSearchForTest0();
108115

109116
Object target = new Object();
110117

0 commit comments

Comments
 (0)