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

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

     [ https://issues.apache.org/jira/browse/KAFKA-6271?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jason Gustafson updated KAFKA-6271:
-----------------------------------
    Component/s: KafkaConnect

> 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
>          Components: KafkaConnect
>    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)