keedio / flume-ftp-source

FTP network server is source of events for Apache-flume
80 stars 61 forks source link

java.io.BufferedReader readLine() hangs indefinitely. #16

Closed lazaromedina closed 9 years ago

lazaromedina commented 9 years ago

Despite the tcp connection is in state ESTABLISHED and Recv-Q is active, the inputStream may become indefinitely retrieved, because the end of line seems no to be reached. This bug could be related with official oracle-bug: http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4262765

lazaromedina commented 9 years ago

A minimal workaround, besides the indicated in the above link could be: ask the bufferedReader if it is "ready"(¿is there any character inside the stream?) before process something. if (bufferedReader.ready()){ while (line.readline() != null){ process(); }