You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Dustin (JIRA)" <ji...@apache.org> on 2017/11/27 01:56:00 UTC

[jira] [Created] (KAFKA-6271) FileInputStream.skip function can return 0 when the file is corrupted, causing an infinite loop

Dustin created KAFKA-6271:
-----------------------------

             Summary: FileInputStream.skip function can return 0 when the file is corrupted, causing an infinite loop
                 Key: KAFKA-6271
                 URL: https://issues.apache.org/jira/browse/KAFKA-6271
             Project: Kafka
          Issue Type: Bug
    Affects Versions: 0.10.0.0
            Reporter: Dustin


When file is corrupted, the FileInputStream can return 0, causing the while loop in FileStreamSourceTask.poll() become infinite.


{code:java}
   public List<SourceRecord> poll() throws InterruptedException {
       ...
       stream = new FileInputStream(filename);
       long skipLeft = (Long) lastRecordedOffset;
       while (skipLeft > 0) {
         try {
           long skipped = stream.skip(skipLeft);
           skipLeft -= skipped;
         } catch (IOException e) {
            log.error("Error while trying to seek to previous offset in file: ", e);
            throw new ConnectException(e);
         }
       }
    }
{code}
Similar bugs are like [Cassandra-7330|https://issues.apache.org/jira/browse/Cassandra-7330], [Hadoop-8614|https://issues.apache.org/jira/browse/Hadoop-8614], [Mapreduce-6990|https://issues.apache.org/jira/browse/MAPREDUCE-6990], [Yarn-163|https://issues.apache.org/jira/browse/yarn-163], [Yarn-2905|https://issues.apache.org/jira/browse/yarn-2905] etc.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)