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

Shilun Fan updated RATIS-2402:
------------------------------
    Description: 
1.Problem
The `GrpcUtil.getCallId()` method uses `Integer.parseInt()` to parse CallId 
from gRPC metadata, which causes overflow when CallId exceeds Integer.MAX_VALUE 
(2,147,483,647). This can result in incorrect CallId values or 
NumberFormatException in high-throughput scenarios where CallId may grow beyond 
32-bit integer range.
 
ratis-proto/src/main/proto/Raft.proto:117 RaftRpcRequestProto.callId uint64
atis-proto/src/main/proto/Raft.proto:90 callId uint64

 

2.Solution
Changed to use `Long.parseLong()` instead of `Integer.parseInt()` to support 
CallId values beyond the 32-bit integer limit.

  was:
### Problem
The `GrpcUtil.getCallId()` method uses `Integer.parseInt()` to parse CallId 
from gRPC metadata, which causes overflow when CallId exceeds Integer.MAX_VALUE 
(2,147,483,647). This can result in incorrect CallId values or 
NumberFormatException in high-throughput scenarios where CallId may grow beyond 
32-bit integer range.
 
ratis-proto/src/main/proto/Raft.proto:117 RaftRpcRequestProto.callId uint64
atis-proto/src/main/proto/Raft.proto:90 callId uint64

### Solution
Changed to use `Long.parseLong()` instead of `Integer.parseInt()` to support 
CallId values beyond the 32-bit integer limit.


> Fix CallId overflow when parsing gRPC metadata
> ----------------------------------------------
>
>                 Key: RATIS-2402
>                 URL: https://issues.apache.org/jira/browse/RATIS-2402
>             Project: Ratis
>          Issue Type: Bug
>            Reporter: Shilun Fan
>            Assignee: Shilun Fan
>            Priority: Major
>
> 1.Problem
> The `GrpcUtil.getCallId()` method uses `Integer.parseInt()` to parse CallId 
> from gRPC metadata, which causes overflow when CallId exceeds 
> Integer.MAX_VALUE (2,147,483,647). This can result in incorrect CallId values 
> or NumberFormatException in high-throughput scenarios where CallId may grow 
> beyond 32-bit integer range.
>  
> ratis-proto/src/main/proto/Raft.proto:117 RaftRpcRequestProto.callId uint64
> atis-proto/src/main/proto/Raft.proto:90 callId uint64
>  
> 2.Solution
> Changed to use `Long.parseLong()` instead of `Integer.parseInt()` to support 
> CallId values beyond the 32-bit integer limit.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to