Wei-Chiu Chuang created HDDS-4993:
-------------------------------------

             Summary: Add guardrail for reserved buffer size when DN reads a 
chunk
                 Key: HDDS-4993
                 URL: https://issues.apache.org/jira/browse/HDDS-4993
             Project: Apache Ozone
          Issue Type: Improvement
    Affects Versions: 1.0.0
            Reporter: Wei-Chiu Chuang


https://github.com/apache/ozone/blob/db3c50d9fc4b1048cd83074343cc00444f0b24f7/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/impl/FilePerBlockStrategy.java#L148

{code}
    long len = info.getLen();
    long offset = info.getOffset();
    ByteBuffer data = ByteBuffer.allocate((int) len);
{code}

DN reserves a byte buffer for client's chunk read request based on whatever 
client specifies, without check. This is bad. Client can send a message forcing 
DN to allocate up to 2GB memory per request. (Fortunately the grpc handler 
captures the OOM exception so DN doesn't crash)

Propose: add a guardrail check. XceiverServerGrpc set max inbound message size 
as 32MB (OZONE_SCM_CHUNK_MAX_SIZE). We should make sure the requested length is 
less than this too.



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

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

Reply via email to