[
https://issues.apache.org/jira/browse/HDDS-4471?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Wei-Chiu Chuang updated HDDS-4471:
----------------------------------
Description:
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.
was:
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.
> 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
> Priority: Minor
>
> 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: [email protected]
For additional commands, e-mail: [email protected]