You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sd...@apache.org on 2022/06/24 17:47:08 UTC

[ignite] branch master updated: IGNITE-17159 Fix race condition in GridNioServer (#10090)

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

sdanilov 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 ca0b626f399 IGNITE-17159 Fix race condition in GridNioServer (#10090)
ca0b626f399 is described below

commit ca0b626f399f49d5965852fc242f9f0b5740a7e2
Author: Semyon Danilov <sa...@yandex.ru>
AuthorDate: Fri Jun 24 20:47:03 2022 +0300

    IGNITE-17159 Fix race condition in GridNioServer (#10090)
---
 .../ignite/internal/util/nio/GridNioServer.java    | 36 +++++++++++-----------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
index 2f3e8e55295..b1413c8af04 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
@@ -2849,35 +2849,35 @@ public class GridNioServer<T> {
 
                 IOException err = new IOException("Failed to send message (connection was closed): " + ses);
 
-                if (outRecovery != null || inRecovery != null) {
-                    try {
+                try {
+                    if (outRecovery != null || inRecovery != null) {
                         // Poll will update recovery data.
                         while ((req = ses.pollFuture()) != null) {
                             if (req.skipRecovery())
                                 req.onError(err);
                         }
                     }
-                    finally {
-                        if (outRecovery != null)
-                            outRecovery.release();
+                    else {
+                        if (req != null)
+                            req.onError(err);
 
-                        if (inRecovery != null && inRecovery != outRecovery)
-                            inRecovery.release();
+                        while ((req = ses.pollFuture()) != null)
+                            req.onError(err);
                     }
-                }
-                else {
-                    if (req != null)
-                        req.onError(err);
 
-                    while ((req = ses.pollFuture()) != null)
-                        req.onError(err);
+                    try {
+                        filterChain.onSessionClosed(ses);
+                    }
+                    catch (IgniteCheckedException e1) {
+                        filterChain.onExceptionCaught(ses, e1);
+                    }
                 }
+                finally {
+                    if (outRecovery != null)
+                        outRecovery.release();
 
-                try {
-                    filterChain.onSessionClosed(ses);
-                }
-                catch (IgniteCheckedException e1) {
-                    filterChain.onExceptionCaught(ses, e1);
+                    if (inRecovery != null && inRecovery != outRecovery)
+                        inRecovery.release();
                 }
 
                 return true;