[
https://issues.apache.org/jira/browse/HDDS-18000?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18155112#comment-18155112
]
Neo Chien commented on HDDS-18000:
----------------------------------
Thanks for flagging, [~adoroszlai] . I looked into it, and I don't think
HDDS-6649 is the cause.
The test asserts on ExitUtils.getFirstExitException() right after
verify(mockScm, timeout(5000)).stop() returns. But SCMStateMachine#close() runs
asynchronously (notifyServerShutdown > runAsync), and calls scm.stop() first
and ExitUtils.terminate(0, ...) afterwards. If the test thread reads in
between, the exception is not recorded yet, hence the NPE at line 191. This
ordering comes from HDDS-16922 and the async call from HDDS-17758. HDDS-6649
only adds a branch in applyTransaction and a separate test, which don't touch
this patch.
I confirmed the race by injecting a 300ms delay between stop() and terminate():
the test then fails with the same NPE every time. I also reproduced the NPE
with the HDDS-6649 changes reverted (2 of 50 runs of the whole test class under
CPU load), so it is independent of that change. The failure rate is low, so I
can't statistically tell "before" from "after" HDDS-6649.
Proposed test-only fix: wait for the exit before asserting, e.g.,
GenericTestUtils.waitFor(ExitUtils::isTerminated, 10, 5000) after the
never().shutDown check, as HDDS-16922 did in TestSCMHAManagerImpl. With the
injected delay it passes 5 of 5 (vs. 0 of 3 before). I can file a patch if that
sounds good.
> Intermittent NPE in
> testNotifyServerShutdownExitsCleanlyWhenScmIsDecommissioned
> -------------------------------------------------------------------------------
>
> Key: HDDS-18000
> URL: https://issues.apache.org/jira/browse/HDDS-18000
> Project: Apache Ozone
> Issue Type: Sub-task
> Reporter: Attila Doroszlai
> Assignee: Neo Chien
> Priority: Major
>
> {code:title=https://github.com/apache/ozone/actions/runs/47069744911/job/144148081693#step:17:310}
> [ERROR] Tests run: 22, Failures: 0, Errors: 1, Skipped: 0, Time elapsed:
> 4.485 s <<< FAILURE! -- in org.apache.hadoop.hdds.scm.ha.TestSCMStateMachine
> [ERROR]
> org.apache.hadoop.hdds.scm.ha.TestSCMStateMachine.testNotifyServerShutdownExitsCleanlyWhenScmIsDecommissioned
> -- Time elapsed: 0.015 s <<< ERROR!
> java.lang.NullPointerException: Cannot invoke
> "org.apache.ratis.util.ExitUtils$ExitException.getStatus()" because the
> return value of "org.apache.ratis.util.ExitUtils.getFirstExitException()" is
> null
> at
> org.apache.hadoop.hdds.scm.ha.TestSCMStateMachine.testNotifyServerShutdownExitsCleanlyWhenScmIsDecommissioned(TestSCMStateMachine.java:191)
> {code}
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]