Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-6271

FileInputStream.skip function can return 0 when the file is corrupted, causing an infinite loop

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 0.10.0.0
    • None
    • connect
    • None

    Description

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

         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);
               }
             }
          }
      

      Similar bugs are like Cassandra-7330, Hadoop-8614, Mapreduce-6990, Yarn-163, Yarn-2905 etc.

      Attachments

        Activity

          People

            Unassigned Unassigned
            dustinday John Doe
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: