Jose Luis López created HADOOP-20093:
----------------------------------------
Summary: Make
TestZKDelegationTokenSecretManager#testNodesLoadedAfterRestart deterministic
(renew before restart, wait for load, wider expiry window)
Key: HADOOP-20093
URL: https://issues.apache.org/jira/browse/HADOOP-20093
Project: Hadoop Common
Issue Type: Bug
Reporter: Jose Luis López
h3. Summary
TestZKDelegationTokenSecretManager#testNodesLoadedAfterRestart (hadoop-common)
races the ZK delegation-token background threads around the ZooKeeper restart.
The test reads the restarted manager's memory immediately after startup instead
of waiting for the load, and its 5s renewal/expiry window is not wider than the
background thread's hard-coded minimum 5s sleep, so the good token can expire
before the assertions. The result is an intermittently failing test.
h3. Problems
# After the restart, the test calls zksmNew.getTokenInfoFromMemory(id)
immediately; the restarted manager loads tokens from ZK asynchronously, so the
read can return null and the assertion "good dt should be in memory!" fails.
# The good token is not renewed before the old manager is destroyed; with
RENEW_INTERVAL=5 and the background thread sleeping at least 5 seconds, the
token can expire during the restart window.
# The disappearance of the token after expiry is polled with
GenericTestUtils.waitFor, but the corresponding appearance check after the
restart is missing (immediate read instead).
h3. Proposed fix
A deterministic version of the test exists as commit f64cb3a1df6 ("Make ZK
restart test deterministic", contributed through PR #8838, where it does not
belong):
* renew the good token ({{tm.renewToken(token, "good")}}) before destroying the
old manager, so it survives the restart window;
* wait with GenericTestUtils.waitFor(100, 5000) for the restarted manager to
load the token into memory before asserting;
* extend RENEW_INTERVAL from 5 to 10 seconds so the token does not expire
before the final assertions (test runtime grows by ~5s).
h3. Relationship to other issues
* HADOOP-20009 hardened token-manager cleanup in the same test; HADOOP-20011
releases token managers and Curator clients in finally blocks. Neither covers
the deterministic lifecycle above.
* The change currently rides in PR #8838 (YARN-12025) as an unrelated commit;
it should land separately against this issue so the Router PR stays
review-scoped.
h3. Notes
The modified test has not been executed on the reporter's host (no
hadoop-common test run); the change is small and mechanical, and the patch is
ready to be split out of PR #8838.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]