Skip to content

Commit

Permalink
8298043: jdk/jfr/api/consumer/recordingstream/TestStop.java failed wi…
Browse files Browse the repository at this point in the history
…th "Expected outer stream to have 3 events"

Reviewed-by: mgronlun
  • Loading branch information
egahlin committed Dec 5, 2022
1 parent 7d20a60 commit 9827b75
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,18 +166,21 @@ protected void processRecursionSafe() throws IOException {
processUnordered(disp);
}
currentParser.resetCache();
barrier.check(); // block if recording is being stopped
long endNanos = currentParser.getStartNanos() + currentParser.getChunkDuration();
// same conversion as in RecordingInfo
long endMillis = Instant.ofEpochSecond(0, endNanos).toEpochMilli();
if (barrier.getStreamEnd() <= endMillis) {
return;
}
if (endNanos > filterEnd) {
return;
}
}
if (isLastChunk()) {
long endNanos = currentParser.getStartNanos() + currentParser.getChunkDuration();
long endMillis = Instant.ofEpochSecond(0, endNanos).toEpochMilli();

barrier.check(); // block if recording is being stopped
if (barrier.getStreamEnd() <= endMillis) {
return;
}

if (!barrier.hasStreamEnd() && isLastChunk()) {
// Recording was stopped/closed externally, and no more data to process.
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ public synchronized long getStreamEnd() {
return end;
}

public synchronized boolean hasStreamEnd() {
return end != Long.MAX_VALUE;
}

public synchronized void activate() {
activated = true;
}
Expand Down
1 change: 0 additions & 1 deletion test/jdk/ProblemList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,6 @@ jdk/jfr/startupargs/TestStartDuration.java 8214685 windows-
jdk/jfr/jvm/TestWaste.java 8282427 generic-all
jdk/jfr/api/consumer/recordingstream/TestOnEvent.java 8255404 linux-x64
jdk/jfr/api/consumer/TestRecordingFileWrite.java 8287699 generic-all
jdk/jfr/api/consumer/recordingstream/TestStop.java 8298043 generic-all

############################################################################

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ private static void testNestedStop() throws Exception {
if (dumpOuter.size() != 3) {
throw new AssertionError("Expected outer dump to have 3 events");
}
if (outerCount.get() == 3) {
if (outerCount.get() != 3) {
throw new AssertionError("Expected outer stream to have 3 events");
}
if (dumpInner.size() != 1) {
Expand Down
2 changes: 1 addition & 1 deletion test/jdk/jdk/jfr/jmx/streaming/TestStop.java
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ private static void testNestedStop() throws Exception {
if (dumpOuter.size() != 3) {
throw new AssertionError("Expected outer dump to have 3 events");
}
if (outerCount.get() == 3) {
if (outerCount.get() != 3) {
throw new AssertionError("Expected outer stream to have 3 events");
}
if (dumpInner.size() != 1) {
Expand Down

1 comment on commit 9827b75

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