Skip to content

YARN-12003. Shut down the Router scheduled executor on service stop - #8785

Merged
slfan1989 merged 4 commits into
apache:trunkfrom
joseluisll:YARN-11984-3-router-executor-stop
Oct 10, 2026
Merged

slfan1989 merged 4 commits into
apache:trunkfrom
joseluisll:YARN-11984-3-router-executor-stop

Conversation

@joseluisll

@joseluisll joseluisll commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Depends on (has to be merged first):

Description of PR

JIRA: YARN-12003

Router#serviceStart schedules SubClusterCleaner on scheduledExecutorService at a fixed rate. This is on by default (yarn.router.deregister.subcluster.enabled) and runs every 60s. Router#serviceStop never shuts that executor down. As a result, the cleaner outlives the Router and keeps calling FederationStateStoreFacade#getSubClusters and #deregisterSubCluster on a state store that nothing maintains any more. Its thread is not a daemon thread, so it can also keep the JVM alive. This shows up when a Router is stopped inside a JVM that keeps running: tests, embedded or mock federation setups, or a stop/start in the same process.

Changes:

  • Router#serviceStop now calls HadoopExecutors#shutdown(scheduledExecutorService, LOG, 5, SECONDS) before stopping the child services. This is a graceful shutdown with a bounded wait. It waits up to 5s for an in-flight cleaner run to finish, then calls shutdownNow() and waits up to 5s more, so stopping the Router takes at most 10s longer. We don't call shutdownNow() straight away, so that a scan already in progress can finish before the state store it is reading is closed. HadoopExecutors#shutdown does nothing when the executor is null, so stopping a Router that was never initialised is still safe.
  • Adds a @VisibleForTesting getter, Router#getScheduledExecutorService().
  • Adds the test TestRouter#testServiceStopShutsDownScheduledExecutor.

How was this patch tested?

  • TestRouter on Linux with JDK 21: 6/6 tests pass, including the new testServiceStopShutsDownScheduledExecutor.
  • With the HadoopExecutors.shutdown call removed from serviceStop, the new test fails with expected: <true> but was: <false>. So the test does catch the missing shutdown.

For code changes:

  • Does the title of this PR start with the corresponding JIRA issue id (e.g. 'HADOOP-17799. Your PR title ...')?
  • Object storage: Have the integration tests been executed and the endpoint
    declared according to the connector-specific documentation? Note: Automated CI
    testing doesn't cover all cases so manual testing with cloud storage is still
    required.
  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?
  • If applicable, have you updated the LICENSE, LICENSE-binary, NOTICE-binary files?

AI Tooling

If an AI tool was used:

Contains content generated by Claude Code.

@joseluisll
joseluisll force-pushed the YARN-11984-3-router-executor-stop branch from c0ce1a1 to b516741 Compare October 3, 2026 08:37
@slfan1989 slfan1989 self-assigned this Oct 3, 2026
@hadoop-yetus

