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

ptupitsyn 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 779a6051241 IGNITE-27487 .NET: Fix GetConnections race condition 
(#7375)
779a6051241 is described below

commit 779a605124165c39814c1360539b5cbcf41883a4
Author: Pavel Tupitsyn <[email protected]>
AuthorDate: Fri Jan 9 14:55:33 2026 +0200

    IGNITE-27487 .NET: Fix GetConnections race condition (#7375)
    
    Some tests were flaky, such as `TestPutRoutesRequestToPrimaryNode`, because 
`WaitForConnections` counted connections that were not yet in 
`_endpointsByName` map and thus not ready to server partition-aware requests.
---
 .../dotnet/Apache.Ignite/Internal/ClientFailoverSocket.cs          | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git 
a/modules/platforms/dotnet/Apache.Ignite/Internal/ClientFailoverSocket.cs 
b/modules/platforms/dotnet/Apache.Ignite/Internal/ClientFailoverSocket.cs
index c4795308671..c96e1ea601a 100644
--- a/modules/platforms/dotnet/Apache.Ignite/Internal/ClientFailoverSocket.cs
+++ b/modules/platforms/dotnet/Apache.Ignite/Internal/ClientFailoverSocket.cs
@@ -742,10 +742,13 @@ namespace Apache.Ignite.Internal
                         $"Cluster ID mismatch: expected={_clusterId}, 
actual={socket.ConnectionContext.ClusterIds.StringJoin()}");
                 }
 
-                endpoint.Socket = socket;
-
+                // First update mapping, then set socket:
+                // - GetConnections does not lock and should not return 
connections that are not in the map.
+                // - GetSocketAsync uses a lock and will not see a null/old 
socket.
                 _endpointsByName[socket.ConnectionContext.ClusterNode.Name] = 
endpoint;
 
+                endpoint.Socket = socket;
+
                 return socket;
             }
             finally

Reply via email to