[
https://issues.apache.org/jira/browse/HADOOP-20093?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18149616#comment-18149616
]
ASF GitHub Bot commented on HADOOP-20093:
-----------------------------------------
joseluisll opened a new pull request, #9020:
URL: https://github.com/apache/hadoop/pull/9020
`TestZKDelegationTokenSecretManager#testNodesLoadedAfterRestart`
(hadoop-common) fails intermittently: it races the ZK delegation-token
background threads around the ZooKeeper restart. Three defects combine:
1. After the restart the test read the new manager's memory immediately; the
restarted manager loads tokens from ZK asynchronously, so the read could return
null and the `assertNotNull("good dt should be in memory!")` could fail.
2. The good token was never renewed before the old manager was destroyed;
with `RENEW_INTERVAL=5` while the background `ExpiredTokenRemover` is
hard-coded to sleep at least 5 seconds per loop, the token could expire during
the restart window.
3. The token's disappearance after expiry was polled with
`GenericTestUtils.waitFor`, but the corresponding appearance check after the
restart was missing.
Changes:
- 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;
- widen `RENEW_INTERVAL` from 5 to 10 seconds (and the matching expiry wait)
so the token does not expire before the final assertions; test runtime grows by
~5s, and the final removal poll gets a 10s budget wider than the remover's 5s
sleep quantum.
Testing: with the patch, `TestZKDelegationTokenSecretManager` passes a
full-class run on the host: Tests run: 12, Failures: 0, Errors: 0 (including
`testNodesLoadedAfterRestart`).
The same change previously rode in PR #8838 (YARN-12025) as an unrelated
commit; it is split out here so that PR stays review-scoped.
> 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
> Priority: Major
> Labels: flaky-test
>
> 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]