Copy link
Copy Markdown

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 6m 12s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 test4tests 0m 0s The patch appears to include 1 new or modified test files.
_ trunk Compile Tests _
+1 💚 mvninstall 27m 13s trunk passed
+1 💚 compile 0m 26s trunk passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 compile 0m 26s trunk passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 checkstyle 0m 27s trunk passed
+1 💚 mvnsite 0m 30s trunk passed
+1 💚 javadoc 0m 27s trunk passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 javadoc 0m 29s trunk passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 spotbugs 0m 46s trunk passed
+1 💚 shadedclient 16m 49s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 0m 21s the patch passed
+1 💚 compile 0m 19s the patch passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 javac 0m 19s the patch passed
+1 💚 compile 0m 20s the patch passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 javac 0m 20s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 0m 12s the patch passed
+1 💚 mvnsite 0m 22s the patch passed
-1 ❌ javadoc 0m 18s /results-javadoc-javadoc-hadoop-yarn-project_hadoop-yarn_hadoop-yarn-server_hadoop-yarn-server-router-jdkUbuntu-21.0.12.1+1-1-24.04.4-Ubuntu.txt hadoop-yarn-project_hadoop-yarn_hadoop-yarn-server_hadoop-yarn-server-router-jdkUbuntu-21.0.12.1+1-1-24.04.4-Ubuntu with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu generated 1 new + 695 unchanged - 0 fixed = 696 total (was 695)
-1 ❌ javadoc 0m 16s /results-javadoc-javadoc-hadoop-yarn-project_hadoop-yarn_hadoop-yarn-server_hadoop-yarn-server-router-jdkUbuntu-17.0.20.1+1-1-24.04-Ubuntu.txt hadoop-yarn-project_hadoop-yarn_hadoop-yarn-server_hadoop-yarn-server-router-jdkUbuntu-17.0.20.1+1-1-24.04-Ubuntu with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu generated 1 new + 674 unchanged - 0 fixed = 675 total (was 674)
+1 💚 spotbugs 0m 47s the patch passed
+1 💚 shadedclient 16m 20s patch has no errors when building and testing our client artifacts.
_ Other Tests _
-1 ❌ unit 8m 13s /patch-unit-hadoop-yarn-project_hadoop-yarn_hadoop-yarn-server_hadoop-yarn-server-router.txt hadoop-yarn-server-router in the patch passed.
+1 💚 asflicense 0m 25s The patch does not generate ASF License warnings.
83m 20s
Reason Tests
Failed junit tests hadoop.yarn.server.router.webapp.TestFederationWebApp
Subsystem Report/Notes
Docker ClientAPI=1.56 ServerAPI=1.56 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8785/2/artifact/out/Dockerfile
GITHUB PR #8785
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets
uname Linux c7cd414da30b 5.15.0-190-generic #200-Ubuntu SMP Fri Aug 7 15:06:04 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / b516741
Default Java Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
Multi-JDK versions /usr/lib/jvm/java-21-openjdk-amd64:Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu /usr/lib/jvm/java-17-openjdk-amd64:Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8785/2/testReport/
Max. process+thread count 1312 (vs. ulimit of 10000)
modules C: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router U: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8785/2/console
versions git=2.43.0 maven=3.9.15 spotbugs=4.9.7
Powered by Apache Yetus 0.14.1 https://yetus.apache.org

This message was automatically generated.

@hadoop-yetus

Copy link
Copy Markdown

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 6m 59s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 test4tests 0m 0s The patch appears to include 1 new or modified test files.
_ trunk Compile Tests _
+1 💚 mvninstall 27m 19s trunk passed
+1 💚 compile 0m 27s trunk passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 compile 0m 26s trunk passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 checkstyle 0m 26s trunk passed
+1 💚 mvnsite 0m 29s trunk passed
+1 💚 javadoc 0m 29s trunk passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 javadoc 0m 28s trunk passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 spotbugs 0m 44s trunk passed
+1 💚 shadedclient 16m 43s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 0m 22s the patch passed
+1 💚 compile 0m 19s the patch passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 javac 0m 19s the patch passed
+1 💚 compile 0m 21s the patch passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 javac 0m 21s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 0m 13s the patch passed
+1 💚 mvnsite 0m 21s the patch passed
-1 ❌ javadoc 0m 18s /results-javadoc-javadoc-hadoop-yarn-project_hadoop-yarn_hadoop-yarn-server_hadoop-yarn-server-router-jdkUbuntu-21.0.12.1+1-1-24.04.4-Ubuntu.txt hadoop-yarn-project_hadoop-yarn_hadoop-yarn-server_hadoop-yarn-server-router-jdkUbuntu-21.0.12.1+1-1-24.04.4-Ubuntu with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu generated 1 new + 695 unchanged - 0 fixed = 696 total (was 695)
-1 ❌ javadoc 0m 16s /results-javadoc-javadoc-hadoop-yarn-project_hadoop-yarn_hadoop-yarn-server_hadoop-yarn-server-router-jdkUbuntu-17.0.20.1+1-1-24.04-Ubuntu.txt hadoop-yarn-project_hadoop-yarn_hadoop-yarn-server_hadoop-yarn-server-router-jdkUbuntu-17.0.20.1+1-1-24.04-Ubuntu with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu generated 1 new + 674 unchanged - 0 fixed = 675 total (was 674)
+1 💚 spotbugs 0m 45s the patch passed
+1 💚 shadedclient 16m 22s patch has no errors when building and testing our client artifacts.
_ Other Tests _
-1 ❌ unit 8m 12s /patch-unit-hadoop-yarn-project_hadoop-yarn_hadoop-yarn-server_hadoop-yarn-server-router.txt hadoop-yarn-server-router in the patch passed.
+1 💚 asflicense 0m 25s The patch does not generate ASF License warnings.
84m 3s
Reason Tests
Failed junit tests hadoop.yarn.server.router.webapp.TestFederationWebApp
Subsystem Report/Notes
Docker ClientAPI=1.56 ServerAPI=1.56 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8785/1/artifact/out/Dockerfile
GITHUB PR #8785
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets
uname Linux 7a4b32562077 5.15.0-190-generic #200-Ubuntu SMP Fri Aug 7 15:06:04 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / b516741
Default Java Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
Multi-JDK versions /usr/lib/jvm/java-21-openjdk-amd64:Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu /usr/lib/jvm/java-17-openjdk-amd64:Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8785/1/testReport/
Max. process+thread count 1283 (vs. ulimit of 10000)
modules C: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router U: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8785/1/console
versions git=2.43.0 maven=3.9.15 spotbugs=4.9.7
Powered by Apache Yetus 0.14.1 https://yetus.apache.org

