8268297: jdk/jfr/api/consumer/streaming/TestLatestEvent.java times out

Reviewed-by: mgronlun
This commit is contained in:
Erik Gahlin 2021-12-23 15:03:06 +00:00
parent 9d5ae2e380
commit 730f67081d
3 changed files with 23 additions and 4 deletions

View File

@ -47,6 +47,8 @@ static jlong nanos_now() {
const jlong now = seconds * 1000000000 + nanos;
if (now > last) {
last = now;
} else {
++last;
}
return last;
}

View File

@ -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
############################################################################

View File

@ -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.FlightRecorder;
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 class TestLatestEvent {
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 class TestLatestEvent {
// 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()) {