Skip to content

Commit

Permalink
8316193: jdk/jfr/event/oldobject/TestListenerLeak.java java.lang.Exce…
Browse files Browse the repository at this point in the history
…ption: Could not find leak

Backport-of: f6be922952642f40dcf0d27b7896c9a6acdd6378
  • Loading branch information
cost0much authored and Ben Taylor committed Aug 23, 2024
1 parent b8038ea commit 4f28612
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions test/jdk/jdk/jfr/event/oldobject/TestListenerLeak.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -71,15 +71,17 @@ public void onListen() {

public static void main(String[] args) throws Exception {
WhiteBox.setWriteAllObjectSamples(true);

try (Recording r = new Recording()) {
r.enable(EventNames.OldObjectSample).withStackTrace().with("cutoff", "infinity");
r.start();
listenerLeak();
r.stop();
List<RecordedEvent> events = Events.fromRecording(r);
if (OldObjects.countMatchingEvents(events, Stuff[].class, null, null, -1, "listenerLeak") == 0) {
throw new Exception("Could not find leak with " + Stuff[].class);
while (true) {
try (Recording r = new Recording()) {
r.enable(EventNames.OldObjectSample).withStackTrace().with("cutoff", "infinity");
r.start();
listenerLeak();
r.stop();
List<RecordedEvent> events = Events.fromRecording(r);
if (OldObjects.countMatchingEvents(events, Stuff[].class, null, null, -1, "listenerLeak") != 0) {
return; // Success
}
System.out.println("Could not find leak with " + Stuff[].class + ". Retrying.");
}
}
}
Expand Down

1 comment on commit 4f28612

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

Please sign in to comment.