Return-Path: X-Original-To: apmail-lucene-dev-archive@www.apache.org Delivered-To: apmail-lucene-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EB76E1003D for ; Thu, 8 Aug 2013 19:18:57 +0000 (UTC) Received: (qmail 75700 invoked by uid 500); 8 Aug 2013 19:18:56 -0000 Delivered-To: apmail-lucene-dev-archive@lucene.apache.org Received: (qmail 74669 invoked by uid 500); 8 Aug 2013 19:18:52 -0000 Mailing-List: contact dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list dev@lucene.apache.org Received: (qmail 74300 invoked by uid 99); 8 Aug 2013 19:18:50 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Aug 2013 19:18:50 +0000 Date: Thu, 8 Aug 2013 19:18:50 +0000 (UTC) From: "Grant Ingersoll (JIRA)" To: dev@lucene.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (LUCENE-5160) NIOFSDirectory, SimpleFSDirectory (others?) don't properly handle valid file and FileChannel read conditions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Grant Ingersoll created LUCENE-5160: --------------------------------------- Summary: NIOFSDirectory, SimpleFSDirectory (others?) don't properly handle valid file and FileChannel read conditions Key: LUCENE-5160 URL: https://issues.apache.org/jira/browse/LUCENE-5160 Project: Lucene - Core Issue Type: Bug Affects Versions: 4.4, 5.0 Reporter: Grant Ingersoll Around line 190 of NIOFSDirectory, the loop to read in bytes doesn't properly handle the -1 condition that can be returned from FileChannel.read(). If it returns -1, then it will move the file pointer back and you will enter an infinite loop. SimpleFSDirectory displays the same characteristics, although I have only seen the issue on NIOFSDirectory. The code in question from NIOFSDirectory: {code} try { while (readLength > 0) { final int limit; if (readLength > chunkSize) { // LUCENE-1566 - work around JVM Bug by breaking // very large reads into chunks limit = readOffset + chunkSize; } else { limit = readOffset + readLength; } bb.limit(limit); int i = channel.read(bb, pos); pos += i; readOffset += i; readLength -= i; } {code} -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional commands, e-mail: dev-help@lucene.apache.org