Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.opentest4j.TestAbortedException;

import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.PipedReader;
import java.io.PipedWriter;
Expand Down Expand Up @@ -122,6 +123,14 @@ private static void assertMatchesParquetOracle(Path vortex, Path parquet) throws
assertFilesMatch(vortexReader, oracleReader);
} catch (Throwable t) {
mainError = t;
} finally {
// assertFilesMatch may stop reading early (oracle abort, line mismatch) while a
// producer is still writing — closing the read end here, rather than relying on
// the outer try-with-resources (which only runs after join() below), unblocks a
// producer parked on a full PipedWriter buffer with a "Pipe closed" IOException
// instead of hanging join() forever (#259).
closeQuietly(vortexReader);
closeQuietly(oracleReader);
}

try {
Expand Down Expand Up @@ -173,6 +182,18 @@ private static void assertMatchesParquetOracle(Path vortex, Path parquet) throws
}
}

/// Closes a stream ignoring the outcome, used only to unblock a producer thread
/// parked writing to the other end of a pipe before joining it.
///
/// @param closeable the stream to close
private static void closeQuietly(Closeable closeable) {
try {
closeable.close();
} catch (IOException ignored) {
// best effort: only used to unblock a producer thread before join()
}
}

/// Runs the full conformance check but reports the outcome as an aborted test
/// either way: only triaged matrix entries may count as green or red. The abort
/// message says which way to flip the entry.
Expand Down
Loading