This message was automatically generated.

@joseluisll
joseluisll force-pushed the YARN-11984-3-router-executor-stop branch from b516741 to c79b87c Compare October 6, 2026 12:24
@slfan1989
slfan1989 self-requested a review October 6, 2026 13:23
@hadoop-yetus

Copy link
Copy Markdown

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 22s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 test4tests 0m 0s The patch appears to include 1 new or modified test files.
_ trunk Compile Tests _
+1 💚 mvninstall 29m 5s trunk passed
+1 💚 compile 0m 31s trunk passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 compile 0m 36s trunk passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 checkstyle 0m 36s trunk passed
+1 💚 mvnsite 0m 39s trunk passed
+1 💚 javadoc 0m 41s trunk passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 javadoc 0m 36s trunk passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 spotbugs 0m 52s trunk passed
+1 💚 shadedclient 16m 2s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 0m 18s the patch passed
+1 💚 compile 0m 18s the patch passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 javac 0m 18s the patch passed
+1 💚 compile 0m 17s the patch passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 javac 0m 17s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 0m 14s the patch passed
+1 💚 mvnsite 0m 19s the patch passed
-1 ❌ javadoc 0m 17s /results-javadoc-javadoc-hadoop-yarn-project_hadoop-yarn_hadoop-yarn-server_hadoop-yarn-server-router-jdkUbuntu-21.0.12.1+1-1-24.04.4-Ubuntu.txt hadoop-yarn-project_hadoop-yarn_hadoop-yarn-server_hadoop-yarn-server-router-jdkUbuntu-21.0.12.1+1-1-24.04.4-Ubuntu with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu generated 1 new + 695 unchanged - 0 fixed = 696 total (was 695)
-1 ❌ javadoc 0m 17s /results-javadoc-javadoc-hadoop-yarn-project_hadoop-yarn_hadoop-yarn-server_hadoop-yarn-server-router-jdkUbuntu-17.0.20.1+1-1-24.04-Ubuntu.txt hadoop-yarn-project_hadoop-yarn_hadoop-yarn-server_hadoop-yarn-server-router-jdkUbuntu-17.0.20.1+1-1-24.04-Ubuntu with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu generated 1 new + 674 unchanged - 0 fixed = 675 total (was 674)
+1 💚 spotbugs 0m 39s the patch passed
+1 💚 shadedclient 15m 22s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 unit 7m 16s hadoop-yarn-server-router in the patch passed.
+1 💚 asflicense 0m 24s The patch does not generate ASF License warnings.
77m 22s
Subsystem Report/Notes
Docker ClientAPI=1.56 ServerAPI=1.56 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8785/3/artifact/out/Dockerfile
GITHUB PR #8785
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets
uname Linux ca4f253362b5 5.15.0-190-generic #200-Ubuntu SMP Fri Aug 7 15:06:04 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / c79b87c
Default Java Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
Multi-JDK versions /usr/lib/jvm/java-21-openjdk-amd64:Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu /usr/lib/jvm/java-17-openjdk-amd64:Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8785/3/testReport/
Max. process+thread count 1297 (vs. ulimit of 10000)
modules C: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router U: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8785/3/console
versions git=2.43.0 maven=3.9.15 spotbugs=4.9.7
Powered by Apache Yetus 0.14.1 https://yetus.apache.org

