adityamukho commented on code in PR #7488:
URL: https://github.com/apache/ignite-3/pull/7488#discussion_r2803286079


##########
modules/network/src/main/java/org/apache/ignite/internal/network/DefaultMessagingService.java:
##########
@@ -651,7 +700,13 @@ private void onInvokeResponse(NetworkMessage response, 
Long correlationId) {
         TimeoutObjectImpl responseFuture = requestsMap.remove(correlationId);
 
         if (responseFuture != null) {
-            responseFuture.future().complete(response);
+            var fut = responseFuture.future();
+
+            if (fut.isCompletedExceptionally()) {
+                metrics.incrementInvokeTimeouts();
+            } else {
+                fut.complete(response);
+            }

Review Comment:
   As for preventing the race, I would have to probably wrap parts of code 
checking and setting completion in synchronized blocks. Not sure if that would 
impact performance. But it seems the race was there already (between the 
timeout worker checking for a timeout and marking the future as completed 
exceptionally vs the inbound handler thread marking the thread as normally 
completed. Finally it's your call.



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