From 4aef25b91fc2359044e8cd113e472ff95ecbce97 Mon Sep 17 00:00:00 2001 From: bgrozev Date: Fri, 13 Jul 2018 14:42:04 -0500 Subject: [PATCH] fix: Makes sure the ReadThread continues running after an exception. (#144) --- .../java/org/ice4j/ice/harvest/AbstractTcpListener.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/ice4j/ice/harvest/AbstractTcpListener.java b/src/main/java/org/ice4j/ice/harvest/AbstractTcpListener.java index 0ef69ce..861199b 100644 --- a/src/main/java/org/ice4j/ice/harvest/AbstractTcpListener.java +++ b/src/main/java/org/ice4j/ice/harvest/AbstractTcpListener.java @@ -1027,8 +1027,13 @@ public abstract class AbstractTcpListener } } } - catch (IOException | IllegalStateException e) + catch (Exception e) { + // The ReadThread should continue running no matter what + // exceptions occur in the code above (we've observed exceptions + // due to failures to allocate resources) because otherwise + // the #newChannels list is never pruned leading to a leak of + // sockets. logger.info( "Failed to handle TCP socket " + channel.channel.socket() + ": " + e.getMessage());