This message was automatically generated.

@hadoop-yetus

Copy link
Copy Markdown

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 21s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 1s codespell was not available.
+0 🆗 detsecrets 0m 1s detect-secrets was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 test4tests 0m 0s The patch appears to include 1 new or modified test files.
_ trunk Compile Tests _
+1 💚 mvninstall 28m 7s trunk passed
+1 💚 compile 0m 37s trunk passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 compile 0m 37s trunk passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 checkstyle 0m 32s trunk passed
+1 💚 mvnsite 0m 39s trunk passed
+1 💚 javadoc 0m 39s trunk passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 javadoc 0m 36s trunk passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 spotbugs 0m 55s trunk passed
+1 💚 shadedclient 15m 58s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 0m 18s the patch passed
+1 💚 compile 0m 17s the patch passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 javac 0m 17s the patch passed
+1 💚 compile 0m 18s the patch passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 javac 0m 18s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 0m 12s the patch passed
+1 💚 mvnsite 0m 20s the patch passed
-1 ❌ javadoc 0m 16s /results-javadoc-javadoc-hadoop-yarn-project_hadoop-yarn_hadoop-yarn-server_hadoop-yarn-server-router-jdkUbuntu-21.0.12.1+1-1-24.04.4-Ubuntu.txt hadoop-yarn-project_hadoop-yarn_hadoop-yarn-server_hadoop-yarn-server-router-jdkUbuntu-21.0.12.1+1-1-24.04.4-Ubuntu with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu generated 1 new + 695 unchanged - 0 fixed = 696 total (was 695)
+1 💚 javadoc 0m 17s the patch passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 spotbugs 0m 39s the patch passed
+1 💚 shadedclient 15m 24s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 unit 7m 19s hadoop-yarn-server-router in the patch passed.
+1 💚 asflicense 0m 24s The patch does not generate ASF License warnings.
76m 27s
Subsystem Report/Notes
Docker ClientAPI=1.56 ServerAPI=1.56 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8785/4/artifact/out/Dockerfile
GITHUB PR #8785
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets
uname Linux 741a49101237 5.15.0-190-generic #200-Ubuntu SMP Fri Aug 7 15:06:04 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / b94c91e
Default Java Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
Multi-JDK versions /usr/lib/jvm/java-21-openjdk-amd64:Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu /usr/lib/jvm/java-17-openjdk-amd64:Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8785/4/testReport/
Max. process+thread count 1318 (vs. ulimit of 10000)
modules C: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router U: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8785/4/console
versions git=2.43.0 maven=3.9.15 spotbugs=4.9.7
Powered by Apache Yetus 0.14.1 https://yetus.apache.org

This message was automatically generated.

joseluisll and others added 2 commits October 7, 2026 12:52
Router#serviceStart schedules SubClusterCleaner on scheduledExecutorService at
a fixed rate, enabled by default (DEFAULT_ROUTER_DEREGISTER_SUBCLUSTER_ENABLED)
with a 60s interval. serviceStop never shut that executor down, so the cleaner
outlived the Router and kept calling FederationStateStoreFacade#getSubClusters
and #deregisterSubCluster against a state store nothing was maintaining.

Uses HadoopExecutors#shutdown - graceful shutdown, bounded wait, then force -
rather than shutdownNow(), so an in-flight scan finishes before the store it is
reading can be closed. It waits up to 5s for the executor to drain, then
interrupts it and waits up to 5s more, so this adds at most 10s to stopping the
Router.

TestRouter covers it through a new @VisibleForTesting getter for the
executor: once the Router has stopped, the executor is terminated.

