Skip to content

Commit 730f670

Browse files
committed
8268297: jdk/jfr/api/consumer/streaming/TestLatestEvent.java times out
Reviewed-by: mgronlun
1 parent 9d5ae2e commit 730f670

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

src/hotspot/share/jfr/recorder/repository/jfrChunk.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ static jlong nanos_now() {
4747
const jlong now = seconds * 1000000000 + nanos;
4848
if (now > last) {
4949
last = now;
50+
} else {
51+
++last;
5052
}
5153
return last;
5254
}

test/jdk/ProblemList.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,6 @@ jdk/jfr/event/compiler/TestCodeSweeper.java 8225209 generic-
824824
jdk/jfr/event/os/TestThreadContextSwitches.java 8247776 windows-all
825825
jdk/jfr/startupargs/TestStartName.java 8214685 windows-x64
826826
jdk/jfr/startupargs/TestStartDuration.java 8214685 windows-x64
827-
jdk/jfr/api/consumer/streaming/TestLatestEvent.java 8268297 windows-x64
828827
jdk/jfr/event/oldobject/TestLargeRootSet.java 8276333 macosx-x64,windows-x64
829828

830829
############################################################################

test/jdk/jdk/jfr/api/consumer/streaming/TestLatestEvent.java

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,12 @@
2323

2424
package jdk.jfr.api.consumer.streaming;
2525

26+
import java.nio.file.Files;
2627
import java.nio.file.Path;
2728
import java.nio.file.Paths;
29+
import java.util.Comparator;
30+
import java.util.List;
31+
import java.util.ArrayList;
2832
import java.util.concurrent.CountDownLatch;
2933
import java.util.concurrent.TimeUnit;
3034
import java.util.concurrent.atomic.AtomicBoolean;
@@ -34,6 +38,7 @@
3438
import jdk.jfr.Name;
3539
import jdk.jfr.Recording;
3640
import jdk.jfr.consumer.EventStream;
41+
import jdk.jfr.consumer.RecordingFile;
3742
import jdk.jfr.consumer.RecordingStream;
3843

3944
/**
@@ -65,7 +70,8 @@ public static void main(String... args) throws Exception {
6570
CountDownLatch beginChunks = new CountDownLatch(1);
6671

6772
try (RecordingStream r = new RecordingStream()) {
68-
r.onEvent("MakeChunks", event-> {
73+
r.setMaxSize(1_000_000_000);
74+
r.onEvent("MakeChunks", event -> {
6975
System.out.println(event);
7076
beginChunks.countDown();
7177
});
@@ -100,13 +106,25 @@ public static void main(String... args) throws Exception {
100106
// This latch ensures thatNotLatest has been
101107
// flushed and a new valid position has been written
102108
// to the chunk header
103-
notLatestEvent.await(80, TimeUnit.SECONDS);
109+
boolean timeout = notLatestEvent.await(80, TimeUnit.SECONDS);
104110
if (notLatestEvent.getCount() != 0) {
111+
System.out.println("timeout = " + timeout);
112+
Path repo = Path.of(System.getProperty("jdk.jfr.repository"));
113+
System.out.println("repo = " + repo);
114+
List<Path> files = new ArrayList<>(Files.list(repo).toList());
115+
files.sort(Comparator.comparing(Path::toString));
116+
for (Path f : files) {
117+
System.out.println("------------");
118+
System.out.println("File: " + f);
119+
for (var event : RecordingFile.readAllEvents(f)) {
120+
System.out.println(event);
121+
}
122+
}
105123
Recording rec = FlightRecorder.getFlightRecorder().takeSnapshot();
106124
Path p = Paths.get("error-not-latest.jfr").toAbsolutePath();
107125
rec.dump(p);
108126
System.out.println("Dumping repository as a file for inspection at " + p);
109-
throw new Exception("Timeout 80 s. Expected 6 event, but got " + notLatestEvent.getCount());
127+
throw new Exception("Timeout 80 s. Expected 6 event, but got " + (6 - notLatestEvent.getCount()));
110128
}
111129

112130
try (EventStream s = EventStream.openRepository()) {

0 commit comments

Comments
 (0)