From 94ec729faae7b45fcfe0a94dd42a90e4d08fd1ec Mon Sep 17 00:00:00 2001 From: Erik Gahlin Date: Wed, 12 Oct 2022 11:42:47 +0000 Subject: [PATCH] 8263044: jdk/jfr/jvm/TestDumpOnCrash.java timed out Reviewed-by: mgronlun --- .../jdk/jfr/internal/consumer/ChunkHeader.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ChunkHeader.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ChunkHeader.java index 98ddfcbc79a..1fbe07803c7 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ChunkHeader.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ChunkHeader.java @@ -164,8 +164,18 @@ public final class ChunkHeader { Logger.log(LogTag.JFR_SYSTEM_PARSER, LogLevel.INFO, "Chunk: finalChunk=" + finalChunk); absoluteChunkEnd = absoluteChunkStart + chunkSize; return; - } else if (finished) { - throw new IOException("No metadata event found in finished chunk."); + } else { + if (finished) { + throw new IOException("No metadata event found in finished chunk."); + } + if (chunkSize == HEADER_SIZE) { + // This ensures that a non-streaming parser is able + // to break out of the loop in case the file is + // ended before the first metadata event has + // been written. This can happen during a failed crash + // dump. + input.pollWait(); + } } } }