Split out of YARN-11984, whose federation mock Router closes the state store
once the Router has stopped and so relies on the cleaner having stopped.

Contains content generated by Claude Code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@joseluisll
joseluisll force-pushed the YARN-11984-3-router-executor-stop branch from b94c91e to 7131c20 Compare October 7, 2026 10:52
@hadoop-yetus

Copy link
Copy Markdown

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 24s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 1s codespell was not available.
+0 🆗 detsecrets 0m 1s detect-secrets was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 test4tests 0m 0s The patch appears to include 1 new or modified test files.
_ trunk Compile Tests _
+1 💚 mvninstall 27m 30s trunk passed
+1 💚 compile 0m 35s trunk passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 compile 0m 38s trunk passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 checkstyle 0m 36s trunk passed
+1 💚 mvnsite 0m 39s trunk passed
+1 💚 javadoc 0m 35s trunk passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 javadoc 0m 31s trunk passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 spotbugs 0m 50s trunk passed
+1 💚 shadedclient 15m 49s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 0m 19s the patch passed
+1 💚 compile 0m 18s the patch passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 javac 0m 18s the patch passed
+1 💚 compile 0m 17s the patch passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 javac 0m 17s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 0m 14s the patch passed
+1 💚 mvnsite 0m 19s the patch passed
-1 ❌ javadoc 0m 16s /results-javadoc-javadoc-hadoop-yarn-project_hadoop-yarn_hadoop-yarn-server_hadoop-yarn-server-router-jdkUbuntu-21.0.12.1+1-1-24.04.4-Ubuntu.txt hadoop-yarn-project_hadoop-yarn_hadoop-yarn-server_hadoop-yarn-server-router-jdkUbuntu-21.0.12.1+1-1-24.04.4-Ubuntu with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu generated 1 new + 695 unchanged - 0 fixed = 696 total (was 695)
+1 💚 javadoc 0m 16s the patch passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 spotbugs 0m 40s the patch passed
+1 💚 shadedclient 15m 22s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 unit 7m 15s hadoop-yarn-server-router in the patch passed.
+1 💚 asflicense 0m 24s The patch does not generate ASF License warnings.
75m 33s
Subsystem Report/Notes
Docker ClientAPI=1.56 ServerAPI=1.56 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8785/5/artifact/out/Dockerfile
GITHUB PR #8785
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets
uname Linux 2145011407f6 5.15.0-190-generic #200-Ubuntu SMP Fri Aug 7 15:06:04 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / 7131c20
Default Java Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
Multi-JDK versions /usr/lib/jvm/java-21-openjdk-amd64:Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu /usr/lib/jvm/java-17-openjdk-amd64:Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8785/5/testReport/
Max. process+thread count 1297 (vs. ulimit of 10000)
modules C: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router U: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8785/5/console
versions git=2.43.0 maven=3.9.15 spotbugs=4.9.7
Powered by Apache Yetus 0.14.1 https://yetus.apache.org

This message was automatically generated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hadoop-yetus

Copy link
Copy Markdown

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 22s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 test4tests 0m 0s The patch appears to include 1 new or modified test files.
_ trunk Compile Tests _
+1 💚 mvninstall 29m 27s trunk passed
+1 💚 compile 0m 33s trunk passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 compile 0m 29s trunk passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 checkstyle 0m 32s trunk passed
+1 💚 mvnsite 0m 30s trunk passed
+1 💚 javadoc 0m 30s trunk passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 javadoc 0m 30s trunk passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 spotbugs 0m 45s trunk passed
+1 💚 shadedclient 16m 26s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 0m 20s the patch passed
+1 💚 compile 0m 20s the patch passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 javac 0m 20s the patch passed
+1 💚 compile 0m 20s the patch passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 javac 0m 20s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 0m 14s the patch passed
+1 💚 mvnsite 0m 20s the patch passed
+1 💚 javadoc 0m 17s the patch passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 javadoc 0m 19s the patch passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 spotbugs 0m 43s the patch passed
+1 💚 shadedclient 17m 19s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 unit 7m 40s hadoop-yarn-server-router in the patch passed.
+1 💚 asflicense 0m 25s The patch does not generate ASF License warnings.
80m 27s
Subsystem Report/Notes
Docker ClientAPI=1.56 ServerAPI=1.56 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8785/6/artifact/out/Dockerfile
GITHUB PR #8785
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets
uname Linux 64943a15e0e0 5.15.0-190-generic #200-Ubuntu SMP Fri Aug 7 15:06:04 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / 7d722f8
Default Java Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
Multi-JDK versions /usr/lib/jvm/java-21-openjdk-amd64:Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu /usr/lib/jvm/java-17-openjdk-amd64:Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8785/6/testReport/
Max. process+thread count 1310 (vs. ulimit of 10000)
modules C: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router U: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8785/6/console
versions git=2.43.0 maven=3.9.15 spotbugs=4.9.7
Powered by Apache Yetus 0.14.1 https://yetus.apache.org

