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 8d94b95b32d IGNITE-26277 Fix DotNetComputeExecutor process start on 
undeploy (#6519)
8d94b95b32d is described below

commit 8d94b95b32d0eac0e75df7244c3d100375c010b3
Author: Pavel Tupitsyn <[email protected]>
AuthorDate: Mon Sep 1 17:13:09 2025 +0300

    IGNITE-26277 Fix DotNetComputeExecutor process start on undeploy (#6519)
    
    If there is no active executor process, there is nothing to undeploy.
---
 .../platform/dotnet/DotNetComputeExecutor.java     | 36 ++++++++++++----------
 .../platform/dotnet/DotNetComputeExecutorTest.java | 33 ++++++++++++++++++++
 2 files changed, 53 insertions(+), 16 deletions(-)

diff --git 
a/modules/compute/src/main/java/org/apache/ignite/internal/compute/executor/platform/dotnet/DotNetComputeExecutor.java
 
b/modules/compute/src/main/java/org/apache/ignite/internal/compute/executor/platform/dotnet/DotNetComputeExecutor.java
index e590344b371..fcf5ec4d04c 100644
--- 
a/modules/compute/src/main/java/org/apache/ignite/internal/compute/executor/platform/dotnet/DotNetComputeExecutor.java
+++ 
b/modules/compute/src/main/java/org/apache/ignite/internal/compute/executor/platform/dotnet/DotNetComputeExecutor.java
@@ -102,28 +102,32 @@ public class DotNetComputeExecutor {
      *
      * @param unitPath Paths to deployment units to undeploy.
      */
-    public void beginUndeployUnit(Path unitPath) {
+    public synchronized void beginUndeployUnit(Path unitPath) {
         try {
             String unitPathStr = unitPath.toRealPath().toString();
 
-            getPlatformComputeConnectionWithRetryAsync()
-                    .thenCompose(conn -> conn.connectionFut()
-                            .thenCompose(c -> 
c.undeployUnitsAsync(List.of(unitPathStr)))
-                            .exceptionally(e -> {
-                                var cause = unwrapCause(e);
+            if (process == null || isDead(process) || 
process.connectionFut().isCompletedExceptionally()) {
+                // Process is not started or already dead, nothing to undeploy.
+                return;
+            }
 
-                                if (cause instanceof TraceableException) {
-                                    TraceableException te = 
(TraceableException) cause;
+            process.connectionFut()
+                    .thenCompose(c -> 
c.undeployUnitsAsync(List.of(unitPathStr)))
+                    .exceptionally(e -> {
+                        var cause = unwrapCause(e);
 
-                                    if (te.code() == 
Client.SERVER_TO_CLIENT_REQUEST_ERR) {
-                                        // Connection was lost (process 
exited), nothing to do.
-                                        return true;
-                                    }
-                                }
+                        if (cause instanceof TraceableException) {
+                            TraceableException te = (TraceableException) cause;
+
+                            if (te.code() == 
Client.SERVER_TO_CLIENT_REQUEST_ERR) {
+                                // Connection was lost (process exited), 
nothing to do.
+                                return true;
+                            }
+                        }
 
-                                LOG.warn(".NET unit undeploy error: " + 
e.getMessage(), e);
-                                return false;
-                            }));
+                        LOG.warn(".NET unit undeploy error: " + 
e.getMessage(), e);
+                        return false;
+                    });
         } catch (Throwable t) {
             LOG.warn(".NET unit undeploy error: " + t.getMessage(), t);
         }
diff --git 
a/modules/compute/src/test/java/org/apache/ignite/internal/compute/executor/platform/dotnet/DotNetComputeExecutorTest.java
 
b/modules/compute/src/test/java/org/apache/ignite/internal/compute/executor/platform/dotnet/DotNetComputeExecutorTest.java
index feffc0b7e09..88e67db84a6 100644
--- 
a/modules/compute/src/test/java/org/apache/ignite/internal/compute/executor/platform/dotnet/DotNetComputeExecutorTest.java
+++ 
b/modules/compute/src/test/java/org/apache/ignite/internal/compute/executor/platform/dotnet/DotNetComputeExecutorTest.java
@@ -18,11 +18,18 @@
 package org.apache.ignite.internal.compute.executor.platform.dotnet;
 
 import static java.nio.charset.StandardCharsets.UTF_8;
+import static 
org.apache.ignite.internal.util.CompletableFutures.nullCompletedFuture;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.containsString;
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
 
+import java.nio.file.Path;
+import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.TimeUnit;
+import 
org.apache.ignite.internal.compute.executor.platform.PlatformComputeConnection;
+import 
org.apache.ignite.internal.compute.executor.platform.PlatformComputeTransport;
+import org.apache.ignite.internal.testframework.IgniteTestUtils;
 import org.junit.jupiter.api.Test;
 
 /**
@@ -42,4 +49,30 @@ public class DotNetComputeExecutorTest {
         String result = new String(proc.getInputStream().readAllBytes(), 
UTF_8);
         assertThat(result, containsString("file was not found"));
     }
+
+    @Test
+    public void beginUndeployUnitDoesNotStartProcess() {
+        DotNetComputeExecutor executor = new DotNetComputeExecutor(new 
NoOpTransport());
+
+        executor.beginUndeployUnit(Path.of("my.dll"));
+
+        assertNull(IgniteTestUtils.getFieldValue(executor, "process"));
+    }
+
+    private static class NoOpTransport implements PlatformComputeTransport {
+        @Override
+        public String serverAddress() {
+            return "";
+        }
+
+        @Override
+        public boolean sslEnabled() {
+            return false;
+        }
+
+        @Override
+        public CompletableFuture<PlatformComputeConnection> 
registerComputeExecutorId(String computeExecutorId) {
+            return nullCompletedFuture();
+        }
+    }
 }

Reply via email to