You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by rp...@apache.org on 2025/04/29 15:25:35 UTC

(ignite-3) branch main updated: IGNITE-24876 Fix message reordering in network (#5723)

This is an automated email from the ASF dual-hosted git repository.

rpuch pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git


The following commit(s) were added to refs/heads/main by this push:
     new a7a4b679268 IGNITE-24876 Fix message reordering in network (#5723)
a7a4b679268 is described below

commit a7a4b67926842ca66215529a12fb72bc827fe1d2
Author: Roman Puchkovskiy <ro...@gmail.com>
AuthorDate: Tue Apr 29 19:25:30 2025 +0400

    IGNITE-24876 Fix message reordering in network (#5723)
    
    The reordering was happening because messages waiting for a sender to be opened (in the sender awaiting queue) would be written directly to the channel (when the sender was finally opened), bypassing the event loop queue.
---
 .../org/apache/ignite/internal/network/netty/NettySender.java     | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/modules/network/src/main/java/org/apache/ignite/internal/network/netty/NettySender.java b/modules/network/src/main/java/org/apache/ignite/internal/network/netty/NettySender.java
index 9961ec4833c..6c11772a7d6 100644
--- a/modules/network/src/main/java/org/apache/ignite/internal/network/netty/NettySender.java
+++ b/modules/network/src/main/java/org/apache/ignite/internal/network/netty/NettySender.java
@@ -108,11 +108,9 @@ public class NettySender {
 
         // Write in event loop to make sure that, if a ClosedSocketException happens, we recover from it without exiting the event loop.
         // We need this to avoid message reordering due to switching from old channel to a new one.
-        if (channel.eventLoop().inEventLoop()) {
-            writeWithRecovery(obj, channel, triggerChannelRecreation);
-        } else {
-            channel.eventLoop().execute(() -> writeWithRecovery(obj, channel, triggerChannelRecreation));
-        }
+        // Also, we ALWAYS execute the writes on the event loop (by adding them to the event loop queue) even if we are on
+        // the event loop thread, to avoid another reordering.
+        channel.eventLoop().execute(() -> writeWithRecovery(obj, channel, triggerChannelRecreation));
 
         return obj.acknowledgedFuture();
     }