Repository: flume
Updated Branches:
  refs/heads/flume-1.7 49a370a62 -> ad9d4555a


FLUME-2908: NetcatSource - SocketChannel not closed when session is broken

(Grant Henke via Jarek Jarcec Cecho)


Project: http://git-wip-us.apache.org/repos/asf/flume/repo
Commit: http://git-wip-us.apache.org/repos/asf/flume/commit/ad9d4555
Tree: http://git-wip-us.apache.org/repos/asf/flume/tree/ad9d4555
Diff: http://git-wip-us.apache.org/repos/asf/flume/diff/ad9d4555

Branch: refs/heads/flume-1.7
Commit: ad9d4555aaf50e4498390defdce67a92cbf9c31f
Parents: 49a370a
Author: Jarek Jarcec Cecho <[email protected]>
Authored: Thu May 5 09:20:41 2016 -0700
Committer: Jarek Jarcec Cecho <[email protected]>
Committed: Thu May 5 09:21:24 2016 -0700

----------------------------------------------------------------------
 .../src/main/java/org/apache/flume/source/NetcatSource.java     | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flume/blob/ad9d4555/flume-ng-core/src/main/java/org/apache/flume/source/NetcatSource.java
----------------------------------------------------------------------
diff --git 
a/flume-ng-core/src/main/java/org/apache/flume/source/NetcatSource.java 
b/flume-ng-core/src/main/java/org/apache/flume/source/NetcatSource.java
index 61e3f90..9513902 100644
--- a/flume-ng-core/src/main/java/org/apache/flume/source/NetcatSource.java
+++ b/flume-ng-core/src/main/java/org/apache/flume/source/NetcatSource.java
@@ -357,6 +357,11 @@ public class NetcatSource extends AbstractSource 
implements Configurable,
         counterGroup.incrementAndGet("sessions.completed");
       } catch (IOException e) {
         counterGroup.incrementAndGet("sessions.broken");
+        try {
+          socketChannel.close();
+        } catch (IOException ex) {
+          logger.error("Unable to close socket channel. Exception follows.", 
ex);
+        }
       }
 
       logger.debug("Connection handler exiting");

Reply via email to