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

sergey-chugunov-1985 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new 66e34175dc3 IGNITE-28613 GridNioSelfTest#testAsyncSendReceive: fix 
spurious "Invalid message size" in test logs (#13081)
66e34175dc3 is described below

commit 66e34175dc3b9d50c4cdd28947b90af23b1cc5ee
Author: Alexey Abashev <[email protected]>
AuthorDate: Mon May 4 16:20:29 2026 +0300

    IGNITE-28613 GridNioSelfTest#testAsyncSendReceive: fix spurious "Invalid 
message size" in test logs (#13081)
---
 .../ignite/internal/util/nio/GridNioSelfTest.java  | 36 +++++++++++++++++++---
 1 file changed, 32 insertions(+), 4 deletions(-)

diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioSelfTest.java
index 46b6e74224b..8157275b72c 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioSelfTest.java
@@ -678,7 +678,7 @@ public class GridNioSelfTest extends GridCommonAbstractTest 
{
     public void testAsyncSendReceive() throws Exception {
         CountDownLatch latch = new CountDownLatch(10);
 
-        NioListener lsnr = new NioListener(latch);
+        NioListener lsnr = new NoAckNioListener(latch);
 
         GridNioServer<?> srvr1 = startServer(new BufferedParser(false), lsnr);
         GridNioServer<?> srvr2 = startServer(new BufferedParser(false), lsnr);
@@ -1302,13 +1302,13 @@ public class GridNioSelfTest extends 
GridCommonAbstractTest {
      */
     private static class NioListener extends 
GridNioServerListenerAdapter<byte[]> {
         /** */
-        private final AtomicInteger msgCnt = new AtomicInteger(0);
+        protected final AtomicInteger msgCnt = new AtomicInteger(0);
 
         /** */
-        private final AtomicBoolean sizeFailed = new AtomicBoolean(false);
+        protected final AtomicBoolean sizeFailed = new AtomicBoolean(false);
 
         /** */
-        private final CountDownLatch latch;
+        protected final CountDownLatch latch;
 
         /**
          * @param latch The latch.
@@ -1367,6 +1367,34 @@ public class GridNioSelfTest extends 
GridCommonAbstractTest {
         }
     }
 
+    /**
+     * NIO listener that does not send an ack on receive. Used by tests where 
both peers run
+     * a {@link GridNioServer} with {@link BufferedParser} (whose {@code 
encode} skips the size
+     * prefix) — the default ack would be sent as a single raw {@code 0xEF} 
byte and the receiver's
+     * {@link GridBufferedParser} would later parse four such bytes as {@code 
0xEFEFEFEF} and fail.
+     */
+    private static class NoAckNioListener extends NioListener {
+        /**
+         * @param latch The latch.
+         */
+        NoAckNioListener(CountDownLatch latch) {
+            super(latch);
+        }
+
+        /** {@inheritDoc} */
+        @Override public void onMessage(GridNioSession ses, byte[] data) {
+            int expMsgSize = getExpectedMessageSize();
+
+            if (data == null || (expMsgSize != 0 && data.length != expMsgSize))
+                sizeFailed.set(true);
+
+            msgCnt.incrementAndGet();
+
+            if (latch != null)
+                latch.countDown();
+        }
+    }
+
     /**
      * Echo listener.
      */

Reply via email to