Re: [PR] RATIS-2402. Fix CallId overflow when parsing gRPC metadata. [ratis]

2026-02-08 Thread via GitHub


slfan1989 commented on PR #1344:
URL: https://github.com/apache/ratis/pull/1344#issuecomment-3866447885

   > +1 the change looks good
   
   @szetszwo Thank you so much for reviewing the code!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] RATIS-2402. Fix CallId overflow when parsing gRPC metadata. [ratis]

2026-02-07 Thread via GitHub


szetszwo merged PR #1344:
URL: https://github.com/apache/ratis/pull/1344


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] RATIS-2402. Fix CallId overflow when parsing gRPC metadata. [ratis]

2026-02-07 Thread via GitHub


slfan1989 commented on code in PR #1344:
URL: https://github.com/apache/ratis/pull/1344#discussion_r2778549269


##
ratis-grpc/src/main/java/org/apache/ratis/grpc/GrpcUtil.java:
##
@@ -146,7 +146,7 @@ static long getCallId(Throwable t) {
   final Metadata trailers = ((StatusRuntimeException)t).getTrailers();
   if (trailers != null) {
 final String callId = trailers.get(CALL_ID);
-return callId != null ? Integer.parseInt(callId) : -1;
+return callId != null ? Long.parseLong(callId) : -1;

Review Comment:
   Thanks for your suggestion! I've updated it to use Long.parseUnsignedLong 
for correctly parsing the uint64 call-id.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] RATIS-2402. Fix CallId overflow when parsing gRPC metadata. [ratis]

2026-02-07 Thread via GitHub


slfan1989 commented on code in PR #1344:
URL: https://github.com/apache/ratis/pull/1344#discussion_r2778549269


##
ratis-grpc/src/main/java/org/apache/ratis/grpc/GrpcUtil.java:
##
@@ -146,7 +146,7 @@ static long getCallId(Throwable t) {
   final Metadata trailers = ((StatusRuntimeException)t).getTrailers();
   if (trailers != null) {
 final String callId = trailers.get(CALL_ID);
-return callId != null ? Integer.parseInt(callId) : -1;
+return callId != null ? Long.parseLong(callId) : -1;

Review Comment:
   Thanks for your suggestion! I've updated it to use `Long.parseUnsignedLong` 
for correctly parsing the uint64 call-id.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] RATIS-2402. Fix CallId overflow when parsing gRPC metadata. [ratis]

2026-02-07 Thread via GitHub


szetszwo commented on code in PR #1344:
URL: https://github.com/apache/ratis/pull/1344#discussion_r2778427690


##
ratis-grpc/src/main/java/org/apache/ratis/grpc/GrpcUtil.java:
##
@@ -146,7 +146,7 @@ static long getCallId(Throwable t) {
   final Metadata trailers = ((StatusRuntimeException)t).getTrailers();
   if (trailers != null) {
 final String callId = trailers.get(CALL_ID);
-return callId != null ? Integer.parseInt(callId) : -1;
+return callId != null ? Long.parseLong(callId) : -1;

Review Comment:
   @slfan1989 , thanks for catching the bug!  We need to use 
`Long.parseUnsignedLong` for uint64.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] RATIS-2402. Fix CallId overflow when parsing gRPC metadata. [ratis]

2026-02-07 Thread via GitHub


slfan1989 commented on PR #1344:
URL: https://github.com/apache/ratis/pull/1344#issuecomment-3865914458

   I took a look at the error log, and it seems unrelated to our recent changes.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



[PR] RATIS-2402. Fix CallId overflow when parsing gRPC metadata. [ratis]

2026-02-07 Thread via GitHub


slfan1989 opened a new pull request, #1344:
URL: https://github.com/apache/ratis/pull/1344

   ## What changes were proposed in this pull request?
   
   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
   ratis-proto/src/main/proto/Raft.proto:90 callId uint64
   ```
   ## What is the link to the Apache JIRA
   
   JIRA: RATIS-2402. Fix CallId overflow when parsing gRPC metadata.
   
   ## How was this patch tested?
   
   Add Junit Test.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]