You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "Wei-Chiu Chuang (Jira)" <ji...@apache.org> on 2020/12/01 02:18:00 UTC

[jira] [Resolved] (HDDS-4471) GrpcOutputStream length can overflow

     [ https://issues.apache.org/jira/browse/HDDS-4471?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Wei-Chiu Chuang resolved HDDS-4471.
-----------------------------------
    Fix Version/s: 1.1.0
       Resolution: Fixed

PR is resolved.

[~cku328] thanks for the review, please make sure to resolve the corresponding jira here. Thanks again.

> GrpcOutputStream length can overflow
> ------------------------------------
>
>                 Key: HDDS-4471
>                 URL: https://issues.apache.org/jira/browse/HDDS-4471
>             Project: Hadoop Distributed Data Store
>          Issue Type: Bug
>          Components: Ozone Datanode
>    Affects Versions: 1.0.0
>            Reporter: Wei-Chiu Chuang
>            Assignee: YI-CHEN WANG
>            Priority: Minor
>              Labels: pull-request-available
>             Fix For: 1.1.0
>
>
> DN says it sent negative bytes of container data to destination.
> {noformat}
> 2020-11-16 22:07:26,445 INFO org.apache.hadoop.ozone.container.replication.GrpcReplicationService: Streaming container data (982134) to other datanode
> 2020-11-16 22:16:37,693 INFO org.apache.hadoop.ozone.container.replication.GrpcOutputStream: Sent -2033242913 bytes for container 982134
> {noformat}
> Looks like there was an overflow. The writtenBytes shouldn't be an int, because the container is as big as 5GB, easily overflow a signed int.
> {code:title=GrpcOutputStream.java}
>   private int writtenBytes;
> ...
>       CopyContainerResponseProto response =
>           CopyContainerResponseProto.newBuilder()
>               .setContainerID(containerId)
>               .setData(data)
>               .setEof(eof)
>               .setReadOffset(writtenBytes)
>               .setLen(length)
>               .build();
>       responseObserver.onNext(response);
>       writtenBytes += length;
> {code}
> Looking at the source code, I think we can change it to long without breaking serialization compatibility because setReadOffset() expects a long.
> Looks like a minor issue to me. The other side doesn't use the read offset, so even though it can overflow, there's no real impact. Still, we should fix it.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org