This message was automatically generated.

@joseluisll

Copy link
Copy Markdown
Contributor Author

@slfan1989 This PR is CI green and Yetus green, and ready to review.

@slfan1989 slfan1989 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

One small, non-blocking suggestion: could you reword "it must not still be running once the Router has stopped" to describe the bounded shutdown?

HadoopExecutors.shutdown() may return after the timeout if a task does not respond to interruption.

For example:

// Shut down the executor before stopping child services, allowing an
// in-flight cleaner run to finish within the configured timeout.

…top.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@joseluisll

Copy link
Copy Markdown
Contributor Author

Thanks @slfan1989, reworded in b816940 to describe the bounded, best-effort shutdown. Could you re-review when you get a chance? The review is still marked "changes requested".

@hadoop-yetus

Copy link
Copy Markdown

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 21s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 test4tests 0m 0s The patch appears to include 1 new or modified test files.
_ trunk Compile Tests _
+1 💚 mvninstall 28m 4s trunk passed
+1 💚 compile 0m 37s trunk passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 compile 0m 37s trunk passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 checkstyle 0m 33s trunk passed
+1 💚 mvnsite 0m 39s trunk passed
+1 💚 javadoc 0m 37s trunk passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 javadoc 0m 28s trunk passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 spotbugs 0m 56s trunk passed
+1 💚 shadedclient 17m 44s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 0m 20s the patch passed
+1 💚 compile 0m 17s the patch passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 javac 0m 17s the patch passed
+1 💚 compile 0m 15s the patch passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 javac 0m 15s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 0m 12s the patch passed
+1 💚 mvnsite 0m 17s the patch passed
+1 💚 javadoc 0m 15s the patch passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 javadoc 0m 16s the patch passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 spotbugs 0m 37s the patch passed
+1 💚 shadedclient 17m 6s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 unit 7m 10s hadoop-yarn-server-router in the patch passed.
+1 💚 asflicense 0m 23s The patch does not generate ASF License warnings.
79m 6s
Subsystem Report/Notes
Docker ClientAPI=1.56 ServerAPI=1.56 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8785/7/artifact/out/Dockerfile
GITHUB PR #8785
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets
uname Linux d3b0c106c7a3 5.15.0-190-generic #200-Ubuntu SMP Fri Aug 7 15:06:04 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / b816940
Default Java Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
Multi-JDK versions /usr/lib/jvm/java-21-openjdk-amd64:Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu /usr/lib/jvm/java-17-openjdk-amd64:Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8785/7/testReport/
Max. process+thread count 1288 (vs. ulimit of 10000)
modules C: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router U: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8785/7/console
versions git=2.43.0 maven=3.9.15 spotbugs=4.9.7
Powered by Apache Yetus 0.14.1 https://yetus.apache.org

This message was automatically generated.

@joseluisll
joseluisll requested a review from slfan1989 October 8, 2026 15:41

@slfan1989 slfan1989 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Thanks for updating the comment to accurately describe the bounded, best-effort shutdown. My previous concern has been addressed.

This PR is ready to merge from my side.

@slfan1989
slfan1989 merged commit 2ca361f into apache:trunk Oct 10, 2026
6 checks passed
@slfan1989

Copy link
Copy Markdown
Contributor

@joseluisll Thanks for the contribution! Merged into trunk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants