Jose Luis López created YARN-12005:
--------------------------------------

             Summary: Fix flaky TestRouterWebServicesREST#testUpdateNodeResource
                 Key: YARN-12005
                 URL: https://issues.apache.org/jira/browse/YARN-12005
             Project: Hadoop YARN
          Issue Type: Test
          Components: router, test
            Reporter: Jose Luis López


{\{TestRouterWebServicesREST#testUpdateNodeResource}} (also inherited by 
\{{TestFederationWebApp}}) fails intermittently:
 
{noformat}
org.opentest4j.AssertionFailedError: expected: <4096> but was: <8192>
at ...TestRouterWebServicesREST.testUpdateNodeResource(...)
{noformat}
 
h3. Cause
The test POSTs a new node resource (4096 MB, 5 vcores) through the Router and 
immediately asserts the returned \{{ResourceInfo}} and a follow-up GET of the 
node. But the RM applies the update asynchronously:
* \{{AdminService#updateNodeResource}} only dispatches an 
\{{RMNodeResourceUpdateEvent}} on the RM async dispatcher.
* The new total is set later, in 
\{{RMNodeImpl.UpdateNodeResourceWhenRunningTransition}}.
* \{{RMWebServices#updateNodeResource}} returns 
\{{rmNode.getTotalCapability()}} right after dispatching, so when the 
dispatcher is busy the response (and the next GET) still reports the old 8192 
MB.
 
h3. Fix (test only)
* 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 deterministically reads the applied value.
 
The test has no \{{@Timeout}}, so the bounded wait is safe.
 
h3. Testing
Looping the test 200 times with 8 threads submitting applications to the RM in 
the background:
* before: 155/200 failures with the error above
* after: 0/200 failures
 
{\{testUpdateNodeResource}} also passed in 4 full runs of 
\{{TestRouterWebServicesREST}} and \{{TestFederationWebApp}}. The other 
intermittent failures in those classes are Router-vs-RM application lifecycle 
races, tracked separately in YARN-12004.
 
h3. Note
Returning the pre-update capability from \{{RMWebServices#updateNodeResource}} 
is arguably an RM behaviour issue too; this JIRA keeps to the test and leaves 
any API change for a separate discussion.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to