Skip to content

YARN-12005. Fix flaky TestRouterWebServicesREST#testUpdateNodeResource - #8788

Merged
slfan1989 merged 2 commits into
apache:trunkfrom
joseluisll:YARN-12005
Oct 7, 2026
Merged

slfan1989 merged 2 commits into
apache:trunkfrom
joseluisll:YARN-12005

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-12005. Fix flaky TestRouterWebServicesREST#testUpdateNodeResource

TestRouterWebServicesREST#testUpdateNodeResource (also inherited by TestFederationWebApp) fails intermittently with:

org.opentest4j.AssertionFailedError: expected: <4096> but was: <8192>

The RM applies a node resource update asynchronously. AdminService#updateNodeResource only dispatches an RMNodeResourceUpdateEvent, and the new total is set later in RMNodeImpl.UpdateNodeResourceWhenRunningTransition. RMWebServices#updateNodeResource returns rmNode.getTotalCapability() right after dispatching. So when the dispatcher is busy, the POST response and the following GET still report the old 8192 MB.

Test-only fix:

  • After the POST, wait (bounded at 5s, LambdaTestUtils.eventually) until a GET of the node reports the new memory and vcores.
  • Then repeat the same idempotent update and assert the Router's POST response, which now reads the already applied value.

The test has no @Timeout, so the bounded wait is safe.

Related: YARN-12004 / #8786 fixes the Router-vs-RM application lifecycle races in the same classes. It does not touch testUpdateNodeResource, so the two changes are independent.

How was this patch tested?

  • Looped the test 200 times with a temporary @RepeatedTest subclass (not committed), with 8 threads submitting applications to the RM in the background:
    • before: 155/200 failures with the error above
    • after: 0/200 failures
  • Ran TestRouterWebServicesREST and TestFederationWebApp 4 times. testUpdateNodeResource passed in every run of both classes. The remaining intermittent failures in those classes (testAppAttemptXML, testAppXML, testGetContainersXML) also fail without this change and are covered by YARN-12004.

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? (N/A, no object storage changes)
  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0? (N/A, no new dependencies)
  • If applicable, have you updated the LICENSE, LICENSE-binary, NOTICE-binary files? (N/A)

AI Tooling

Contains content generated by Claude Code.

@hadoop-yetus

Copy link
Copy Markdown

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 1m 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 45m 20s trunk passed
+1 💚 compile 0m 54s trunk passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 compile 0m 53s trunk passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 checkstyle 0m 48s trunk passed
+1 💚 mvnsite 0m 55s trunk passed
+1 💚 javadoc 0m 55s trunk passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 javadoc 0m 51s trunk passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 spotbugs 1m 47s trunk passed
+1 💚 shadedclient 31m 54s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 0m 25s the patch passed
+1 💚 compile 0m 25s the patch passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 javac 0m 25s the patch passed
+1 💚 compile 0m 26s the patch passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 javac 0m 26s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 0m 21s the patch passed
+1 💚 mvnsite 0m 29s the patch passed
+1 💚 javadoc 0m 25s the patch passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 javadoc 0m 25s the patch passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 spotbugs 1m 0s the patch passed
+1 💚 shadedclient 32m 7s patch has no errors when building and testing our client artifacts.
_ Other Tests _
-1 ❌ unit 10m 31s /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 35s The patch does not generate ASF License warnings.
134m 51s
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-8788/2/artifact/out/Dockerfile
GITHUB PR #8788
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets
uname Linux fb64822112bb 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 / 29109bb
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-8788/2/testReport/
Max. process+thread count 1301 (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-8788/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 1m 0s 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.
+0 🆗 yamllint 0m 0s yamllint 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 _
+0 🆗 mvndep 2m 30s Maven dependency ordering for branch
+1 💚 mvninstall 45m 25s trunk passed
+1 💚 compile 16m 49s trunk passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 compile 17m 39s trunk passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 checkstyle 5m 30s trunk passed
+1 💚 mvnsite 20m 10s trunk passed
+1 💚 javadoc 10m 3s trunk passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 javadoc 9m 39s trunk passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
-1 ❌ spotbugs 36m 47s /branch-spotbugs-root-warnings.html root in trunk has 81 extant spotbugs warnings.
+1 💚 shadedclient 28m 13s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+0 🆗 mvndep 0m 28s Maven dependency ordering for patch
+1 💚 mvninstall 36m 57s the patch passed
+1 💚 compile 24m 32s the patch passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 javac 24m 32s the patch passed
+1 💚 compile 18m 3s the patch passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 javac 18m 3s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 5m 48s the patch passed
+1 💚 mvnsite 18m 46s the patch passed
+1 💚 javadoc 9m 54s the patch passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 javadoc 9m 47s the patch passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 spotbugs 36m 59s the patch passed
+1 💚 shadedclient 63m 19s patch has no errors when building and testing our client artifacts.
_ Other Tests _
-1 ❌ unit 833m 25s /patch-unit-root.txt root in the patch failed.
+1 💚 asflicense 1m 57s The patch does not generate ASF License warnings.
1225m 41s
Subsystem Report/Notes
Docker ClientAPI=1.56 ServerAPI=1.56 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8788/1/artifact/out/Dockerfile
GITHUB PR #8788
Optional Tests dupname asflicense codespell detsecrets yamllint compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle
uname Linux 85ba83aed960 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 / 7ea9430
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-8788/1/testReport/
Max. process+thread count 3715 (vs. ulimit of 10000)
modules C: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router . U: .
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8788/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.

@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.

Thanks for the fix! Waiting for the node resource update to take effect before checking the response matches the RM’s asynchronous behavior. The approach looks reasonable.

The target tests passed. The remaining Jenkins failure is a container-count comparison race in testGetAppsMultiThread. Since #8787 and #8791 have been merged, please rebase onto the latest trunk and rerun CI.

One small suggestion: please close the first POST Response in a finally block before replacing it with the second response. Also consider configuring HTTP connect and read timeouts, since the five-second eventually deadline does not bound an individual blocking request.

joseluisll and others added 2 commits October 7, 2026 04:18
AdminService#updateNodeResource only dispatches an RMNodeResourceUpdateEvent
on the RM's async dispatcher, and RMWebServices#updateNodeResource returns
rmNode.getTotalCapability() right after dispatching. When the dispatcher is
busy the POST response and the following GET can still report the old total
resource (expected: <4096> but was: <8192>).

Wait (bounded at 5s) until the node reports the new memory and vcores, then
check the Router's POST response with a repeated, idempotent update that
reads the already applied value.

Contains content generated by Claude Code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Close both POST responses in testUpdateNodeResource in a finally block,
and give the test's REST clients connect and read timeouts, so a stuck
request fails instead of hanging past the eventually deadline.

Contains content generated by Claude Code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SmHy1KaQ8NVg2X4e6CxbEH
@hadoop-yetus

Copy link
Copy Markdown

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 1m 11s 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 42m 47s trunk passed
+1 💚 compile 0m 59s trunk passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 compile 0m 58s trunk passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 checkstyle 0m 57s trunk passed
+1 💚 mvnsite 1m 1s trunk passed
+1 💚 javadoc 1m 0s trunk passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 javadoc 0m 57s trunk passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 spotbugs 1m 27s trunk passed
+1 💚 shadedclient 29m 26s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 0m 27s the patch passed
+1 💚 compile 0m 26s the patch passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 javac 0m 26s the patch passed
+1 💚 compile 0m 27s the patch passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 javac 0m 27s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 0m 21s the patch passed
+1 💚 mvnsite 0m 29s the patch passed
+1 💚 javadoc 0m 26s the patch passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 javadoc 0m 25s the patch passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 spotbugs 1m 1s the patch passed
+1 💚 shadedclient 27m 53s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 unit 9m 39s hadoop-yarn-server-router in the patch passed.
+1 💚 asflicense 0m 37s The patch does not generate ASF License warnings.
125m 23s
Subsystem Report/Notes
Docker ClientAPI=1.56 ServerAPI=1.56 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8788/3/artifact/out/Dockerfile
GITHUB PR #8788
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets
uname Linux 2176f7f3e5b1 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 / eeb9db0
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-8788/3/testReport/
Max. process+thread count 1309 (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-8788/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.

@joseluisll joseluisll left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@slfan1989 Addressed the comments in your review, set two timeouts with constants.

@joseluisll
joseluisll requested a review from slfan1989 October 7, 2026 07:46

@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 addressing the response cleanup and HTTP timeout comments. The latest Yetus run is green, and GitHub Actions Build passed. Ready to merge.

@slfan1989
slfan1989 merged commit b216a3a into apache:trunk Oct 7, 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