Tina Shan created HADOOP-17575:
----------------------------------

             Summary: Misconfigure buffer size to 0 causing TestDFSIO to hang 
in infinite loops
                 Key: HADOOP-17575
                 URL: https://issues.apache.org/jira/browse/HADOOP-17575
             Project: Hadoop Common
          Issue Type: Bug
    Affects Versions: 3.3.0
            Reporter: Tina Shan


TestDFSIO lacks sanity checks on input buffer size for function doIO()

If misconfigured to 0, doIO() hangs in infinite loops. 

 
{code:java}
public Long doIO(... ) throws IOException {
    …..
 while (actualSize < totalSize) {
       int curSize = in.read(buffer, 0, bufferSize);
       if(curSize < 0) break;
       actualSize += curSize;
     ….
     }
   …
}

{code}
{code:java}
public Long doIO(... ) throws IOException {
    …..
        for (...; nrRemaining > 0; nrRemaining -= bufferSize) {
           If  (bufferSize < nrRemaining){ curSize = bufferSize }else{
                curSize = (int)nrRemaining
           out.write(buffer, 0, curSize);
        }
   …
}

{code}
Similar parameter _Io.file.buffer.size_ is handled by Java IO library 
BufferedInputStream. We suggest adding sanity checks for the benchmark's buffer 
size as well. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-dev-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-dev-h...@hadoop.apache.org

Reply via email to