You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by tk...@apache.org on 2026/04/03 07:49:20 UTC

(ignite) branch ignite-28449 created (now 7fca982a718)

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

tkalkirill pushed a change to branch ignite-28449
in repository https://gitbox.apache.org/repos/asf/ignite.git


      at 7fca982a718 IGNITE-28449 wip

This branch includes the following new commits:

     new 7fca982a718 IGNITE-28449 wip

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(ignite) 01/01: IGNITE-28449 wip

Posted by tk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tkalkirill pushed a commit to branch ignite-28449
in repository https://gitbox.apache.org/repos/asf/ignite.git

commit 7fca982a71897c1ef8c0ab6f7748f5377fd9a225
Author: Kirill Tkalenko <tk...@yandex.ru>
AuthorDate: Fri Apr 3 10:48:56 2026 +0300

    IGNITE-28449 wip
---
 .../internal/IgniteThreadGroupNodeRestartTest.java | 74 ++++++++++++++++++++--
 1 file changed, 68 insertions(+), 6 deletions(-)

diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteThreadGroupNodeRestartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteThreadGroupNodeRestartTest.java
index a828b9a49b1..e2ad00f6556 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteThreadGroupNodeRestartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteThreadGroupNodeRestartTest.java
@@ -17,14 +17,33 @@
 
 package org.apache.ignite.internal;
 
+import java.util.Arrays;
+import java.util.Objects;
 import java.util.concurrent.atomic.AtomicReference;
+import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.junit.Test;
 
+import static java.util.stream.Collectors.joining;
+
 /**
  *
  */
 public class IgniteThreadGroupNodeRestartTest extends GridCommonAbstractTest {
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        stopAllGrids();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        super.afterTest();
+
+        stopAllGrids();
+    }
+
     /**
      * @throws Exception if failed.
      */
@@ -36,9 +55,7 @@ public class IgniteThreadGroupNodeRestartTest extends GridCommonAbstractTest {
 
         Thread t = new Thread(tg, () -> {
             try {
-                startGrid(0);
-
-                stopGrid(0);
+                startStopGrid(0);
             }
             catch (Exception e) {
                 err.set(e);
@@ -47,13 +64,58 @@ public class IgniteThreadGroupNodeRestartTest extends GridCommonAbstractTest {
 
         t.start();
         t.join(getTestTimeout());
+        assertFalse(t.isAlive());
 
         if (err.get() != null)
             throw err.get();
 
-        tg.destroy();
+        destroyWithWaitAllThreadIsComplete(tg, getTestTimeout());
+
+        startStopGrid(0);
+    }
+
+    /** */
+    private void startStopGrid(int idx) throws Exception {
+        startGrid(idx);
+        stopGrid(idx);
+    }
+
+    /** */
+    private static void destroyWithWaitAllThreadIsComplete(ThreadGroup tg, long millis) throws Exception {
+        if (GridTestUtils.waitForCondition(() -> tg.activeCount() == 0, millis, 10) || tg.activeCount() == 0) {
+            tg.destroy();
+
+            return;
+        }
+
+        Thread[] threads = new Thread[tg.activeCount() + 256];
+        int copied = tg.enumerate(threads, true);
+
+        if (copied == 0) {
+            tg.destroy();
+
+            return;
+        }
+
+        fail(String.format(
+            "Thread group still has active threads: [count=%s, threads=%s]",
+            copied, threadInfos(threads)
+        ));
+    }
+
+    /** */
+    private static String threadInfos(Thread... threads) {
+        return Arrays.stream(threads)
+            .filter(Objects::nonNull)
+            .map(IgniteThreadGroupNodeRestartTest::threadInfo)
+            .collect(joining(", ", "[", "]"));
+    }
 
-        startGrid(0);
-        stopGrid(0);
+    /** */
+    private static String threadInfo(Thread t) {
+        return String.format(
+            "[id=%s, name=%s, alive=%s, deamon=%s, state=%s]",
+            t.getId(), t.getName(), t.isAlive(), t.isDaemon(), t.getState()
+        );
     }
 }