Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8268297: jdk/jfr/api/consumer/streaming/TestLatestEvent.java times out
Reviewed-by: mgronlun
  • Loading branch information
egahlin committed Dec 23, 2021
1 parent 9d5ae2e commit 730f67081dcda37df7fc40eda99ebd39028be15f
Showing 3 changed files with 23 additions and 4 deletions.
@@ -47,6 +47,8 @@ static jlong nanos_now() {
const jlong now = seconds * 1000000000 + nanos;
if (now > last) {
last = now;
} else {
++last;
}
return last;
}
@@ -824,7 +824,6 @@ jdk/jfr/event/compiler/TestCodeSweeper.java 8225209 generic-
jdk/jfr/event/os/TestThreadContextSwitches.java 8247776 windows-all
jdk/jfr/startupargs/TestStartName.java 8214685 windows-x64
jdk/jfr/startupargs/TestStartDuration.java 8214685 windows-x64
jdk/jfr/api/consumer/streaming/TestLatestEvent.java 8268297 windows-x64
jdk/jfr/event/oldobject/TestLargeRootSet.java 8276333 macosx-x64,windows-x64

############################################################################
@@ -23,8 +23,12 @@

package jdk.jfr.api.consumer.streaming;

import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Comparator;
import java.util.List;
import java.util.ArrayList;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -34,6 +38,7 @@
import jdk.jfr.Name;
import jdk.jfr.Recording;
import jdk.jfr.consumer.EventStream;
import jdk.jfr.consumer.RecordingFile;
import jdk.jfr.consumer.RecordingStream;

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

try (RecordingStream r = new RecordingStream()) {
r.onEvent("MakeChunks", event-> {
r.setMaxSize(1_000_000_000);
r.onEvent("MakeChunks", event -> {
System.out.println(event);
beginChunks.countDown();
});
@@ -100,13 +106,25 @@ public static void main(String... args) throws Exception {
// This latch ensures thatNotLatest has been
// flushed and a new valid position has been written
// to the chunk header
notLatestEvent.await(80, TimeUnit.SECONDS);
boolean timeout = notLatestEvent.await(80, TimeUnit.SECONDS);
if (notLatestEvent.getCount() != 0) {
System.out.println("timeout = " + timeout);
Path repo = Path.of(System.getProperty("jdk.jfr.repository"));
System.out.println("repo = " + repo);
List<Path> files = new ArrayList<>(Files.list(repo).toList());
files.sort(Comparator.comparing(Path::toString));
for (Path f : files) {
System.out.println("------------");
System.out.println("File: " + f);
for (var event : RecordingFile.readAllEvents(f)) {
System.out.println(event);
}
}
Recording rec = FlightRecorder.getFlightRecorder().takeSnapshot();
Path p = Paths.get("error-not-latest.jfr").toAbsolutePath();
rec.dump(p);
System.out.println("Dumping repository as a file for inspection at " + p);
throw new Exception("Timeout 80 s. Expected 6 event, but got " + notLatestEvent.getCount());
throw new Exception("Timeout 80 s. Expected 6 event, but got " + (6 - notLatestEvent.getCount()));
}

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

1 comment on commit 730f670

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 730f670 Dec 23, 2021

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.