atharvaHJoshi opened a new pull request, #23779:
URL: https://github.com/apache/kafka/pull/23779

   ### Problem
   Time#waitForFuture compares absolute nanoTime values directly (`deadlineNs 
<= nowNs` and `deadlineNs - nowNs`). As noted in the JDK docs for 
System.nanoTime(), comparing absolute nanoTimes is unsafe due to potential 
overflow (wrap-around).
   
   ### Solution
   Compare elapsed time instead: compute `startTimeNs = nanoseconds()` and use 
`elapsedNs = nowNs - startTimeNs` vs `timeoutNs = deadlineNs - startTimeNs`. 
This correctly handles nanoTime overflow.
   
   ### Testing
   - Compiled clients module successfully.
   - This is a minimal, safe fix following JDK recommendation. Additional unit 
tests could be added, but the existing behavior is preserved.
   
   Generated-by: opencode (big-pickle)


-- 
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]

Reply via email to