You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "John Doe (JIRA)" <ji...@apache.org> on 2018/05/03 03:54:00 UTC
[jira] [Created] (HIVE-19395) OutStream.write hangs with
misconfigured bufferSize
John Doe created HIVE-19395:
-------------------------------
Summary: OutStream.write hangs with misconfigured bufferSize
Key: HIVE-19395
URL: https://issues.apache.org/jira/browse/HIVE-19395
Project: Hive
Issue Type: Bug
Components: SQL
Affects Versions: 1.0.0
Reporter: John Doe
When the bufferSize is configured to be 0 in the class initialization, the while loop in OutStream.write function hangs endlessly.
This is because when the bufferSize is 0, current.remaining is 0, length will always > 0.
Here is the code snippet.
{code:java}
OutStream(String name, int bufferSize, CompressionCodec codec, OutputReceiver receiver) throws IOException {
...
this.bufferSize = bufferSize; //bufferSize can be configured with 0
...
}
private void getNewInputBuffer() throws IOException {
...
current = ByteBuffer.allocate(bufferSize);
...
}
public void write(byte[] bytes, int offset, int length) throws IOException {
if (current == null) {
getNewInputBuffer();
}
int remaining = Math.min(current.remaining(), length);
current.put(bytes, offset, remaining);
uncompressedBytes += remaining;
length -= remaining;
while (length != 0) {//length > 0
spill();
offset += remaining;
remaining = Math.min(current.remaining(), length);//current.remaining() == 0
current.put(bytes, offset, remaining);
uncompressedBytes += remaining;
length -= remaining;
}
}
{code}
The similar case is [HDFS-13513|https://issues.apache.org/jira/browse/HDFS-13513], [HDFS-13514|https://issues.apache.org/jira/browse/HDFS-13514]
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)