DBZ-3095 Propagating socket exceptions

This commit is contained in:
Gunnar Morling 2021-02-19 08:19:53 +01:00 committed by Jiri Pechanec
parent a78843a683
commit e024fc60ab

View File

@ -241,6 +241,15 @@ public Event nextEvent(ByteArrayInputStream inputStream) throws IOException {
}
// DBZ-217 In case an event couldn't be read we create a pseudo-event for the sake of logging
catch (EventDataDeserializationException edde) {
// DBZ-3095 As of Java 15, when reaching EOF in the binlog stream, the polling loop in
// BinaryLogClient#listenForEventPackets() keeps returning values != -1 from peek();
// this causes the loop to never finish
// Propagating the exception (either EOF or socket closed) causes the loop to be aborted
// in this case
if (edde.getCause() instanceof IOException) {
throw edde;
}
EventHeaderV4 header = new EventHeaderV4();
header.setEventType(EventType.INCIDENT);
header.setTimestamp(edde.getEventHeader().getTimestamp());