[
https://issues.apache.org/jira/browse/HDFS-13514?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18047947#comment-18047947
]
ASF GitHub Bot commented on HDFS-13514:
---------------------------------------
github-actions[bot] closed pull request #376: HDFS-13514. Avoid edge case where
BUFFER_SIZE is 0
URL: https://github.com/apache/hadoop/pull/376
> BenchmarkThroughput.readLocalFile hangs with misconfigured BUFFER_SIZE
> ----------------------------------------------------------------------
>
> Key: HDFS-13514
> URL: https://issues.apache.org/jira/browse/HDFS-13514
> Project: Hadoop HDFS
> Issue Type: Bug
> Components: test
> Affects Versions: 2.5.0
> Reporter: John Doe
> Priority: Minor
> Labels: pull-request-available
> Time Spent: 10m
> Remaining Estimate: 0h
>
> When the BUFFER_SIZE is configured to be 0, the while loop in
> BenchmarkThroughput.readLocalFile function hangs endlessly.
> This is because when the data.size (i.e., BUFFER_SIZE) is 0, the val will
> always be 0 by invoking val=in.read(data).
> Here is the code snippet.
> {code:java}
> BUFFER_SIZE = conf.getInt("dfsthroughput.buffer.size", 4 * 1024);//when
> dfsthroughput.buffer.size is configued to be 0
> private void readLocalFile(Path path, String name, Configuration conf)
> throws IOException {
> System.out.print("Reading " + name);
> resetMeasurements();
> InputStream in = new FileInputStream(new File(path.toString()));
> byte[] data = new byte[BUFFER_SIZE];
> long size = 0;
> while (size >= 0) {
> size = in.read(data);
> }
> in.close();
> printMeasurements();
> }
> {code}
> The similar case is HDFS-13513
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]