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

NSAmelchev 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 bf93f5cf9f4 IGNITE-26585 Fixed NPE on task name resolution (#13403)
bf93f5cf9f4 is described below

commit bf93f5cf9f4f2172f3fad9f798fa0eacaef6f9f8
Author: Nikita Amelchev <[email protected]>
AuthorDate: Tue Jul 28 22:57:12 2026 +0300

    IGNITE-26585 Fixed NPE on task name resolution (#13403)
---
 .../processors/task/GridTaskProcessor.java         |  9 +++-
 .../security/TaskNameResolutionTest.java           | 55 ++++++++++++++++++++++
 .../ignite/testsuites/SecurityTestSuite.java       |  2 +
 3 files changed, 64 insertions(+), 2 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskProcessor.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskProcessor.java
index f2570dffade..d7faab230c4 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskProcessor.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskProcessor.java
@@ -473,8 +473,13 @@ public class GridTaskProcessor extends 
GridProcessorAdapter implements IgniteCha
 
         assert ctx.security().enabled();
 
+        IgniteInternalCache<GridTaskNameHashKey, String> tasksMetaCache = 
taskMetaCache();
+
+        if (tasksMetaCache == null)
+            return null;
+
         try {
-            return taskMetaCache().localPeek(
+            return tasksMetaCache.localPeek(
                 new GridTaskNameHashKey(taskNameHash), null);
         }
         catch (IgniteCheckedException e) {
@@ -1177,7 +1182,7 @@ public class GridTaskProcessor extends 
GridProcessorAdapter implements IgniteCha
 
     /** {@inheritDoc} */
     @Override public void onDeActivate(GridKernalContext kctx) {
-        // No-op.
+        tasksMetaCache = null;
     }
 
     /**
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/security/TaskNameResolutionTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/security/TaskNameResolutionTest.java
new file mode 100644
index 00000000000..786367f29f7
--- /dev/null
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/security/TaskNameResolutionTest.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.security;
+
+import org.apache.ignite.cluster.ClusterState;
+import org.apache.ignite.internal.IgniteEx;
+import org.junit.Test;
+
+/** Tests task metadata lookup. */
+public class TaskNameResolutionTest extends AbstractSecurityTest {
+    /** Task name. */
+    private static final String TASK_NAME = "test-task";
+
+    /** */
+    @Test
+    public void testResolveTaskNameOnInactiveCluster() throws Exception {
+        IgniteEx ignite = startGridAllowAll(getTestIgniteInstanceName(0));
+
+        startGridAllowAll(getTestIgniteInstanceName(1));
+
+        awaitPartitionMapExchange();
+
+        assertTaskNameResolved(ignite);
+
+        ignite.cluster().state(ClusterState.INACTIVE);
+
+        
assertNull(grid(1).context().task().resolveTaskName(TASK_NAME.hashCode()));
+
+        ignite.cluster().state(ClusterState.ACTIVE);
+
+        assertTaskNameResolved(ignite);
+    }
+
+    /** Executes a named task and checks that its name can be resolved on 
another node. */
+    private void assertTaskNameResolved(IgniteEx ignite) {
+        ignite.compute().withName(TASK_NAME).run(() -> {});
+
+        assertEquals(TASK_NAME, 
grid(1).context().task().resolveTaskName(TASK_NAME.hashCode()));
+    }
+}
diff --git 
a/modules/core/src/test/java/org/apache/ignite/testsuites/SecurityTestSuite.java
 
b/modules/core/src/test/java/org/apache/ignite/testsuites/SecurityTestSuite.java
index e93cd40187c..2f34fcc88d8 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/testsuites/SecurityTestSuite.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/testsuites/SecurityTestSuite.java
@@ -22,6 +22,7 @@ import 
org.apache.ignite.internal.processors.security.InvalidServerTest;
 import 
org.apache.ignite.internal.processors.security.NodeConnectionCertificateCapturingTest;
 import 
org.apache.ignite.internal.processors.security.NodeSecurityContextPropagationTest;
 import 
org.apache.ignite.internal.processors.security.SecurityContextInternalFuturePropagationTest;
+import org.apache.ignite.internal.processors.security.TaskNameResolutionTest;
 import 
org.apache.ignite.internal.processors.security.cache.CacheOperationPermissionCheckTest;
 import 
org.apache.ignite.internal.processors.security.cache.CacheOperationPermissionCreateDestroyCheckTest;
 import 
org.apache.ignite.internal.processors.security.cache.ContinuousQueryPermissionCheckTest;
@@ -146,6 +147,7 @@ import org.junit.runners.Suite;
     NodeJoinPermissionsTest.class,
     ActivationOnJoinWithoutPermissionsWithPersistenceTest.class,
     SecurityContextInternalFuturePropagationTest.class,
+    TaskNameResolutionTest.class,
     NodeConnectionCertificateCapturingTest.class,
     OperationContextAttributesTest.class,
     OperationContextAttributePropagationTest.class,

Reply via email to