[ 
https://issues.apache.org/jira/browse/MAPREDUCE-7089?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16730430#comment-16730430
 ] 

ASF GitHub Bot commented on MAPREDUCE-7089:
-------------------------------------------

GitHub user sharath-c-n opened a pull request:

    https://github.com/apache/hadoop/pull/454

    Fixing bug : https://issues.apache.org/jira/browse/MAPREDUCE-7089

    Bug: When a user configures the bufferSize to be 0, the while loop in 
TestDFSIO$ReadMapper.doIO function hangs endlessly.
    
    solution : check if the bufferSize is greater than 0, if not throw 
IllegalArgument Exception

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/sharath-c-n/hadoop trunk

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/hadoop/pull/454.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #454
    
----
commit dec6a2846241cfd054acbcb601deca997fd4d447
Author: schalyanagaraju <schalyanagaraju@...>
Date:   2018-12-28T18:47:51Z

    Fixing bug : https://issues.apache.org/jira/browse/MAPREDUCE-7089

----


> ReadMapper.doIO hangs with user misconfigured inputs
> ----------------------------------------------------
>
>                 Key: MAPREDUCE-7089
>                 URL: https://issues.apache.org/jira/browse/MAPREDUCE-7089
>             Project: Hadoop Map/Reduce
>          Issue Type: Bug
>          Components: client, test
>    Affects Versions: 2.5.0
>            Reporter: John Doe
>            Priority: Minor
>
> When a user configures the bufferSize to be 0, the while loop in 
> TestDFSIO$ReadMapper.doIO function hangs endlessly.
> This is because the loop stride, curSize is always 0, making the loop index 
> actualSize always less than the upper bound totalSize.
> Here is the code snippet.
> {code:java}
> int bufferSize = DEFAULT_BUFFER_SIZE;
> for(int i = 0; i < args.length; i++) { // parse command line
>   ...
>   else if (args[i].equals("-bufferSize")) {
>   bufferSize = Integer.parseInt(args[++i]);
>   }
>   ...
> }
> public Long doIO(Reporter reporter, String name, long totalSize) throws 
> IOException {
>   InputStream in = (InputStream)this.stream;
>   long actualSize = 0;
>   while (actualSize < totalSize) {
>     int curSize = in.read(buffer, 0, bufferSize);
>     if(curSize < 0) break;
>     actualSize += curSize;
>     reporter.setStatus("reading " + name + "@" + actualSize + "/" + totalSize 
> + " ::host = " + hostName);
>   }
>   return Long.valueOf(actualSize);
> }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to